Azure Developer Terraform
Azure Developer Terraform
Getting started
e OVERVIEW
i REFERENCE
Y ARCHITECTURE
p CONCEPT
b GET STARTED
e OVERVIEW
p CONCEPT
Azure Export for Terraform concepts
f QUICKSTART
c HOW-TO GUIDE
Advanced scenarios
f QUICKSTART
Create a Linux VM
Create a Windows VM
Networking
f QUICKSTART
Manage infrastructure
f QUICKSTART
Create a Linux VM
Create a Windows VM
c HOW-TO GUIDE
f QUICKSTART
c HOW-TO GUIDE
Lowers the potential for human errors while deploying and managing
infrastructure.
Deploys the same template multiple times to create identical development, test,
and production environments.
Reduces the cost of development and test environments by creating them on-
demand.
The Terraform CLI enables users to validate and preview infrastructure changes before
application of the plan. Previewing infrastructure changes in a safe manner has several
benefits:
Next steps
Based on your environment, install and configure Terraform:
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Overview of the Terraform AzAPI
provider
Article • 05/20/2024
The AzAPI provider is a thin layer on top of the Azure ARM REST APIs. The AzAPI
provider enables you to manage any Azure resource type using any API version. This
provider complements the AzureRM provider by enabling the management of new
Azure resources and properties (including private preview).
Resources
To allow you to manage all Azure resources and features without requiring updates, the
AzAPI provider includes the following generic resources:
ノ Expand table
azapi_resource Used to fully manage any Azure (control plane) resource (API) with full
CRUD.
Example Use Cases:
New preview service
New feature added to existing service
Existing feature / service not currently covered
azapi_update_resource Used to manage resources or parts of resources that don't have full
CRUD
Example Use Cases:
Update new properties on an existing service
Update pre-created child resource - such as DNS SOA record.
Terraform
The following code snippet configures a preview property for an existing resource from
AzureRM:
Terraform
body = jsonencode({
properties = {
anonymousPullEnabled = var.bool_anonymous_pull
}
})
}
The AzAPI2AzureRM tool is designed to help migrate from the AzAPI provider to the
AzureRM provider.
AzAPI2AzureRM ensures after migration that your Terraform configuration and state are
aligned with your actual state. You can validate the state has been updated by running
terraform plan after completing the migration to see that nothing has changed.
Terraform
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
# More information on the authentication methods supported by
# the AzureRM Provider can be found here:
#
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
# subscription_id = "..."
# client_id = "..."
# client_secret = "..."
# tenant_id = "..."
}
3. Declare one or more AzAPI resources as shown in the following example code:
Terraform
location = "eastus"
body = jsonencode({
properties = {
computeType = "ComputeInstance"
disableLocalAuth = true
properties = {
vmSize = "STANDARD_NC6"
}
}
})
}
Next steps
Deploy your first resource with the AzAPI provider
Deploy your first Update Resource with the AzAPI provider
Feedback
Was this page helpful? Yes No
Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
Next steps
Create Azure resource group
Install the Azure Terraform Visual Studio
Code extension
Article • 05/10/2023
The Visual Studio Code Terraform extension enables you to work with Terraform from
the editor. With this extension, you can author, test, and run Terraform configurations.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Install Node.js .
3. From the list of extensions, locate the Azure Terraform extension. (It should be the
first extension listed.)
4. If the extension isn't yet installed, select the extension's Install option.
Key points:
When you select Install for the Azure Terraform extension, Visual Studio Code
automatically installs the Azure Account extension.
Azure Account is a dependency file for the Azure Terraform extension. This
file is used to authenticate to Azure and Azure-related code extensions.
5. To confirm the installation of the extensions, enter @installed in the search text
box. Both the Azure Terraform extension and the Azure Account extension appear
in the list of installed extensions.
You can now run all supported Terraform commands in your Cloud Shell environment
from within Visual Studio Code.
Terraform
terraform {
required_version = ">=0.12"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
4. Create a file named variables.tf to contain the project variables and insert the
following code:
Terraform
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
5. Create a file named outputs.tf to contain the project variables and insert the
following code:
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
2. In the Command Palette text box, start entering Azure Terraform: Push and select
it when it displays.
Key points:
Your workspace files that meet the filter defined in the azureTerraform.files
setting in your configuration are copied to Cloud Shell.
2. In the Command Palette text box, start entering Azure Terraform: Init and select
it when it displays.
Key points:
Selecting this option is the same as running terraform init from the
command line and initializes your Terraform deployment.
This command downloads the Azure modules required to create an Azure
resource group.
3. Follow the prompts to install any dependencies - such as the latest supported
version of nodejs.
4. If you're using Cloud Shell for the first time with your default Azure subscription,
follow the prompts to configure the environment.
Key points:
This command runs terraform plan to create an execution plan from the
Terraform configuration files in the current directory.
2. In the Command Palette text box, start entering Azure Terraform: Apply and select
it when it displays.
2. In the Command Palette text box, start entering Azure: Open Bash in Cloud
Shell and select it when it displays.
Azure CLI
9. Clean up resources
1. From the View menu, select Command Palette....
2. In the Command Palette text box, start entering Azure Terraform: Destroy and
select it when it displays.
4. To confirm that Terraform successfully destroyed your new resource group, run the
steps in the section, Verify the results.
Next steps
Read more about the Azure Terraform Visual Studio Code extension
Authenticate Terraform to Azure
Article • 06/20/2024
To use Terraform commands against your Azure subscription, you must first authenticate
Terraform to that subscription. This article covers some common scenarios for
authenticating to Azure.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Authenticate with a Microsoft account using Cloud Shell (with Bash or PowerShell)
Authenticate with a Microsoft account using Windows (with Bash or PowerShell)
Authenticate with a service principal
Authenticate with a managed identity for Azure services
Bash
To confirm the current Azure subscription with the Azure CLI, run az account show.
Azure CLI
az account show
Next steps
Your first Terraform project: Create an Azure resource group
Feedback
Was this page helpful? Yes No
In this article, you learn how to use the combination of Terraform and Yeoman .
Terraform is a tool for creating infrastructure on Azure. Yeoman makes it easy to create
Terraform modules.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Visual Studio Code: Download Visual Studio Code for your platform.
Docker: Install Docker to run the module created by the Yeoman generator.
Yeoman template: Run the following command to install the Yeoman template for
Terraform module: npm install -g generator-az-terra-module .
This empty directory is required to be put under $GOPATH/src. For more information
about this path, see the article Setting GOPATH .
2. Run the following command replacing the placeholder. For this example, a
directory name of GeneratorDocSample is used.
Bash
mkdir <new-directory-name>
Bash
cd <new-directory-name>
Bash
yo az-terra-module
Would you like to include the Docker image file? - Enter y . If you enter n ,
the generated module code will support running only in native mode.
3. List the directory contents to view the resulting files that are created:
Bash
ls
4. Review the generated module code
1. Launch Visual Studio Code
2. From the menu bar, select File > Open Folder and select the folder you created.
outputs.tf - Defines what the module outputs. Here, it's the value returned by
random_shuffle , which is a built-in, Terraform module.
unit - The generated module skeleton doesn't include code for a unit test. If
you want to specify a unit test scenario, you would you add that code here.
e2e - Runs an end-to-end test of the module.
test
Test cases are written in Go.
All codes in test are end-to-end tests.
End-to-end tests attempt to provision all of the items defined under fixture .
The results in the template_output.go file are compared with the pre-defined
expected values.
Gopkg.lock and Gopkg.toml : Defines the dependencies.
7 Note
2. From the command prompt, enter docker image ls to see your created module
terra-mod-example listed.
3. Enter docker run -it terra-mod-example /bin/sh . After running the docker run
command, you're in the Docker environment. At that point, you can discover the
file by using the ls command.
Bash
bundle install
Bash
rake build
Bash
rake e2e
3. Enter exit to complete the test and exit the Docker environment.
Node.js
Yeoman
Terraform
2. The Welcome to Azure Cloud Shell page opens. Select Bash (Linux).
3. If you have not already set up an Azure storage account, the following screen
appears. Select Create storage.
4. Azure Cloud Shell launches in the shell you previously selected and displays
information for the cloud drive it just created for you.
Prepare a directory to hold your Terraform module
1. At this point, Cloud Shell will have already configured GOPATH in your
environment variables for you. To see the path, enter go env .
2. Create the $GOPATH directory, if one doesn't already exist: Enter mkdir ~/go .
3. Create a directory within the $GOPATH directory. This directory is used to hold the
different project directories created in this example.
Bash
mkdir ~/go/src
4. Create a directory to hold your Terraform module replacing the placeholder. For
this example, a directory name of my-module-name is used.
Bash
mkdir ~/go/src/<your-module-name>
Bash
cd ~/go/src/<your-module-name>
Create and test your Terraform module
1. Run the following command and follow the instructions. When asked if you want
to create the Docker files, you enter N .
Bash
yo az-terra-module
Bash
bundle install
Bash
rake build
Bash
rake e2e
Next steps
Install and use the Azure Terraform Visual Studio Code extension .
Store Terraform state in Azure Storage
Article • 05/08/2023
By default, Terraform state is stored locally, which isn't ideal for the following reasons:
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Run the following commands or configuration to create an Azure storage account and
container:
Azure CLI
Azure CLI
#!/bin/bash
RESOURCE_GROUP_NAME=tfstate
STORAGE_ACCOUNT_NAME=tfstate$RANDOM
CONTAINER_NAME=tfstate
Key points:
Azure storage accounts require a globally unique name. To learn more about
troubleshooting storage account names, see Resolve errors for storage account
names.
Terraform state is stored in plain text and may contain secrets. If the state is
incorrectly secured, unauthorized access to systems and data loss can result.
In this example, Terraform authenticates to the Azure storage account using an
Access Key. In a production deployment, it's recommended to evaluate the
available authentication options supported by the azurerm backend and to use
the most secure option for your use case.
In this example, public network access is allowed to this Azure storage account. In
a production deployment, it's recommended to restrict access to this storage
account using a storage firewall, service endpoint, or private endpoint.
Each of these values can be specified in the Terraform configuration file or on the
command line. We recommend that you use an environment variable for the access_key
value. Using an environment variable prevents the key from being written to disk.
Run the following commands to get the storage access key and store it as an
environment variable:
Azure CLI
Azure CLI
Key points:
To further protect the Azure Storage account access key, store it in Azure Key Vault.
The environment variable can then be set by using a command similar to the
following. For more information on Azure Key Vault, see the Azure Key Vault
documentation.
Bash
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
}
backend "azurerm" {
resource_group_name = "tfstate"
storage_account_name = "<storage_account_name>"
container_name = "tfstate"
key = "terraform.tfstate"
}
provider "azurerm" {
features {}
}
Bash
terraform init
Bash
terraform apply
You can now find the state file in the Azure Storage blob.
You can see the lock when you examine the blob through the Azure portal or other
Azure management tooling.
5. Understand encryption-at-rest
Data stored in an Azure blob is encrypted before being persisted. When needed,
Terraform retrieves the state from the backend and stores it in local memory. If you use
this pattern, state is never written to your local disk.
For more information on Azure Storage encryption, see Azure Storage service
encryption for data at rest.
Next steps
Learn more about using Terraform in Azure
Implement compliance testing with
Terraform and Azure
Article • 03/20/2023
Many times, compliance testing is part of the continuous integration process and is used
to ensure that user-defined policies are followed. For example, you might define
geopolitical naming conventions for your Azure resources. Another common example is
creating virtual machines from a defined subset of images. Compliance testing would be
used to enforce rules in these and many other scenarios.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Example code and resources: Using the DownGit tool, download from GitHub the
compliance-testing project and unzip into a new directory to contain the
example code. This directory is referred to as the example directory.
Most software teams do an analysis to check that the standards are properly enforced
and implemented. Often working simultaneously to improve the standards that, in turn,
lead to increased quality.
With compliance testing, there are two important concepts to consider: compliance
testing and compliance checks.
Compliance testing ensures that the output of each development lifecycle phase
conforms to agreed-upon requirements.
Compliance checks should be integrated into the development cycle at the
beginning of the projects. Attempting to add compliance checks at a later stage
becomes increasingly more difficult when the requirement itself isn't adequately
documented.
One way to address this issue would be to define a policy of tagging the resources -
such as with role and creator tags. Once you define the policies, a tool like Terraform-
compliance is used to ensure the policies are followed.
Fortunately, Terraform is an abstraction layer for any API that creates, updates, or
destroys cloud-infrastructure entities. Terraform also ensures the local configuration and
the remote API responses are in synch. Since Terraform is mostly used against Cloud
APIs, we still need a way to ensure the code deployed against the infrastructure follows
specific policies. Terraform-compliance - a free and open-source tool - provides this
functionality for Terraform configurations.
Using the VM example, a compliance policy might be as follows: "If you're creating an
Azure resource, it must contain a tag".
The Terraform-compliance tool provides a test framework where you create policies like
the example. You then run those policies against your Terraform execution plan.
Cucumber
when creating Azure resources, every new resource should have a tag
Cucumber
If the resource supports tags
Then it must contain a tag
And its value must not be null
The Terraform HCL code would then adhere to the rule as follows.
tags = {
environment = "dev"
application = "Azure Compliance"
}
}
Cucumber
Cucumber
Examples:
| tags | value |
| Creator | .+ |
| Application | .+ |
| Role | .+ |
| Environment | ^(prod\|uat\|dev)$ |
Console
terraform init
Console
terraform validate
Key points:
Console
5. Run terraform show to convert the execution plan to JSON for the compliance
step.
Bash
Console
Console
The test will fail because - while the first rule requiring existence of tags
succeeds - the second rule fails in that the Role and Creator tags are
missing.
8. Fix the error by modifying main.tf as follows (where a Role and Creator tag are
added).
Terraform
tags = {
Environment = "dev"
Application = "Azure Compliance"
Creator = "Azure Compliance"
Role = "Azure Compliance"
}
Key points:
Console
terraform validate
3. Run terraform show to convert the execution plan to JSON for the compliance
step.
Bash
4. Run docker run again to test the configuration. If the full spec has been
implemented, the test succeeds.
Console
Console
Key points:
Next steps
Learn more about using Terraform in Azure
Implement end-to-end Terratest testing
on Terraform projects
Article • 09/01/2022
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Example code and resources: Using the DownGit tool, download from GitHub the
end-to-end-testing project and unzip into a new directory to contain the
example code. This directory is referred to as the example directory.
This sample defines a Terraform configuration that deploys two Linux virtual machines
into the same virtual network. One VM - named vm-linux-1 - has a public IP address.
Only port 22 is opened to allow SSH connections. The second VM - vm-linux-2 - has no
defined public IP address.
If you're unfamiliar with how to create a virtual machine, see Create a Linux VM with
infrastructure in Azure using Terraform.
U Caution
The sample scenario presented in this article is for illustration purposes only. We've
purposely kept things simple in order to focus on the steps of an end-to-end test.
We don't recommend having production virtual machines that exposes SSH ports
over a public IP address.
The following source code shows the standard structure of a Golang test using Terratest:
Go
package test
import (
"testing"
"github.com/gruntwork-io/terratest/modules/terraform"
test_structure "github.com/gruntwork-io/terratest/modules/test-
structure"
)
fixtureFolder := "../"
As you can see in the previous code snippet, the test is composed by three stages:
The following list shows some of the key functions provided by the Terratest framework:
3. To run this sample test, you need an SSH private/public key pair name id_rsa and
id_rsa.pub in your home directory. Replace <your_user_name> with the name of
Bash
export TEST_SSH_KEY_PATH="~/.ssh/id_rsa"
Go
Output
Next steps
Learn more about using Terraform in Azure
Implement integration tests for
Terraform projects in Azure
Article • 03/23/2023
Integration tests validate that a newly introduced code change doesn't break existing
code. In DevOps, continuous integration (CI) refers to a process that builds the entire
system whenever the code base is changed - such as someone wanting to merge a PR
into a Git repo. The following list contains common examples of integration tests:
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Azure DevOps organization and project: If you don't have one, create an Azure
DevOps organization.
Terraform Build & Release Tasks extension: Install the Terraform build/release
tasks extension into your Azure DevOps organization.
Grant Azure DevOps access to your Azure Subscription: Create an Azure service
connection named terraform-basic-testing-azure-connection to allow Azure
Pipelines to connect to your Azure subscriptions
Console
terraform init
Console
terraform validate
Key points:
Console
terraform validate
Key points:
You see an error message indicating the line of code in error and a
description of the error.
As you can see, Terraform has detected an issue in the syntax of the configuration code.
This issue prevents the configuration from being deployed.
It is a good practice to always run terraform validate against your Terraform files
before pushing them to your version control system. Also, this level of validation should
be a part of your continuous integration pipeline. Later in this article, we'll explore how
to configure an Azure pipeline to automatically validate.
Terraform is a declarative language meaning that you declare what you want as an end-
result. For example, let's say you have 10 virtual machines in a resource group. Then, you
create a Terraform file defining three virtual machines. Applying this plan doesn't
increment the total count to 13. Instead, Terraform deletes seven of the virtual machines
so that you end with three. Running terraform plan allows you to confirm the potential
results of applying an execution plan to avoid surprises.
To generate the Terraform execution plan, you run terraform plan . This command
connects to the target Azure subscription to check what part of the configuration is
already deployed. Terraform then determines the necessary changes to meet the
requirements stated in the Terraform file. At this stage, Terraform isn't deploying
anything. It's telling you what will happen if you apply the plan.
If you're following along with the article and you've done the steps in the previous
section, run the terraform plan command:
Console
terraform plan
After running terraform plan , Terraform displays the potential outcome of applying the
execution plan. The output indicates the Azure resources that will be added, changed,
and destroyed.
By default, Terraform stores state in the same local directory as the Terraform file. This
pattern works well in single-user scenarios. However, when multiple people work on the
same Azure resources, local state files can get out of sync. To remedy this issue,
Terraform supports writing state files to a remote data store (such as Azure Storage). In
this scenario, it might be problematic to run terraform plan on a local machine and
target a remote machine. As a result, it might make sense to automate this validation
step as part of your continuous integration pipeline.
Checkov
Terrascan
tfsec
Deepsource
Static analysis is often executed part of a continuous integration pipeline. These tests
don't require the creation of an execution plan or deployment. As a result, they run
faster than other tests and are generally run first in the continuous integration process.
1. Using your editor of choice, browse to the local clone of the Terraform sample
project on GitHub .
3. Scroll down to the steps section where you see a standard set of steps used to run
various installation and validation routines.
4. Review the line that reads, Step 1: run the Checkov Static Code Analysis. In this
step, the Checkov project mentioned earlier runs a static code analysis on the
sample Terraform configuration.
YAML
- bash: $(terraformWorkingDirectory)/checkov.sh
$(terraformWorkingDirectory)
displayName: Checkov Static Code Analysis
Key points:
5. Review the line that reads, Step 2: install Terraform on the Azure Pipelines agent.
The Terraform Build & Release Task extension that you installed earlier has a
command to install Terraform on the agent running the Azure Pipeline. This task is
what is being done in this step.
YAML
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-
tasks-terraform-installer.TerraformInstaller@0
displayName: 'Install Terraform'
inputs:
terraformVersion: $(terraformVersion)
Key points:
The version of Terraform to install is specified via an Azure Pipeline variable
named terraformVersion and defined in the azure-pipeline.yaml file.
6. Review the line that reads, Step 3: run Terraform init to initialize the workspace.
Now that Terraform is installed on the agent, the Terraform directory can be
initialized.
YAML
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-
tasks-terraform-cli.TerraformCLI@0
displayName: 'Run terraform init'
inputs:
command: init
workingDirectory: $(terraformWorkingDirectory)
Key points:
7. Review the line that reads, Step 4: run Terraform validate to validate HCL syntax.
Once the project directory is initialized, terraform validate is run to validate the
configuration on the server.
YAML
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-
tasks-terraform-cli.TerraformCLI@0
displayName: 'Run terraform validate'
inputs:
command: validate
workingDirectory: $(terraformWorkingDirectory)
8. Review the line that reads, Step 5: run Terraform plan to validate HCL syntax. As
explained earlier, generating the execution plan is done to verify if the Terraform
configuration is valid before deployment.
YAML
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-
tasks-terraform-cli.TerraformCLI@0
displayName: 'Run terraform plan'
inputs:
command: plan
workingDirectory: $(terraformWorkingDirectory)
environmentServiceName: $(serviceConnection)
commandOptions: -var location=$(azureLocation)
Key points:
5. In the repositories list, select the fork of the repository you created in your GitHub
organization.
6. In the Configure your pipeline step, choose to start from an existing YAML
pipeline.
7. When the Select existing YAML pipeline page displays, specify the branch master
and enter the path to the YAML pipeline: samples/integration-testing/src/azure-
pipeline.yaml .
Once you've done that step, access the details in Azure DevOps to ensure that
everything ran correctly.
Troubleshoot Terraform on Azure
Troubleshoot common problems when using Terraform on Azure
Next steps
Learn more about using Terraform in Azure
Troubleshoot common problems when
using Terraform on Azure
Article • 09/01/2021
This article lists common problems and possible solutions when using Terraform on
Azure.
Error: Unable to list provider registration status, it is possible that this is due to invalid
credentials or the service principal does not have permission to use the Resource Manager
API, Azure error: resources.ProvidersClient#List: Failure responding to request:
StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403
Code="AuthorizationFailed" Message="The client '00000000-0000-0000-0000-
000000000000' with object id '00000000-0000-0000-0000-000000000000' does not have
authorization to perform action 'Microsoft.Resources/subscriptions/providers/read' over
scope '/subscriptions/00000000-0000-0000-0000-000000000000' or the scope is invalid. If
access was recently granted, please refresh your credentials."
Background: If you're running Terraform commands from the Cloud Shell and
you've defined certain Terraform/Azure environment variables , you can sometimes
see conflicts. The environment variables and the Azure value they represent are listed in
the following table:
Environment variable Azure value
Cause: As of this writing, the Terraform script that runs in Cloud Shell overwrites the
ARM_SUBSCRIPTION_ID and ARM_TENANT_ID environment variables using values from the
current Azure subscription. As a result, if the service principal referenced by the
environment variables doesn't have rights to the current Azure subscription, any
Terraform operations will fail.
Error: Error acquiring the state lock; Error message: 2 errors occurred:
* state blob is already locked
* blob metadata "terraformlockid" was empty
Terraform acquires a state lock to protect the state from being written by multiple users at
the same time. Please resolve the issue above and try again. For most commands, you can
disable locking with the "-lock=false" flag, but this is not recommended.
Background: If you're running Terraform commands against a Terraform state file and
this error is the only message that appears, the following causes might apply. Applies to
local and remote state files.
Cause: There are two potential causes for this error. The first is that a Terraform
command is already running against the state file and it has forced a lock on the file, so
nothing breaks. The second potential cause is that a connection interruption occurred
between the state file and the CLI when commands were running. This interruption most
commonly occurs when you're using remote state files.
Resolution: First, make sure that you aren't already running any commands against the
state file. If you're working with a local state file, check to see whether you have
terminals running any commands. Alternatively, check your deployment pipelines to see
whether something running might be using the state file. If this doesn't resolve the
issue, it's possible that the second cause triggered the error. For a remote state file
stored in an Azure Storage account container, you can locate the file and use the Break
lease button.
If you're using other back ends to store your state file, for recommendations, see the
HashiCorp documentation .
VPN errors
For information about resolving VPN errors, see the article, Troubleshoot a hybrid VPN
connection.
Overview of Azure Export for Terraform
Article • 05/10/2023
Azure Export for Terraform is a tool designed to help reduce friction in translation
between Azure and Terraform concepts.
Benefits
Azure Export for Terraform enables you to:
Simplify migration to Terraform on Azure. Azure Export for Terraform allows you
to migrate Azure resources to Terraform using a single command.
Export user-specified sets of resources to Terraform HCL code and state with a
single command. Azure Export for Terraform enables you to specify a
predetermined scope to export. The scope can be as granular as a single resource.
You can also export a resource group and its nested resources. Finally, you can
export an entire subscription.
Inspect preexisting infrastructure with all exposed properties. Whether learning a
newly released resource or investigating an issue in production, Azure Export for
Terraform supports a read-only export with the option to expose all configurable
resource properties.
Follow plan/apply workflow to integrate non-Terraform infrastructure into
Terraform. Export HCL code, inspect non-Terraform resources and easily integrate
them into your production infrastructure and remote backends.
Installation
The Azure Export for Terraform GitHub page lists releases of the tool with links to
installation for various platforms (Windows MSIs, Homebrew, and Linux installations)
and the source code.
Usage
At its most abstract, Azure Export is called as follows:
Console
Export a To export a single resource, specify the Azure aztfexport resource [option]
single resourceID associated with the resource. <resource id>
resource.
Export The tool supports exporting with an Azure aztfexport query [option]
using a Resource Graph query. <ARG where predicate>
query.
Data-collection disclosure
By default, Azure Export for Terraform collects telemetry data. However, you can easily
disable this process.
If you do want to disable data collection, run the following command after installing the
tool:
Console
Next steps
Concepts:
Azure Export for Terraform concepts: Learn the workflows of Azure Export for Terraform
and its best practices and current design limitations.
Quickstart articles:
Export your first resources using Azure Export for Terraform
Export Azure resources to HCL code using Azure Export for Terraform
How-to articles:
How-to articles explain more complex scenarios along with explanations and options:
Exploring customized resource selection and naming using Azure Export for
Terraform
Using Azure Export for Terraform in advanced scenarios
Quickstart: Export your first resources
using Azure Export for Terraform
Article • 05/10/2023
This article shows how to export Azure resources into local state files using Azure Export
for Terraform.
" Create a test Azure resource group using Azure CLI or Azure PowerShell.
" Create a test Linux virtual machine using Azure CLI or Azure PowerShell.
" Export the state for the resource group and virtual machine from Azure to the local
state file.
" Test that the local state matches the state of the resources in Azure.
Prerequisites
Install and configure Terraform
Install Azure Export for Terraform
Azure CLI
Azure CLI
Azure CLI
az vm create \
--resource-group myResourceGroup \
--name myVM \
--image Debian \
--admin-username azureadmin \
--generate-ssh-keys \
--public-ip-sku Standard
Export an Azure resource
You can run the aztfexport tool in one of two modes: interactive and non-interactive.
For this demo, you use the interactive mode.
Console
4. After the tool initializes, a list of the resources to be exported is displayed. Each
line has an Azure resourceID matched to the corresponding AzureRM resource
type. The list of available commands displays at the bottom of the display. Using
one of the commands, scroll to the bottom and verify that the expected Azure
resources are properly mapped to their respective Terraform resource types.
5. Press w to run the export.
Key points:
7 Note
Running Azure Export for Terraform can take several minutes to complete.
Console
Console
terraform plan
Your infrastructure and its corresponding state have been successfully exported to
Terraform.
Clean up resources
When you no longer need the resources created in this article, do the following steps:
1. Navigate to the directory containing your Terraform files for this article.
Console
terraform destroy
Next steps
Export resources into HCL code using Azure Export for Terraform
Quickstart: Export Azure resources into
HCL code using Azure Export for
Terraform
Article • 05/10/2023
In the article, Export your first resources using Azure Export for Terraform, you learn how
to export Azure resources into local state files using Azure Export for Terraform. In this
article, you learn how to generate the Terraform configuration files from your Azure
resources.
" Create a test Azure resource group using Azure CLI or Azure PowerShell.
" Create a test Linux virtual machine using Azure CLI or Azure PowerShell.
" Export the resource group and virtual machine from Azure to HCL files.
" Test that the local state matches the state of the resources in Azure.
Prerequisites
Install and configure Terraform
Install Azure Export for Terraform
Azure CLI
Azure CLI
Azure CLI
az vm create \
--resource-group myResourceGroup \
--name myVM \
--image Debian \
--admin-username azureadmin \
--generate-ssh-keys \
--public-ip-sku Standard
The --hcl-only flag is supported for all primary export commands used for exporting:
resource
resource-group
query
mapping-file
To view the available Azure Export for Terraform commands, run the following
command:
Console
aztfexport --help
The --hcl-only flag is useful in scenarios where you don't need the state or aren't sure
if you need to generate the state. To export all the generated configuration to state, run
aztfexport mapping-file .
Tip
When using the --hcl-only flag, target an empty directory to avoid making
unwanted changes to any current state during the export stage.
Console
7 Note
Running Azure Export for Terraform can take several minutes to complete.
main.tf contains the HCL code that defines the exported resources.
mapping file includes the following information for each exported Azure resource:
Azure resource ID, Terraform resource type, and Terraform resource name. The
contents of the mapping file mirror what Azure Export for Terraform displays
during the export process.
aztfexportSkippedResources.txt contains the list of skipped resources. You
Clean up resources
When you no longer need the resources created in this article, do the following steps:
1. Navigate to the directory containing your Terraform files for this article.
Console
terraform destroy
Next steps
How Azure Export for Terraform works
Customized resource selection and
naming using Azure Export for
Terraform
Article • 05/10/2023
Azure Export for Terraform provides various options to customize which resources you
export.
In this article, you learn pros and cons for each option.
" Using the UI
" Using Query Mode
" Using a Mapping File
To undo the skip action, verify the skipped resource is selected, and press Delete again.
Pros:
Cons:
Action can be time consuming if you have many resources to scroll through and
skip.
As an example, let's say you have a resource group named myResourceGroup that has
many resources including a network resource. If you want to export only the network
resource, you could use the following syntax:
Console
Pros:
Cons:
Console
Interactive mode: Press s when running interactively in the resource list view.
Non-interactive mode: You can generate the mapping file in all export commands
( resource , resource-group , query , mapping file ) by adding the --generate-
mapping-file flag.
If your use cases require pre-export modifications, you can manually construct or edit
the mapping file. Here are some examples of when you would want to manually edit
your own mapping file:
Use-case Steps
You have many resources in a resource group Delete the JSON objects from your editor of
but only need to export a select few. choice and save the file before exporting.
You want to rename all your resources in a Change the resource-name property to whatever
consistent manner. name matches your company compliance
standards.
You need to refactor a set of resources by Use your editor to find all Microsoft.Network or
their resource type - such as networking or Microsoft.Compute resources.
compute.
For example, let's say you run the following command for a resource group that
contains a virtual machine:
Console
JSON
{
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virt
ualMachines/vm-MyResourceGroup/extensions/OmsAgentForLinux": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virt
ualMachines/vm-MyResourceGroup/extensions/OmsAgentForLinux",
"resource_type": "azurerm_virtual_machine_extension",
"resource_name": "res-0"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup",
"resource_type": "azurerm_resource_group",
"resource_name": "res-1"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/sshP
ublicKeys/vm-MyResourceGroup_key": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/sshP
ublicKeys/vm-MyResourceGroup_key",
"resource_type": "azurerm_ssh_public_key",
"resource_name": "res-2"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virt
ualMachines/vm-MyResourceGroup": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virt
ualMachines/vm-MyResourceGroup",
"resource_type": "azurerm_linux_virtual_machine",
"resource_name": "res-3"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/netw
orkInterfaces/vm-myResourceGroup-vm-d146": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/netw
orkInterfaces/vm-myResourceGroup-vm-d146",
"resource_type": "azurerm_network_interface",
"resource_name": "res-4"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/netw
orkInterfaces/vm-myResourceGroup-vm-
d146/networkSecurityGroups/L3N1YnNjcmlwdGlvbnMvZGJmM2I2Y2ItYzFkMC00ZDA0LTk0Y
jktNTE1MDliOGQzM2ZkL3Jlc291cmNlR3JvdXBzL2hhc2hpY29uZi12bS1kZW1vL3Byb3ZpZGVyc
y9NaWNyb3NvZnQuTmV0d29yay9uZXR3b3JrU2VjdXJpdHlHcm91cHMvdm0taGFzaGljb25mLXZtL
WRlbW8tbnNn": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/netw
orkInterfaces/vm-myResourceGroup-vm-d146|/subscriptions/00000000-0000-0000-
0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/netw
orkSecurityGroups/vm-MyResourceGroup-nsg",
"resource_type":
"azurerm_network_interface_security_group_association",
"resource_name": "res-5"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/netw
orkSecurityGroups/vm-MyResourceGroup-nsg": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/netw
orkSecurityGroups/vm-MyResourceGroup-nsg",
"resource_type": "azurerm_network_security_group",
"resource_name": "res-6"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/publ
icIPAddresses/vm-MyResourceGroup-ip": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/publ
icIPAddresses/vm-MyResourceGroup-ip",
"resource_type": "azurerm_public_ip",
"resource_name": "res-7"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/virt
ualNetworks/MyResourceGroup-vnet": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/virt
ualNetworks/MyResourceGroup-vnet",
"resource_type": "azurerm_virtual_network",
"resource_name": "res-8"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/virt
ualNetworks/MyResourceGroup-vnet/subnets/default": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/virt
ualNetworks/MyResourceGroup-vnet/subnets/default",
"resource_type": "azurerm_subnet",
"resource_name": "res-9"
}
}
Only the object value in the mapping file has significance. The key (defaults to the Azure
resource_id ) is just an identifier in this mode.
Now, let's say we want to keep the resource group and any compute-related resources,
and modify the resource_name value.
JSON
{
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup",
"resource_type": "azurerm_resource_group",
"resource_name": "myResourceGroup"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virt
ualMachines/myVM": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virt
ualMachines/myVM",
"resource_type": "azurerm_linux_virtual_machine",
"resource_name": "myVM"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshP
ublicKeys/myKey": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshP
ublicKeys/myKey",
"resource_type": "azurerm_ssh_public_key",
"resource_name": "myKey"
},
"/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virt
ualMachines/vm-myResourceGroup/extensions/OmsAgentForLinux": {
"resource_id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virt
ualMachines/vm-myResourceGroup/extensions/OmsAgentForLinux",
"resource_type": "azurerm_virtual_machine_extension",
"resource_name": "myVMExtension"
}
}
Once you've edited the mapping file, you export the mapping file using the following
command:
Console
Pros:
Since you're editing a file, you can use an editor to find and replace what you need
to remove or edit.
JSON output enables unique functionality - such as scripting to filter.
Can rename resources to match your naming standards.
Can refactor JSON into multiple mapping files.
Handles large amounts of resources well.
Cons:
Summary
In this article, you learned about the various options to filter resources when exporting
with Azure Export for Terraform.
Next steps
Using Azure Export for Terraform in advanced scenarios
Using Azure Export for Terraform in
advanced scenarios
Article • 05/10/2023
This article explains how to do some of the more advanced tasks with Azure Export for
Terraform.
Console
When the --append flag is specified, Azure Export for Terraform verifies if there's a pre-
existing provider or terraform block in any of the files in the current directory. If not,
the tool creates a file for each block and then proceeds with exporting. If the output
directory has a state file, any exported resources are imported into the state file.
Additionally, the file generated has a .aztfexport suffix before the extension - such as
main.aztfexport.tf - to avoid potential file name conflicts.
) Important
If the specified version of AzureRM doesn't match your installed version when
exporting, the command fails.
Console
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
}
backend "azurerm" {
resource_group_name = "tfstate"
storage_account_name = "storageacc"
container_name = "tfstate"
key = "terraform.tfstate"
}
provider "azurerm" {
features {}
}
terraform {
cloud {
organization = "aztfexport-test"
workspaces {
name = "aztfexport-playground"
}
}
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {
}
}
Inline experience
To export to a backend inline, use the --backend-type and --backend-config options.
For more information about configuring a Terraform backend, see Terraform backend
configuration .
Using our Azure storage account example, you need the following as defined in the
AzureRM backend documentation .
Pass these parameters into the command along with your backend type:
Console
Key points:
In the previous example, I'm using the Unix line continuation character so that the
code displays well in the browser. You might need to change these characters to
match your command-line environment - such as PowerShell - or combine the
command onto one line.
If the backend state already exists, Azure Export for Terraform merges the new
resources with the existing state automatically. You don't need to specify the --
append option inline.
Export Azure resources to an existing Terraform
environment
Now, let's put it all together! Imagine new resources have been created outside of
Terraform that need to be moved into Terraform management. To complete the section,
make sure you have a backend configured. This tutorial uses the same configuration
that is specified in the Azure storage remote state tutorial.
1. In the parent directory of where you want the temporary directory created, run the
following command:
Console
Key points:
2. After inspecting that the resource can be appended, utilize the generated mapping
file and the --append flag to ensure Azure Export respects the pre-existing remote
state and provider versions within our existing environment:
Console
Console
Congratulations! Your infrastructure and its corresponding state have been successfully
appended to your Terraform environment.
If your plan runs into issues, see Azure Export for Terraform concepts to understand
limitations regarding deploying code generated by --hcl-only . If that article doesn't
help you, open a GitHub issue .
Next steps
Azure Export for Terraform concepts
How Azure Export for Terraform Works
Article • 05/10/2023
This article introduces you to the Azure Export for Terraform workflows. In this article,
you learn about the tool's best practice guidance, current limitations, and how to
mitigate those limitations.
Interactive mode
By default, Azure Export for Terraform runs in interactive mode. When you run in
interactive mode, the available keyboard shortcuts are listed at the bottom of the
display.
Task Keyboard
shortcut(s)
Navigation
Filter operations
Save operations
Save a mapping file of the resource list. The output file is affected by s
skipping (but not filtering).
Task Keyboard
shortcut(s)
Export resources to state (if --hcl-only isn't specified) and generates the w
config.
User experience
Display help. ?
Quit
For each resource, Azure Export for Terraform tries to recognize the corresponding
Terraform resource type. If it finds a match, the line is marked with the following
indicator: 💡.
If the resource can't be resolved, you need to input the Terraform resource address in
the following form: <resource type>.<resource name> . For example,
azurerm_linux_virtual_machine.test refers to a Terraform resource type of
azurerm_linux_virtual_machine while the test refers to the name for the virtual
machine used in the configuration files.
To see the available resource type(s) for the selected resource, press r .
In some cases, there are Azure resources that have no corresponding Terraform
resources, such as if the resource lacks Terraform support. Some resources might also be
created as a side effect of provisioning another resource - such as the OS Disk resource
that is created when provisioning a virtual machine. In these cases, you can skip the
resources without assigning anything.
After going through all the resources to be imported, press w to begin generating the
Terraform configuration and (if --hcl-only isn't selected) importing to Terraform state.
Non-interactive mode
By default, Azure Export for Terraform runs in interactive mode. To specify that the tool
should run in non-interactive mode, specify the --non-interactive flag.
Console
aztfexport [command] --non-interactive <scope>
) Important
If the directory in which you're running Azure Export for Terraform isn't empty, you
must add the --overwrite flag to use the --hcl-only flag.
The following subsections provide guidance as to which option to take based on the
scenario.
Managing infrastructure
You may not need to export to state if you haven't verified the configured resources
behave within your environment in the desired manner.
If you're sure you wish to manage the set of resources in Terraform with terraform init
plan apply workflows, exporting to state is essential.
If you aren't sure you want to manage the resources yet, passing the --hcl-only flag is
recommended.
Existing infrastructure
In scenarios where you're exporting to existing Terraform environments, it may be
helpful to think of --hcl-only as a terraform plan equivalent, especially before
appending to existing environments.
The terraform apply command equates to exporting resources - during which their
config ties into the pre-existing state. In this scenario, using a mapping file saves run
time to list and map resources.
Discovering infrastructure
If you aren't sure what resources exist within an environment, you can verify by
specifying the --generate-mapping-file flag. For more information about this subject,
see Exploring customized resource selection and naming using Azure Export for
Terraform.
Limitations
Azure Export for Terraform is a complex tool that attempts to convert Azure
infrastructure into Terraform code and state. Its current known limitations are explained
in the following subsections.
Write-only properties
Certain properties within AzureRM are write-only and aren't included in the generated
code that Azure Export for Terraform creates. The issue is addressed by defining the
property after exporting to HCL code.
Cross-property constraints
The AzureRM provider can set two properties that conflict with each other. When
Azure Export for Terraform reads conflicting properties, it may set both properties to the
same value despite the user only configuring one. Further complications emerge when
multiple cross-property constraints exist within the same generated configuration. You
must know where cross-property conflicts exist within your configuration in order to
mitigate this issue.
Write-only properties
Azure Export can't generate write-only properties (such as passwords) within its config.
You need to know about the write-only properties and define them in a configuration to
create new sets of resources.
Property-defined resources
Certain resources in Azure can be defined as either a property in a parent Terraform
resource or an individual Terraform resource. One example is a subnet. Azure Export for
Terraform defines the resource as an individual resource, but it's best practice to match
your existing coding configuration.
Explicit dependencies
Azure Export for Terraform is currently able to declare only explicit dependencies. You
must know the mapping of the relationships between resources to refactor the code to
include any needed implicit dependencies.
Hardcoded values
Azure Export for Terraform currently generates hard-coded strings. As a best practice,
you should refactor these values to variables. Also, when you use the --full-properties
flag to expose all properties, some sensitive information (such as secrets) can be seen in
the generated config. Use recommended practices to protect the visibility of this code.
Next steps
Export your first resources using Azure Export for Terraform
Quickstart: Create an Azure resource
group using Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This article shows how to create an Azure resource group using Terraform.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
2. Create a file named providers.tf and insert the following code:
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
5. Create a file named outputs.tf and insert the following code:
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
terraform plan -destroy -out main.destroy.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Learn more about using Terraform in Azure
Quickstart: Deploy your first Azure
resource with the AzAPI Terraform
provider
Article • 03/20/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.8
AzureRM Provider v.3.0.2
AzAPI Provider v.0.1.0
In this article, you learn how to use the AzAPI Terraform provider to manage an Azure
service that is not currently supported by the AzureRM provider . The azapi_resource
will be used to manage an Azure Lab Services account as well as a lab.
7 Note
The example code in this article is located in the Azure Terraform GitHub repo .
Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azapi = {
source = "azure/azapi"
version = "=0.1.0"
}
azurerm = {
source = "hashicorp/azurerm"
version = "=3.0.2"
}
}
}
provider "azapi" {
default_location = "eastus"
default_tags = {
team = "Azure deployments"
}
}
provider "azurerm" {
features {}
}
Terraform
Terraform
# Provision a Lab Service Account and a Lab that are in public preview
resource "azapi_resource" "qs101-account" {
type = "Microsoft.LabServices/labaccounts@2018-10-15"
name = "qs101LabAccount"
parent_id = azurerm_resource_group.qs101.id
body = jsonencode({
properties = {
enabledRegionSelection = false
}
})
}
body = jsonencode({
properties = {
maxUsersInLab = 10
userAccessMode = "Restricted"
}
})
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Quickstart: Deploy your first Azure
update resource with the AzAPI
Terraform provider
Article • 07/10/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.8
AzureRM Provider v.3.0.2
AzAPI Provider v.0.1.0
In this article, you learn how to use the AzAPI Terraform provider to manage a new
feature of an Azure service that isn't currently supported by the AzureRM provider .
The azapi_update_resource will be used to manage an Azure EventHub network rule set.
7 Note
The example code in this article is located in the Azure Terraform GitHub repo .
Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azapi = {
source = "azure/azapi"
version = "=0.1.0"
}
azurerm = {
source = "hashicorp/azurerm"
version = "=3.0.2"
}
random = {
source = "hashicorp/random"
version = "=3.1.2"
}
}
}
provider "azapi" {
}
provider "azurerm" {
features {}
}
provider "random" {
}
Terraform
resource "azurerm_resource_group" "qs101" {
name = "rg-qs101-eh-rules"
location = "westus2"
}
service_endpoints = ["Microsoft.EventHub"]
}
Terraform
body = jsonencode({
properties = {
defaultAction = "Deny"
publicNetworkAccess = "Enabled"
virtualNetworkRules = [
{
ignoreMissingVnetServiceEndpoint = false
subnet = {
# API bug, returned id replaced `resourceGroups` with
`resourcegroups`
id = replace(azurerm_subnet.qs101.id, "resourceGroups",
"resourcegroups")
}
}
]
ipRules = [
{
action = "Allow"
ipMask = "1.1.1.1"
}
]
}
})
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Azure CLI
Key points:
The resource group name and Event Hubs namespace name are displayed in
the terraform apply output.
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Learn more about using Terraform in Azure
Quickstart: Create an Azure AI services
resource using Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This article shows how to use Terraform to create an Azure AI services account using
Terraform.
Azure AI services are cloud-based artificial intelligence (AI) services that help developers
build cognitive intelligence into applications without having direct AI or data science
skills or knowledge. They are available through REST APIs and client library SDKs in
popular development languages. Azure AI services enables developers to easily add
cognitive features into their applications with cognitive solutions that can see, hear,
speak, and analyze.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string using random_string
" Create an Azure AI services account using azurerm_cognitive_account
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "azurerm_cognitive_account_name" {
value = azurerm_cognitive_account.cognitive_service.name
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "sku" {
type = string
description = "The sku name of the Azure Analysis Services server to
create. Choose from: B1, B2, D1, S0, S1, S2, S3, S4, S8, S9. Some skus
are region specific. See https://docs.microsoft.com/en-
us/azure/analysis-services/analysis-services-overview#availability-by-
region"
default = "S0"
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
1. Get the Azure resource name in which the Azure AI services account was
created.
Console
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about Azure AI resources
Quickstart: Deploy Azure AI Search
service using Terraform
Article • 02/16/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This article shows how to use Terraform to create an Azure AI Search service using
Terraform.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string using random_string
" Create an Azure AI Search service using azurerm_search_service
Prerequisites
Install and configure Terraform
7 Note
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "azurerm_search_service_name" {
value = azurerm_search_service.search.name
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "sku" {
description = "The pricing tier of the search service you want to
create (for example, basic or standard)."
default = "standard"
type = string
validation {
condition = contains(["free", "basic", "standard", "standard2",
"standard3", "storage_optimized_l1", "storage_optimized_l2"], var.sku)
error_message = "The sku must be one of the following values: free,
basic, standard, standard2, standard3, storage_optimized_l1,
storage_optimized_l2."
}
}
variable "replica_count" {
type = number
description = "Replicas distribute search workloads across the
service. You need at least two replicas to support high availability of
query workloads (not applicable to the free tier)."
default = 1
validation {
condition = var.replica_count >= 1 && var.replica_count <= 12
error_message = "The replica_count must be between 1 and 12."
}
}
variable "partition_count" {
type = number
description = "Partitions allow for scaling of document count as well
as faster indexing by sharding your index over multiple search units."
default = 1
validation {
condition = contains([1, 2, 3, 4, 6, 12], var.partition_count)
error_message = "The partition_count must be one of the following
values: 1, 2, 3, 4, 6, 12."
}
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
3. Run az search service show to show the Azure AI Search service you created in this
article.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Create an Azure AI Search index using the Azure portal
Quickstart: Create an Azure Analysis
Services server using Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This article shows how to use Terraform to create an Azure Analysis Services server.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string for the Azure Analysis Services server name using
random_string
" Create an Azure Analysis Services server using azurerm_analysis_services_server
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
ipv4_firewall_rule {
name = "AllowFromAll"
range_start = "0.0.0.0"
range_end = "255.255.255.255"
}
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "analysis_services_server_name" {
value = azurerm_analysis_services_server.server.name
}
Terraform
terraform {
required_version = ">=0.12"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "sku" {
type = string
description = "The sku name of the Azure Analysis Services server to
create. Choose from: B1, B2, D1, S0, S1, S2, S3, S4, S8, S9. Some skus
are region specific. See https://docs.microsoft.com/en-
us/azure/analysis-services/analysis-services-overview#availability-by-
region"
default = "S0"
}
variable "backup_blob_container_uri" {
type = string
description = "The SAS URI to a private Azure Blob Storage container
with read, write and list permissions. Required only if you intend to
use the backup/restore functionality. See
https://docs.microsoft.com/en-us/azure/analysis-services/analysis-
services-backup"
default = null
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
Azure PowerShell
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Quickstart: Configure server firewall - Portal
Quickstart: Create an Azure Stream
Analytics job using Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This article shows how to create an Azure Stream Analytics job using Terraform. Once
the job is created, you validate the deployment.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the Azure Stream Analytics job name using
random_pet .
" Create an Azure Stream Analytics job using azurerm_stream_analytics_job .
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
transformation_query = <<QUERY
SELECT
*
INTO
[YourOutputAlias]
FROM
[YourInputAlias]
QUERY
Terraform
variable "resource_group_location" {
type = string
description = "Location for the resources."
default = "eastus"
}
variable "number_of_streaming_units" {
type = number
description = "Number of streaming units."
default = 1
validation {
condition = contains([1, 3, 6, 12, 18, 24, 30, 36, 42, 48],
var.number_of_streaming_units)
error_message = "Invalid value for: number_of_streaming_units. The
value should be one of the following: 1, 3, 6, 12, 18, 24, 30, 36, 42,
48."
}
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "stream_analytics_job_name" {
value = azurerm_stream_analytics_job.job.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
terraform plan -destroy -out main.destroy.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Create a dedicated Azure Stream Analytics cluster using Azure portal
Quickstart: Deploy an Azure Kubernetes
Service (AKS) cluster using Terraform
Article • 06/21/2024
Azure Kubernetes Service (AKS) is a managed Kubernetes service that lets you quickly
deploy and manage clusters. In this quickstart, you:
7 Note
To get started with quickly provisioning an AKS cluster, this article includes steps to
deploy a cluster with default settings for evaluation purposes only. Before
deploying a production-ready cluster, we recommend that you familiarize yourself
with our baseline reference architecture to consider how it aligns with your
business requirements.
To learn more about creating a Windows Server node pool, see Create an AKS
cluster that supports Windows Server containers.
7 Note
The Azure Linux node pool is now in general availablility (GA). To learn about the
benefits and deployment steps, see the Introduction to the Azure Linux Container
Host for AKS.
Terraform only supports authenticating to Azure with the Azure CLI. Authenticating
using Azure PowerShell isn't supported. Therefore, while you can use the Azure
PowerShell module when doing your Terraform work, you first need to authenticate to
Azure.
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory you can use to test the sample Terraform code and make it your
current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azapi = {
source = "azure/azapi"
version = "~>1.5"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
time = {
source = "hashicorp/time"
version = "0.9.1"
}
}
}
provider "azurerm" {
features {}
}
Terraform
output "key_data" {
value =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
4. Create a file named main.tf and insert the following code:
Terraform
identity {
type = "SystemAssigned"
}
default_node_pool {
name = "agentpool"
vm_size = "Standard_D2_v2"
node_count = var.node_count
}
linux_profile {
admin_username = var.username
ssh_key {
key_data =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
}
network_profile {
network_plugin = "kubenet"
load_balancer_sku = "standard"
}
}
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "node_count" {
type = number
description = "The initial quantity of nodes for the node pool."
default = 3
}
variable "msi_id" {
type = string
description = "The Managed Service Identity ID. Set this value if
you're running this example using Managed Identity as the
authentication method."
default = null
}
variable "username" {
type = string
description = "The admin username for the new cluster."
default = "azureadmin"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "kubernetes_cluster_name" {
value = azurerm_kubernetes_cluster.k8s.name
}
output "client_certificate" {
value =
azurerm_kubernetes_cluster.k8s.kube_config[0].client_certificate
sensitive = true
}
output "client_key" {
value = azurerm_kubernetes_cluster.k8s.kube_config[0].client_key
sensitive = true
}
output "cluster_ca_certificate" {
value =
azurerm_kubernetes_cluster.k8s.kube_config[0].cluster_ca_certificate
sensitive = true
}
output "cluster_password" {
value = azurerm_kubernetes_cluster.k8s.kube_config[0].password
sensitive = true
}
output "cluster_username" {
value = azurerm_kubernetes_cluster.k8s.kube_config[0].username
sensitive = true
}
output "host" {
value = azurerm_kubernetes_cluster.k8s.kube_config[0].host
sensitive = true
}
output "kube_config" {
value = azurerm_kubernetes_cluster.k8s.kube_config_raw
sensitive = true
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
2. Display the name of your new Kubernetes cluster using the az aks list command.
Azure CLI
az aks list \
--resource-group $resource_group_name \
--query "[].{\"K8s cluster name\":name}" \
--output table
3. Get the Kubernetes configuration from the Terraform state and store it in a file that
kubectl can read using the following command.
Console
4. Verify the previous command didn't add an ASCII EOT character using the
following command.
Console
cat ./azurek8s
Key points:
If you see << EOT at the beginning and EOT at the end, remove these
characters from the file. Otherwise, you may receive the following error
message: error: error loading config file "./azurek8s": yaml: line 2:
mapping values are not allowed in this context
5. Set an environment variable so kubectl can pick up the correct config using the
following command.
Console
export KUBECONFIG=./azurek8s
6. Verify the health of the cluster using the kubectl get nodes command.
Console
Key points:
When you created the AKS cluster, monitoring was enabled to capture health
metrics for both the cluster nodes and pods. These health metrics are available in
the Azure portal. For more information on container health monitoring, see
Monitor Azure Kubernetes Service health.
Several key values classified as output when you applied the Terraform execution
plan. For example, the host address, AKS cluster user name, and AKS cluster
password are output.
Store front: Web application for customers to view products and place orders.
Product service: Shows product information.
Order service: Places orders.
Rabbit MQ: Message queue for an order queue.
7 Note
YAML
apiVersion: apps/v1
kind: Deployment
metadata:
name: rabbitmq
spec:
replicas: 1
selector:
matchLabels:
app: rabbitmq
template:
metadata:
labels:
app: rabbitmq
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: rabbitmq
image: mcr.microsoft.com/mirror/docker/library/rabbitmq:3.10-
management-alpine
ports:
- containerPort: 5672
name: rabbitmq-amqp
- containerPort: 15672
name: rabbitmq-http
env:
- name: RABBITMQ_DEFAULT_USER
value: "username"
- name: RABBITMQ_DEFAULT_PASS
value: "password"
resources:
requests:
cpu: 10m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
volumeMounts:
- name: rabbitmq-enabled-plugins
mountPath: /etc/rabbitmq/enabled_plugins
subPath: enabled_plugins
volumes:
- name: rabbitmq-enabled-plugins
configMap:
name: rabbitmq-enabled-plugins
items:
- key: rabbitmq_enabled_plugins
path: enabled_plugins
---
apiVersion: v1
data:
rabbitmq_enabled_plugins: |
[rabbitmq_management,rabbitmq_prometheus,rabbitmq_amqp1_0].
kind: ConfigMap
metadata:
name: rabbitmq-enabled-plugins
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
spec:
selector:
app: rabbitmq
ports:
- name: rabbitmq-amqp
port: 5672
targetPort: 5672
- name: rabbitmq-http
port: 15672
targetPort: 15672
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: order-service
spec:
replicas: 1
selector:
matchLabels:
app: order-service
template:
metadata:
labels:
app: order-service
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: order-service
image: ghcr.io/azure-samples/aks-store-demo/order-
service:latest
ports:
- containerPort: 3000
env:
- name: ORDER_QUEUE_HOSTNAME
value: "rabbitmq"
- name: ORDER_QUEUE_PORT
value: "5672"
- name: ORDER_QUEUE_USERNAME
value: "username"
- name: ORDER_QUEUE_PASSWORD
value: "password"
- name: ORDER_QUEUE_NAME
value: "orders"
- name: FASTIFY_ADDRESS
value: "0.0.0.0"
resources:
requests:
cpu: 1m
memory: 50Mi
limits:
cpu: 75m
memory: 128Mi
initContainers:
- name: wait-for-rabbitmq
image: busybox
command: ['sh', '-c', 'until nc -zv rabbitmq 5672; do echo
waiting for rabbitmq; sleep 2; done;']
resources:
requests:
cpu: 1m
memory: 50Mi
limits:
cpu: 75m
memory: 128Mi
---
apiVersion: v1
kind: Service
metadata:
name: order-service
spec:
type: ClusterIP
ports:
- name: http
port: 3000
targetPort: 3000
selector:
app: order-service
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: product-service
spec:
replicas: 1
selector:
matchLabels:
app: product-service
template:
metadata:
labels:
app: product-service
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: product-service
image: ghcr.io/azure-samples/aks-store-demo/product-
service:latest
ports:
- containerPort: 3002
resources:
requests:
cpu: 1m
memory: 1Mi
limits:
cpu: 1m
memory: 7Mi
---
apiVersion: v1
kind: Service
metadata:
name: product-service
spec:
type: ClusterIP
ports:
- name: http
port: 3002
targetPort: 3002
selector:
app: product-service
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: store-front
spec:
replicas: 1
selector:
matchLabels:
app: store-front
template:
metadata:
labels:
app: store-front
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: store-front
image: ghcr.io/azure-samples/aks-store-demo/store-front:latest
ports:
- containerPort: 8080
name: store-front
env:
- name: VUE_APP_ORDER_SERVICE_URL
value: "http://order-service:3000/"
- name: VUE_APP_PRODUCT_SERVICE_URL
value: "http://product-service:3002/"
resources:
requests:
cpu: 1m
memory: 200Mi
limits:
cpu: 1000m
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
name: store-front
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: store-front
type: LoadBalancer
For a breakdown of YAML manifest files, see Deployments and YAML manifests.
If you create and save the YAML file locally, then you can upload the manifest file
to your default directory in CloudShell by selecting the Upload/Download files
button and selecting the file from your local file system.
2. Deploy the application using the kubectl apply command and specify the name of
your YAML manifest.
Console
Output
deployment.apps/rabbitmq created
service/rabbitmq created
deployment.apps/order-service created
service/order-service created
deployment.apps/product-service created
service/product-service created
deployment.apps/store-front created
service/store-front created
1. Check the status of the deployed pods using the kubectl get pods command.
Make all pods are Running before proceeding.
Console
2. Check for a public IP address for the store-front application. Monitor progress
using the kubectl get service command with the --watch argument.
Azure CLI
The EXTERNAL-IP output for the store-front service initially shows as pending:
Output
The following example output shows a valid public IP address assigned to the
service:
Output
4. Open a web browser to the external IP address of your service to see the Azure
Store app in action.
Clean up resources
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Azure CLI
Azure CLI
Next steps
In this quickstart, you deployed a Kubernetes cluster and then deployed a simple multi-
container application to it. This sample application is for demo purposes only and
doesn't represent all the best practices for Kubernetes applications. For guidance on
creating full solutions with AKS for production, see AKS solution guidance.
To learn more about AKS and walk through a complete code-to-deployment example,
continue to the Kubernetes cluster tutorial.
) Note: The author created this article with assistance from AI. Learn more
7 Note
Azure Spring Apps is the new name for the Azure Spring Cloud service. Although
the service has a new name, you'll see the old name in some places for a while as
we work to update assets such as screenshots, videos, and diagrams.
This quickstart describes how to use Terraform to deploy an Azure Spring Apps cluster
into an existing virtual network.
Azure Spring Apps makes it easy to deploy Spring applications to Azure without any
code changes. The service manages the infrastructure of Spring applications so
developers can focus on their code. Azure Spring Apps provides lifecycle management
using comprehensive monitoring and diagnostics, configuration management, service
discovery, CI/CD integration, blue-green deployments, and more.
Build Service
Application Configuration Service
Service Registry
Spring Cloud Gateway
API Portal
The API Portal component will be included when it becomes available through the
AzureRM Terraform provider.
For more customization including custom domain support, see the Azure Spring Apps
Terraform provider documentation.
Prerequisites
An Azure subscription. If you don't have a subscription, create a free account
before you begin.
Hashicorp Terraform
Two dedicated subnets for the Azure Spring Apps cluster, one for the service
runtime and another for the Spring applications. For subnet and virtual network
requirements, see the Virtual network requirements section of Deploy Azure Spring
Apps in a virtual network.
An existing Log Analytics workspace for Azure Spring Apps diagnostics settings
and a workspace-based Application Insights resource. For more information, see
Analyze logs and metrics with diagnostics settings and Application Insights Java In-
Process Agent in Azure Spring Apps.
Three internal Classless Inter-Domain Routing (CIDR) ranges (at least /16 each) that
you've identified for use by the Azure Spring Apps cluster. These CIDR ranges
won't be directly routable and will be used only internally by the Azure Spring
Apps cluster. Clusters may not use 169.254.0.0/16, 172.30.0.0/16, 172.31.0.0/16, or
192.0.2.0/24 for the internal Azure Spring Apps CIDR. Clusters also may not use
any IP ranges included within the cluster virtual network address range.
Service permission granted to the virtual network. The Azure Spring Apps Resource
Provider requires Owner permission to your virtual network in order to grant a
dedicated and dynamic service principal on the virtual network for further
deployment and maintenance. For instructions and more information, see the
Grant service permission to the virtual network section of Deploy Azure Spring
Apps in a virtual network.
If you're using Azure Firewall or a Network Virtual Appliance (NVA), you'll also
need to satisfy the following prerequisites:
Network and fully qualified domain name (FQDN) rules. For more information,
see Virtual network requirements.
A unique User Defined Route (UDR) applied to each of the service runtime and
Spring application subnets. For more information about UDRs, see Virtual
network traffic routing. The UDR should be configured with a route for 0.0.0.0/0
with a destination of your NVA before deploying the Azure Spring Apps cluster.
For more information, see the Bring your own route table section of Deploy
Azure Spring Apps in a virtual network.
If you're deploying an Azure Spring Apps Enterprise plan instance for the first time
in the target subscription, see the Requirements section of Enterprise plan in Azure
Marketplace.
Enterprise plan
HashiCorp Configuration Language
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "= 3.21.1"
}
}
}
provider "azurerm" {
features {}
}
depends_on = [azurerm_resource_group.sc_corp_rg]
}
network {
app_subnet_id =
"/subscriptions/${var.subscription}/resourceGroups/${var.azurespringclou
dvnetrg}/providers/Microsoft.Network/virtualNetworks/${var.vnet_spoke_na
me}/subnets/${var.app_subnet_id}"
service_runtime_subnet_id =
"/subscriptions/${var.subscription}/resourceGroups/${var.azurespringclou
dvnetrg}/providers/Microsoft.Network/virtualNetworks/${var.vnet_spoke_na
me}/subnets/${var.service_runtime_subnet_id}"
cidr_ranges = var.sc_cidr
}
timeouts {
create = "60m"
delete = "2h"
}
depends_on = [azurerm_resource_group.sc_corp_rg]
tags = var.tags
log {
category = "ApplicationConsole"
enabled = true
retention_policy {
enabled = false
}
}
metric {
category = "AllMetrics"
retention_policy {
enabled = false
}
}
}
secrets = {
connection-string =
azurerm_application_insights.sc_app_insights.connection_string
}
}
}
# Configuration service
resource "azurerm_spring_cloud_configuration_service" "configservice" {
name = "default"
spring_cloud_service_id = azurerm_spring_cloud_service.sc.id
}
# Gateway
resource "azurerm_spring_cloud_gateway" "scgateway" {
name = "default"
spring_cloud_service_id = azurerm_spring_cloud_service.sc.id
instance_count = 2
}
1. Save the variables.tf file for the Standard plan or the Enterprise plan locally,
then open it in an editor.
Azure CLI
The name of the resource group where the existing virtual network resides.
The name of the existing scope virtual network.
The name of the existing subnet to be used by the Azure Spring Apps
Application Service.
The name of the existing subnet to be used by the Azure Spring Apps
Runtime Service.
The name of the Azure Log Analytics workspace.
Bash
terraform init
Bash
Bash
Clean up resources
If you plan to continue working with subsequent quickstarts and tutorials, you might
want to leave these resources in place. When no longer needed, delete the resources
created in this article by using the following command.
Bash
Next steps
In this quickstart, you deployed an Azure Spring Apps instance into an existing virtual
network using Terraform, and then validated the deployment. To learn more about Azure
Spring Apps, continue on to the resources below.
Deploy one of the following sample applications from the locations below:
Pet Clinic App with MySQL Integration
Simple Hello World
Use custom domains with Azure Spring Apps.
Expose applications in Azure Spring Apps to the internet using Azure Application
Gateway. For more information, see Expose applications with end-to-end TLS in a
virtual network.
View the secure end-to-end Azure Spring Apps reference architecture, which is
based on the Microsoft Azure Well-Architected Framework.
Quickstart: Create an Azure Batch
account using Terraform
Article • 04/14/2023
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
Get started with Azure Batch by using Terraform to create a Batch account, including
storage. You need a Batch account to create compute resources (pools of compute
nodes) and Batch jobs. You can link an Azure Storage account with your Batch account.
This pairing is useful to deploy applications and store input and output data for most
real-world workloads.
After completing this quickstart, you'll understand the key concepts of the Batch service
and be ready to try Batch with more realistic workloads at larger scale.
" Create a random value for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random value using random_string
" Create an Azure Storage account using azurerm_storage_account
" Create an Azure Batch account using azurerm_batch_account
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "storage_account_type" {
type = string
default = "Standard_LRS"
description = "Azure Storage account type."
validation {
condition = contains(["Premium_LRS", "Premium_ZRS",
"Standard_GRS", "Standard_GZRS", "Standard_LRS", "Standard_RAGRS",
"Standard_RAGZRS", "Standard_ZRS"], var.storage_account_type)
error_message = "Invalid storage account type. The value should be
one of the following:
'Premium_LRS','Premium_ZRS','Standard_GRS','Standard_GZRS','Standard_LR
S','Standard_RAGRS','Standard_RAGZRS','Standard_ZRS'."
}
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "batch_name" {
value = azurerm_batch_account.batch.name
}
output "storage_name" {
value = azurerm_storage_account.storage.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
resource_group_name=$(terraform output -raw resource_group_name)
Console
3. Run az batch account show to display information about the new Batch
account.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
2. Run terraform apply to apply the execution plan.
Console
Next steps
Run your first Batch job with the Azure CLI
Quickstart: Use Terraform to create a
Linux VM
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
Article tested with the following Terraform and Terraform provider versions:
This article shows you how to create a complete Linux environment and supporting
resources with Terraform. Those resources include a virtual network, subnet, public IP
address, and more.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a virtual network (VNET) using azurerm_virtual_network .
" Create a subnet using azurerm_subnet .
" Create a public IP using azurerm_public_ip .
" Create a network security group using azurerm_network_security_group .
" Create a network interface using azurerm_network_interface .
" Create an association between the network security group and the network
interface using azurerm_network_interface_security_group_association .
" Generate a random value for a unique storage account name using random_id .
" Create a storage account for boot diagnostics using azurerm_storage_account .
" Create a Linux VM using azurerm_linux_virtual_machine
" Create an AzAPI resource azapi_resource .
" Create an AzAPI resource to generate an SSH key pair using
azapi_resource_action .
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=0.12"
required_providers {
azapi = {
source = "azure/azapi"
version = "~>1.5"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
output "key_data" {
value =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
Terraform
# Create subnet
resource "azurerm_subnet" "my_terraform_subnet" {
name = "mySubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name =
azurerm_virtual_network.my_terraform_network.name
address_prefixes = ["10.0.1.0/24"]
}
security_rule {
name = "SSH"
priority = 1001
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}
ip_configuration {
name = "my_nic_configuration"
subnet_id =
azurerm_subnet.my_terraform_subnet.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id =
azurerm_public_ip.my_terraform_public_ip.id
}
}
byte_length = 8
}
os_disk {
name = "myOsDisk"
caching = "ReadWrite"
storage_account_type = "Premium_LRS"
}
source_image_reference {
publisher = "Canonical"
offer = "0001-com-ubuntu-server-jammy"
sku = "22_04-lts-gen2"
version = "latest"
}
computer_name = "hostname"
admin_username = var.username
admin_ssh_key {
username = var.username
public_key =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.my_storage_account.primary_blob_endpoint
}
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "username" {
type = string
description = "The username for the local account that will be
created on the new VM."
default = "azureadmin"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "public_ip_address" {
value =
azurerm_linux_virtual_machine.my_terraform_vm.public_ip_address
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
terraform init -upgrade
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Cost information isn't presented during the virtual machine creation process for
Terraform like it is for the Azure portal. If you want to learn more about how cost works
for virtual machines, see the Cost optimization Overview page.
Console
2. Run az vm list with a JMESPath query to display the names of the virtual
machines created in the resource group.
Azure CLI
az vm list \
--resource-group $resource_group_name \
--query "[].{\"VM Name\":name}" -o table
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
In this quickstart, you deployed a simple virtual machine using Terraform. To learn more
about Azure virtual machines, continue to the tutorial for Linux VMs.
This article shows you how to create a Linux VM cluster (containing two Linux VM
instances) in Azure using Terraform.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a virtual network using azurerm_virtual_network
" Create a subnet using azurerm_subnet
" Create a public IP using azurerm_public_ip
" Create a load balancer using azurerm_lb
" Create a load balancer address pool using azurerm_lb_backend_address_pool
" Create a network interface using azurerm_network_interface
" Create a managed disk using azurerm_managed_disk
" Create a availability set using azurerm_availability_set
" Create a Linux virtual machine using azurerm_linux_virtual_machine
" Create an AzAPI resource azapi_resource .
" Create an AzAPI resource to generate an SSH key pair using
azapi_resource_action .
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azapi = {
source = "azure/azapi"
version = "~>1.5"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
output "key_data" {
value =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
Terraform
frontend_ip_configuration {
name = "publicIPAddress"
public_ip_address_id = azurerm_public_ip.test.id
}
}
ip_configuration {
name = "testConfiguration"
subnet_id = azurerm_subnet.test.id
private_ip_address_allocation = "Dynamic"
}
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
admin_ssh_key {
username = var.username
public_key =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
name = "myosdisk${count.index}"
}
computer_name = "hostname"
admin_username = var.username
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "username" {
type = string
description = "The username for the local account that will be
created on the new VM."
default = "azureadmin"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "virtual_network_name" {
value = azurerm_virtual_network.test.name
}
output "subnet_name" {
value = azurerm_subnet.test.name
}
output "linux_virtual_machine_names" {
value = [for s in azurerm_linux_virtual_machine.test : s.name[*]]
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Cost information isn't presented during the virtual machine creation process for
Terraform like it is for the Azure portal. If you want to learn more about how cost works
for virtual machines, see the Cost optimization Overview page.
Console
2. Run az vm list with a JMESPath query to display the names of the virtual
machines created in the resource group.
Azure CLI
az vm list \
--resource-group $resource_group_name \
--query "[].{\"VM Name\":name}" -o table
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Azure Linux virtual machine tutorials
Quickstart: Use Terraform to create a
Windows VM
Article • 07/20/2023
This article was partially created with the help of AI. An author reviewed and revised
the content as needed. Read more.
This article shows you how to create a complete Windows environment and supporting
resources with Terraform. Those resources include a virtual network, subnet, public IP
address, and more.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a virtual network (VNET) using azurerm_virtual_network .
" Create a subnet using azurerm_subnet .
" Create a public IP using azurerm_public_ip .
" Create a network security group using azurerm_network_security_group .
" Create a network interface using azurerm_network_interface .
" Create an association between the network security group and the network
interface using azurerm_network_interface_security_group_association .
" Generate a random value for a unique storage account name using random_id .
" Create a storage account for boot diagnostics using azurerm_storage_account .
" Create a Windows VM with an IIS web server using
azurerm_windows_virtual_machine .
" Create a Windows VM extension using azurerm_virtual_machine_extension .
Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
resource "azurerm_resource_group" "rg" {
location = var.resource_group_location
name = "${random_pet.prefix.id}-rg"
}
# Create subnet
resource "azurerm_subnet" "my_terraform_subnet" {
name = "${random_pet.prefix.id}-subnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name =
azurerm_virtual_network.my_terraform_network.name
address_prefixes = ["10.0.1.0/24"]
}
security_rule {
name = "RDP"
priority = 1000
direction = "Inbound"
access = "Allow"
protocol = "*"
source_port_range = "*"
destination_port_range = "3389"
source_address_prefix = "*"
destination_address_prefix = "*"
}
security_rule {
name = "web"
priority = 1001
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "80"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}
ip_configuration {
name = "my_nic_configuration"
subnet_id =
azurerm_subnet.my_terraform_subnet.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id =
azurerm_public_ip.my_terraform_public_ip.id
}
}
os_disk {
name = "myOsDisk"
caching = "ReadWrite"
storage_account_type = "Premium_LRS"
}
source_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2022-datacenter-azure-edition"
version = "latest"
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.my_storage_account.primary_blob_endpoint
}
}
settings = <<SETTINGS
{
"commandToExecute": "powershell -ExecutionPolicy Unrestricted
Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature -
IncludeManagementTools"
}
SETTINGS
}
byte_length = 8
}
Terraform
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "prefix" {
type = string
default = "win-vm-iis"
description = "Prefix of the resource name"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "public_ip_address" {
value = azurerm_windows_virtual_machine.main.public_ip_address
}
output "admin_password" {
sensitive = true
value = azurerm_windows_virtual_machine.main.admin_password
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Verify the results
1. Run the following command to get the VM's public IP address and make note of it:
Azure CLI
2. With IIS installed and port 80 now open on your VM from the Internet, use a web
browser of your choice to view the default IIS welcome page. Use the public IP
address of your VM obtained from the previous command. The following example
shows the default IIS web site:
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
terraform plan -destroy -out main.destroy.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
In this quickstart, you deployed a simple virtual machine using Terraform. To learn more
about Azure virtual machines, continue to the tutorial for Linux VMs.
This article shows you how to create a Windows VM cluster (containing three Windows
VM instances) in Azure using Terraform.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the Windows VM host name random_string .
" Create a random password for the Windows VMs using random_password .
" Create a Windows VM using the compute module .
" Create a virtual network along with subnet using the network module .
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random value so name is unique in your Azure subscription."
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "windows_vm_public_names" {
value = module.windows_server[*].public_ip_dns_name
}
output "vm_public_ip_addresses" {
value = module.windows_server[*].public_ip_address
}
output "vm_private_ip_addresses" {
value = module.windows_server[*].network_interface_private_ip
}
output "vm_hostnames" {
value = module.windows_server[*].vm_names
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Cost information isn't presented during the virtual machine creation process for
Terraform like it is for the Azure portal. If you want to learn more about how cost works
for virtual machines, see the Cost optimization Overview page.
Console
2. Run az vm list with a JMESPath query to display the names of the virtual
machines created in the resource group.
Azure CLI
az vm list \
--resource-group $resource_group_name \
--query "[].{\"VM Name\":name}" -o table
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Azure Kubernetes Service (AKS) is a managed Kubernetes service that lets you quickly
deploy and manage clusters. In this quickstart, you:
7 Note
To get started with quickly provisioning an AKS cluster, this article includes steps to
deploy a cluster with default settings for evaluation purposes only. Before
deploying a production-ready cluster, we recommend that you familiarize yourself
with our baseline reference architecture to consider how it aligns with your
business requirements.
To learn more about creating a Windows Server node pool, see Create an AKS
cluster that supports Windows Server containers.
7 Note
The Azure Linux node pool is now in general availablility (GA). To learn about the
benefits and deployment steps, see the Introduction to the Azure Linux Container
Host for AKS.
Terraform only supports authenticating to Azure with the Azure CLI. Authenticating
using Azure PowerShell isn't supported. Therefore, while you can use the Azure
PowerShell module when doing your Terraform work, you first need to authenticate to
Azure.
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory you can use to test the sample Terraform code and make it your
current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azapi = {
source = "azure/azapi"
version = "~>1.5"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
time = {
source = "hashicorp/time"
version = "0.9.1"
}
}
}
provider "azurerm" {
features {}
}
Terraform
output "key_data" {
value =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
4. Create a file named main.tf and insert the following code:
Terraform
identity {
type = "SystemAssigned"
}
default_node_pool {
name = "agentpool"
vm_size = "Standard_D2_v2"
node_count = var.node_count
}
linux_profile {
admin_username = var.username
ssh_key {
key_data =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
}
network_profile {
network_plugin = "kubenet"
load_balancer_sku = "standard"
}
}
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "node_count" {
type = number
description = "The initial quantity of nodes for the node pool."
default = 3
}
variable "msi_id" {
type = string
description = "The Managed Service Identity ID. Set this value if
you're running this example using Managed Identity as the
authentication method."
default = null
}
variable "username" {
type = string
description = "The admin username for the new cluster."
default = "azureadmin"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "kubernetes_cluster_name" {
value = azurerm_kubernetes_cluster.k8s.name
}
output "client_certificate" {
value =
azurerm_kubernetes_cluster.k8s.kube_config[0].client_certificate
sensitive = true
}
output "client_key" {
value = azurerm_kubernetes_cluster.k8s.kube_config[0].client_key
sensitive = true
}
output "cluster_ca_certificate" {
value =
azurerm_kubernetes_cluster.k8s.kube_config[0].cluster_ca_certificate
sensitive = true
}
output "cluster_password" {
value = azurerm_kubernetes_cluster.k8s.kube_config[0].password
sensitive = true
}
output "cluster_username" {
value = azurerm_kubernetes_cluster.k8s.kube_config[0].username
sensitive = true
}
output "host" {
value = azurerm_kubernetes_cluster.k8s.kube_config[0].host
sensitive = true
}
output "kube_config" {
value = azurerm_kubernetes_cluster.k8s.kube_config_raw
sensitive = true
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
2. Display the name of your new Kubernetes cluster using the az aks list command.
Azure CLI
az aks list \
--resource-group $resource_group_name \
--query "[].{\"K8s cluster name\":name}" \
--output table
3. Get the Kubernetes configuration from the Terraform state and store it in a file that
kubectl can read using the following command.
Console
4. Verify the previous command didn't add an ASCII EOT character using the
following command.
Console
cat ./azurek8s
Key points:
If you see << EOT at the beginning and EOT at the end, remove these
characters from the file. Otherwise, you may receive the following error
message: error: error loading config file "./azurek8s": yaml: line 2:
mapping values are not allowed in this context
5. Set an environment variable so kubectl can pick up the correct config using the
following command.
Console
export KUBECONFIG=./azurek8s
6. Verify the health of the cluster using the kubectl get nodes command.
Console
Key points:
When you created the AKS cluster, monitoring was enabled to capture health
metrics for both the cluster nodes and pods. These health metrics are available in
the Azure portal. For more information on container health monitoring, see
Monitor Azure Kubernetes Service health.
Several key values classified as output when you applied the Terraform execution
plan. For example, the host address, AKS cluster user name, and AKS cluster
password are output.
Store front: Web application for customers to view products and place orders.
Product service: Shows product information.
Order service: Places orders.
Rabbit MQ: Message queue for an order queue.
7 Note
YAML
apiVersion: apps/v1
kind: Deployment
metadata:
name: rabbitmq
spec:
replicas: 1
selector:
matchLabels:
app: rabbitmq
template:
metadata:
labels:
app: rabbitmq
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: rabbitmq
image: mcr.microsoft.com/mirror/docker/library/rabbitmq:3.10-
management-alpine
ports:
- containerPort: 5672
name: rabbitmq-amqp
- containerPort: 15672
name: rabbitmq-http
env:
- name: RABBITMQ_DEFAULT_USER
value: "username"
- name: RABBITMQ_DEFAULT_PASS
value: "password"
resources:
requests:
cpu: 10m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
volumeMounts:
- name: rabbitmq-enabled-plugins
mountPath: /etc/rabbitmq/enabled_plugins
subPath: enabled_plugins
volumes:
- name: rabbitmq-enabled-plugins
configMap:
name: rabbitmq-enabled-plugins
items:
- key: rabbitmq_enabled_plugins
path: enabled_plugins
---
apiVersion: v1
data:
rabbitmq_enabled_plugins: |
[rabbitmq_management,rabbitmq_prometheus,rabbitmq_amqp1_0].
kind: ConfigMap
metadata:
name: rabbitmq-enabled-plugins
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
spec:
selector:
app: rabbitmq
ports:
- name: rabbitmq-amqp
port: 5672
targetPort: 5672
- name: rabbitmq-http
port: 15672
targetPort: 15672
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: order-service
spec:
replicas: 1
selector:
matchLabels:
app: order-service
template:
metadata:
labels:
app: order-service
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: order-service
image: ghcr.io/azure-samples/aks-store-demo/order-
service:latest
ports:
- containerPort: 3000
env:
- name: ORDER_QUEUE_HOSTNAME
value: "rabbitmq"
- name: ORDER_QUEUE_PORT
value: "5672"
- name: ORDER_QUEUE_USERNAME
value: "username"
- name: ORDER_QUEUE_PASSWORD
value: "password"
- name: ORDER_QUEUE_NAME
value: "orders"
- name: FASTIFY_ADDRESS
value: "0.0.0.0"
resources:
requests:
cpu: 1m
memory: 50Mi
limits:
cpu: 75m
memory: 128Mi
initContainers:
- name: wait-for-rabbitmq
image: busybox
command: ['sh', '-c', 'until nc -zv rabbitmq 5672; do echo
waiting for rabbitmq; sleep 2; done;']
resources:
requests:
cpu: 1m
memory: 50Mi
limits:
cpu: 75m
memory: 128Mi
---
apiVersion: v1
kind: Service
metadata:
name: order-service
spec:
type: ClusterIP
ports:
- name: http
port: 3000
targetPort: 3000
selector:
app: order-service
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: product-service
spec:
replicas: 1
selector:
matchLabels:
app: product-service
template:
metadata:
labels:
app: product-service
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: product-service
image: ghcr.io/azure-samples/aks-store-demo/product-
service:latest
ports:
- containerPort: 3002
resources:
requests:
cpu: 1m
memory: 1Mi
limits:
cpu: 1m
memory: 7Mi
---
apiVersion: v1
kind: Service
metadata:
name: product-service
spec:
type: ClusterIP
ports:
- name: http
port: 3002
targetPort: 3002
selector:
app: product-service
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: store-front
spec:
replicas: 1
selector:
matchLabels:
app: store-front
template:
metadata:
labels:
app: store-front
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: store-front
image: ghcr.io/azure-samples/aks-store-demo/store-front:latest
ports:
- containerPort: 8080
name: store-front
env:
- name: VUE_APP_ORDER_SERVICE_URL
value: "http://order-service:3000/"
- name: VUE_APP_PRODUCT_SERVICE_URL
value: "http://product-service:3002/"
resources:
requests:
cpu: 1m
memory: 200Mi
limits:
cpu: 1000m
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
name: store-front
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: store-front
type: LoadBalancer
For a breakdown of YAML manifest files, see Deployments and YAML manifests.
If you create and save the YAML file locally, then you can upload the manifest file
to your default directory in CloudShell by selecting the Upload/Download files
button and selecting the file from your local file system.
2. Deploy the application using the kubectl apply command and specify the name of
your YAML manifest.
Console
Output
deployment.apps/rabbitmq created
service/rabbitmq created
deployment.apps/order-service created
service/order-service created
deployment.apps/product-service created
service/product-service created
deployment.apps/store-front created
service/store-front created
1. Check the status of the deployed pods using the kubectl get pods command.
Make all pods are Running before proceeding.
Console
2. Check for a public IP address for the store-front application. Monitor progress
using the kubectl get service command with the --watch argument.
Azure CLI
The EXTERNAL-IP output for the store-front service initially shows as pending:
Output
The following example output shows a valid public IP address assigned to the
service:
Output
4. Open a web browser to the external IP address of your service to see the Azure
Store app in action.
Clean up resources
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Azure CLI
Azure CLI
Next steps
In this quickstart, you deployed a Kubernetes cluster and then deployed a simple multi-
container application to it. This sample application is for demo purposes only and
doesn't represent all the best practices for Kubernetes applications. For guidance on
creating full solutions with AKS for production, see AKS solution guidance.
To learn more about AKS and walk through a complete code-to-deployment example,
continue to the Kubernetes cluster tutorial.
) Note: The author created this article with assistance from AI. Learn more
This article was partially created with the help of AI. An author reviewed and revised
the content as needed. Read more.
Use Azure Container Instances to run serverless Docker containers in Azure with
simplicity and speed. Deploy an application to a container instance on-demand when
you don't need a full container orchestration platform like Azure Kubernetes Service. In
this article, you use Terraform to deploy an isolated Docker container and make its web
application available with a public IP address.
" Create a random value for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random value for the container name using random_string
" Create an Azure container group using azurerm_container_group
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
container {
name =
"${var.container_name_prefix}-${random_string.container_name.result}"
image = var.image
cpu = var.cpu_cores
memory = var.memory_in_gb
ports {
port = var.port
protocol = "TCP"
}
}
}
Terraform
output "container_ipv4_address" {
value = azurerm_container_group.container.ip_address
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random value so name is unique in your Azure subscription."
}
variable "container_group_name_prefix" {
type = string
description = "Prefix of the container group name that's combined
with a random value so name is unique in your Azure subscription."
default = "acigroup"
}
variable "container_name_prefix" {
type = string
description = "Prefix of the container name that's combined with a
random value so name is unique in your Azure subscription."
default = "aci"
}
variable "image" {
type = string
description = "Container image to deploy. Should be of the form
repoName/imagename:tag for images stored in public Docker Hub, or a
fully qualified URI for other registries. Images from private
registries require additional registry credentials."
default = "mcr.microsoft.com/azuredocs/aci-helloworld"
}
variable "port" {
type = number
description = "Port to open on the container and the public IP
address."
default = 80
}
variable "cpu_cores" {
type = number
description = "The number of CPU cores to allocate to the container."
default = 1
}
variable "memory_in_gb" {
type = number
description = "The amount of memory to allocate to the container in
gigabytes."
default = 2
}
variable "restart_policy" {
type = string
description = "The behavior of Azure runtime if container has
stopped."
default = "Always"
validation {
condition = contains(["Always", "Never", "OnFailure"],
var.restart_policy)
error_message = "The restart_policy must be one of the following:
Always, Never, OnFailure."
}
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
terraform apply main.tfplan
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Tutorial: Create a container image for deployment to Azure Container Instances
Quickstart: Deploy an Azure Cosmos DB
to Azure Container Instances
Article • 10/26/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.2.7
AzureRM Provider v.3.20.0
This article shows how to use Terraform to deploy an Azure Cosmos DB to Azure
Container Instances.
7 Note
The example code in this article is located in the Microsoft Terraform GitHub
repo .
Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
consistency_policy {
consistency_level = "BoundedStaleness"
max_interval_in_seconds = 10
max_staleness_prefix = 200
}
geo_location {
location = azurerm_resource_group.rg.location
failover_priority = 0
}
}
Terraform
container {
name = "vote-aci"
image = "mcr.microsoft.com/azuredocs/azure-vote-front:cosmosdb"
cpu = "0.5"
memory = "1.5"
ports {
port = 80
protocol = "TCP"
}
secure_environment_variables = {
"COSMOS_DB_ENDPOINT" =
azurerm_cosmosdb_account.vote_cosmos_db.endpoint
"COSMOS_DB_MASTERKEY" =
azurerm_cosmosdb_account.vote_cosmos_db.primary_key
"TITLE" = "Azure Voting App"
"VOTE1VALUE" = "Cats"
"VOTE2VALUE" = "Dogs"
}
}
}
Terraform
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "prefix" {
type = string
default = "cosmos-db-aci"
description = "Prefix of the resource name"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "cosmosdb_account_name" {
value = azurerm_cosmosdb_account.vote_cosmos_db.name
}
output "dns" {
value = azurerm_container_group.main.fqdn
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Verify the results
1. Get the resource group name.
Console
Console
Azure CLI
Test application
1. Get the Azure Cosmos DB account name.
Console
2. Browse to the URL indicated in the previous step. You should see results similar to
the following output:
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Quickstart: Deploy an Azure Cosmos DB
to Azure Container Instances
Article • 10/26/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.2.7
AzureRM Provider v.3.20.0
This article shows how to use Terraform to deploy an Azure Cosmos DB to Azure
Container Instances.
7 Note
The example code in this article is located in the Microsoft Terraform GitHub
repo .
Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
consistency_policy {
consistency_level = "BoundedStaleness"
max_interval_in_seconds = 10
max_staleness_prefix = 200
}
geo_location {
location = azurerm_resource_group.rg.location
failover_priority = 0
}
}
Terraform
container {
name = "vote-aci"
image = "mcr.microsoft.com/azuredocs/azure-vote-front:cosmosdb"
cpu = "0.5"
memory = "1.5"
ports {
port = 80
protocol = "TCP"
}
secure_environment_variables = {
"COSMOS_DB_ENDPOINT" =
azurerm_cosmosdb_account.vote_cosmos_db.endpoint
"COSMOS_DB_MASTERKEY" =
azurerm_cosmosdb_account.vote_cosmos_db.primary_key
"TITLE" = "Azure Voting App"
"VOTE1VALUE" = "Cats"
"VOTE2VALUE" = "Dogs"
}
}
}
Terraform
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "prefix" {
type = string
default = "cosmos-db-aci"
description = "Prefix of the resource name"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "cosmosdb_account_name" {
value = azurerm_cosmosdb_account.vote_cosmos_db.name
}
output "dns" {
value = azurerm_container_group.main.fqdn
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Verify the results
1. Get the resource group name.
Console
Console
Azure CLI
Test application
1. Get the Azure Cosmos DB account name.
Console
2. Browse to the URL indicated in the previous step. You should see results similar to
the following output:
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Quickstart: Create an Azure SQL
Database server and database using
Terraform
Article • 03/07/2024
Creating a single database is the quickest and simplest option to create a database in
Azure SQL Database. This quickstart shows you how to create a single database using
Terraform.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the logical server in Azure using random_pet .
" Create a random password for the logical server in Azure using
random_password .
" Create a logical server in Azure using azurerm_mssql_server .
" Create a database in Azure SQL Database using azurerm_mssql_database .
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
locals {
admin_password = try(random_password.admin_password[0].result,
var.admin_password)
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "sql_db_name" {
type = string
description = "The name of the SQL Database."
default = "SampleDB"
}
variable "admin_username" {
type = string
description = "The administrator username of the SQL logical server."
default = "azureadmin"
}
variable "admin_password" {
type = string
description = "The administrator password of the SQL logical server."
sensitive = true
default = null
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "sql_server_name" {
value = azurerm_mssql_server.server.name
}
output "admin_password" {
sensitive = true
value = local.admin_password
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
terraform plan -out main.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
3. Run az sql db list to display the names of all the databases in your server.
Azure CLI
az sql db list \
--resource-group $resource_group_name \
--server $sql_server_name \
--output table
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Create a server-level firewall rule
) Note: The author created this article with assistance from AI. Learn more
Feedback
Was this page helpful? Yes No
This quickstart was tested by using the following Terraform and Terraform provider
versions:
Terraform v1.2.7
AzureRM Provider v.3.20.0
Azure Database for MySQL - Flexible Server is a managed service that you use to run,
manage, and scale highly available MySQL databases in the cloud. You can use an Azure
Resource Manager template (ARM template) to provision Azure Database for MySQL -
Flexible Server to deploy multiple servers or to deploy multiple databases on a server.
This article shows you how to use Terraform to deploy an instance of Azure Database for
MySQL - Flexible Server and a database in a virtual network.
7 Note
The example code that appears in this article is located in the Azure Terraform
GitHub repo .
Prerequisites
If you don't have an Azure subscription, create an Azure free account before you
begin. Currently, with an Azure free account, you can try Azure Database for
MySQL - Flexible Server free for 12 months. For more information, see Try Azure
Database for MySQL - Flexible Server for free.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
delegation {
name = "fs"
service_delegation {
name = "Microsoft.DBforMySQL/flexibleServers"
actions = [
"Microsoft.Network/virtualNetworks/subnets/join/action",
]
}
}
}
# Enables you to manage Private DNS zones within Azure DNS
resource "azurerm_private_dns_zone" "default" {
name =
"${random_string.name.result}.mysql.database.azure.com"
resource_group_name = azurerm_resource_group.rg.name
}
depends_on = [azurerm_subnet.default]
}
high_availability {
mode = "SameZone"
}
maintenance_window {
day_of_week = 0
start_hour = 8
start_minute = 0
}
storage {
iops = 360
size_gb = 20
}
depends_on = [azurerm_private_dns_zone_virtual_network_link.default]
}
Terraform
# Manages the MySQL Flexible Server Database
resource "azurerm_mysql_flexible_database" "main" {
charset = "utf8mb4"
collation = "utf8mb4_unicode_ci"
name = "mysqlfsdb_${random_string.name.result}"
resource_group_name = azurerm_resource_group.rg.name
server_name = azurerm_mysql_flexible_server.default.name
}
Terraform
variable "resource_group_location" {
type = string
default = "westeurope"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
type = string
default = "mysql-fs-db-rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
Terraform
output "azurerm_mysql_flexible_server" {
value = azurerm_mysql_flexible_server.default.name
}
output "admin_login" {
value = azurerm_mysql_flexible_server.default.administrator_login
}
output "admin_password" {
sensitive = true
value =
azurerm_mysql_flexible_server.default.administrator_password
}
output "mysql_flexible_server_database_name" {
value = azurerm_mysql_flexible_database.main.name
}
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
terraform apply main.tfplan
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
To display the Azure Database for MySQL - Flexible Server database, run az mysql
flexible-server db show:
Azure CLI
output. You can also run the terraform output command to view these
values.
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
terraform plan -destroy -out main.destroy.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next step
Connect to an instance of Azure Database for MySQL - Flexible Server by using
private access
Feedback
Was this page helpful? Yes No
This article shows how to use Terraform to create a Windows Server 2019 Datacenter
virtual machine in a lab within Azure DevTest Labs using Terraform.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random password using random_password
" Create a lab within Azure DevTest Labs using azurerm_dev_test_lab
" Create a virtual network within Azure DevTest Labs using
azurerm_dev_test_virtual_network
" Create a Windows virtual machine within Azure DevTest Labs using
azurerm_dev_test_windows_virtual_machine
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
locals {
password = try(random_password.password[0].result, var.password)
}
gallery_image_reference {
offer = "WindowsServer"
publisher = "MicrosoftWindowsServer"
sku = "2019-Datacenter"
version = "latest"
}
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "lab_name" {
value = azurerm_dev_test_lab.lab.name
}
output "vm_name" {
value = azurerm_dev_test_windows_virtual_machine.vm.name
}
output "password" {
sensitive = true
value = local.password
}
Terraform
terraform {
required_version = ">=0.12"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "lab_name" {
type = string
description = "The name of the new lab instance to be created"
default = "ExampleLab"
}
variable "vm_size" {
type = string
description = "The size of the vm to be created."
default = "Standard_D4_v3"
}
variable "user_name" {
type = string
description = "The username for the local account that will be
created on the new vm."
default = "exampleuser"
}
variable "password" {
type = string
description = "The password for the local account that will be
created on the new vm."
sensitive = true
default = null
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
3. Run az lab vm list to list the virtual machines for the lab you created in this article.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Tutorial: Work with lab VMs
Feedback
Was this page helpful? Yes No
This article shows how to use Terraform to create a Windows Server 2019 Datacenter
virtual machine in a lab within Azure DevTest Labs using Terraform.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random password using random_password
" Create a lab within Azure DevTest Labs using azurerm_dev_test_lab
" Create a virtual network within Azure DevTest Labs using
azurerm_dev_test_virtual_network
" Create a Windows virtual machine within Azure DevTest Labs using
azurerm_dev_test_windows_virtual_machine
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
locals {
password = try(random_password.password[0].result, var.password)
}
gallery_image_reference {
offer = "WindowsServer"
publisher = "MicrosoftWindowsServer"
sku = "2019-Datacenter"
version = "latest"
}
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "lab_name" {
value = azurerm_dev_test_lab.lab.name
}
output "vm_name" {
value = azurerm_dev_test_windows_virtual_machine.vm.name
}
output "password" {
sensitive = true
value = local.password
}
Terraform
terraform {
required_version = ">=0.12"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "lab_name" {
type = string
description = "The name of the new lab instance to be created"
default = "ExampleLab"
}
variable "vm_size" {
type = string
description = "The size of the vm to be created."
default = "Standard_D4_v3"
}
variable "user_name" {
type = string
description = "The username for the local account that will be
created on the new vm."
default = "exampleuser"
}
variable "password" {
type = string
description = "The password for the local account that will be
created on the new vm."
sensitive = true
default = null
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
3. Run az lab vm list to list the virtual machines for the lab you created in this article.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Tutorial: Work with lab VMs
Feedback
Was this page helpful? Yes No
This article shows how to use Terraform to create an API Management instance on
Azure. You can also use Terraform for common management tasks such as importing
APIs in your API Management instance.
Azure API Management helps organizations publish APIs to external, partner, and
internal developers to unlock the potential of their data and services. API Management
provides the core competencies to ensure a successful API program through developer
engagement, business insights, analytics, security, and protection. With API
Management, create and manage modern API gateways for existing backend services
hosted anywhere.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string for the Azure API Management service name using
random_string
" Create an Azure API Management service using azurerm_api_management
Prerequisites
If you don't have an Azure subscription, create a free account before you begin.
If you prefer to run CLI reference commands locally, install the Azure CLI. If
you're running on Windows or macOS, consider running Azure CLI in a Docker
container. For more information, see How to run the Azure CLI in a Docker
container.
If you're using a local installation, sign in to the Azure CLI by using the az
login command. To finish the authentication process, follow the steps
displayed in your terminal. For other sign-in options, see Sign in with the
Azure CLI.
When you're prompted, install the Azure CLI extension on first use. For more
information about extensions, see Use extensions with the Azure CLI.
Run az version to find the version and dependent libraries that are installed.
To upgrade to the latest version, run az upgrade.
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
2. Create a file named main.tf and insert the following code:
Terraform
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "api_management_service_name" {
value = azurerm_api_management.api.name
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "publisher_email" {
default = "[email protected]"
description = "The email address of the owner of the service"
type = string
validation {
condition = length(var.publisher_email) > 0
error_message = "The publisher_email must contain at least one
character."
}
}
variable "publisher_name" {
default = "publisher"
description = "The name of the owner of the service"
type = string
validation {
condition = length(var.publisher_name) > 0
error_message = "The publisher_name must contain at least one
character."
}
}
variable "sku" {
description = "The pricing tier of this API Management service"
default = "Developer"
type = string
validation {
condition = contains(["Developer", "Standard", "Premium"],
var.sku)
error_message = "The sku must be one of the following: Developer,
Standard, Premium."
}
}
variable "sku_count" {
description = "The instance size of this API Management service."
default = 1
type = number
validation {
condition = contains([1, 2], var.sku_count)
error_message = "The sku_count must be one of the following: 1, 2."
}
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
api_management_service_name=$(terraform output -raw
api_management_service_name)
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
) Note: The author created this article with assistance from AI. Learn more
Feedback
Was this page helpful? Yes No
This article shows how to use Terraform to create an API Management instance on
Azure. You can also use Terraform for common management tasks such as importing
APIs in your API Management instance.
Azure API Management helps organizations publish APIs to external, partner, and
internal developers to unlock the potential of their data and services. API Management
provides the core competencies to ensure a successful API program through developer
engagement, business insights, analytics, security, and protection. With API
Management, create and manage modern API gateways for existing backend services
hosted anywhere.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string for the Azure API Management service name using
random_string
" Create an Azure API Management service using azurerm_api_management
Prerequisites
If you don't have an Azure subscription, create a free account before you begin.
If you prefer to run CLI reference commands locally, install the Azure CLI. If
you're running on Windows or macOS, consider running Azure CLI in a Docker
container. For more information, see How to run the Azure CLI in a Docker
container.
If you're using a local installation, sign in to the Azure CLI by using the az
login command. To finish the authentication process, follow the steps
displayed in your terminal. For other sign-in options, see Sign in with the
Azure CLI.
When you're prompted, install the Azure CLI extension on first use. For more
information about extensions, see Use extensions with the Azure CLI.
Run az version to find the version and dependent libraries that are installed.
To upgrade to the latest version, run az upgrade.
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
2. Create a file named main.tf and insert the following code:
Terraform
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "api_management_service_name" {
value = azurerm_api_management.api.name
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "publisher_email" {
default = "[email protected]"
description = "The email address of the owner of the service"
type = string
validation {
condition = length(var.publisher_email) > 0
error_message = "The publisher_email must contain at least one
character."
}
}
variable "publisher_name" {
default = "publisher"
description = "The name of the owner of the service"
type = string
validation {
condition = length(var.publisher_name) > 0
error_message = "The publisher_name must contain at least one
character."
}
}
variable "sku" {
description = "The pricing tier of this API Management service"
default = "Developer"
type = string
validation {
condition = contains(["Developer", "Standard", "Premium"],
var.sku)
error_message = "The sku must be one of the following: Developer,
Standard, Premium."
}
}
variable "sku_count" {
description = "The instance size of this API Management service."
default = 1
type = number
validation {
condition = contains([1, 2], var.sku_count)
error_message = "The sku_count must be one of the following: 1, 2."
}
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
api_management_service_name=$(terraform output -raw
api_management_service_name)
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
) Note: The author created this article with assistance from AI. Learn more
Feedback
Was this page helpful? Yes No
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.2.7
AzureRM Provider v.3.20.0
This article shows how to use Terraform to deploy an Azure Cosmos DB to Azure
Container Instances.
7 Note
The example code in this article is located in the Microsoft Terraform GitHub
repo .
Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
consistency_policy {
consistency_level = "BoundedStaleness"
max_interval_in_seconds = 10
max_staleness_prefix = 200
}
geo_location {
location = azurerm_resource_group.rg.location
failover_priority = 0
}
}
Terraform
container {
name = "vote-aci"
image = "mcr.microsoft.com/azuredocs/azure-vote-front:cosmosdb"
cpu = "0.5"
memory = "1.5"
ports {
port = 80
protocol = "TCP"
}
secure_environment_variables = {
"COSMOS_DB_ENDPOINT" =
azurerm_cosmosdb_account.vote_cosmos_db.endpoint
"COSMOS_DB_MASTERKEY" =
azurerm_cosmosdb_account.vote_cosmos_db.primary_key
"TITLE" = "Azure Voting App"
"VOTE1VALUE" = "Cats"
"VOTE2VALUE" = "Dogs"
}
}
}
Terraform
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "prefix" {
type = string
default = "cosmos-db-aci"
description = "Prefix of the resource name"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "cosmosdb_account_name" {
value = azurerm_cosmosdb_account.vote_cosmos_db.name
}
output "dns" {
value = azurerm_container_group.main.fqdn
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Verify the results
1. Get the resource group name.
Console
Console
Azure CLI
Test application
1. Get the Azure Cosmos DB account name.
Console
2. Browse to the URL indicated in the previous step. You should see results similar to
the following output:
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Quickstart: Create an Azure Stream
Analytics job using Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This article shows how to create an Azure Stream Analytics job using Terraform. Once
the job is created, you validate the deployment.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the Azure Stream Analytics job name using
random_pet .
" Create an Azure Stream Analytics job using azurerm_stream_analytics_job .
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
transformation_query = <<QUERY
SELECT
*
INTO
[YourOutputAlias]
FROM
[YourInputAlias]
QUERY
Terraform
variable "resource_group_location" {
type = string
description = "Location for the resources."
default = "eastus"
}
variable "number_of_streaming_units" {
type = number
description = "Number of streaming units."
default = 1
validation {
condition = contains([1, 3, 6, 12, 18, 24, 30, 36, 42, 48],
var.number_of_streaming_units)
error_message = "Invalid value for: number_of_streaming_units. The
value should be one of the following: 1, 3, 6, 12, 18, 24, 30, 36, 42,
48."
}
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "stream_analytics_job_name" {
value = azurerm_stream_analytics_job.job.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
terraform plan -destroy -out main.destroy.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Create a dedicated Azure Stream Analytics cluster using Azure portal
Quickstart: Use Terraform to create an
Azure IoT Device Provisioning Service
Article • 12/07/2022
In this quickstart, you will learn how to deploy an Azure IoT Hub Device Provisioning
Service (DPS) resource with a hashed allocation policy using Terraform.
This quickstart was tested with the following Terraform and Terraform provider versions:
Terraform v1.2.8
AzureRM Provider v.3.20.0
Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
7 Note
The example code in this article is located in the Azure Terraform GitHub repo .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
resource "azurerm_eventhub_authorization_rule"
"my_terraform_authorization_rule" {
resource_group_name = azurerm_resource_group.rg.name
namespace_name = azurerm_eventhub_namespace.namespace.name
eventhub_name = azurerm_eventhub.my_terraform_eventhub.name
name = "acctest"
send = true
}
endpoint {
type = "AzureIotHub.StorageContainer"
connection_string =
azurerm_storage_account.sa.primary_blob_connection_string
name = "export"
batch_frequency_in_seconds = 60
max_chunk_size_in_bytes = 10485760
container_name =
azurerm_storage_container.my_terraform_container.name
encoding = "Avro"
file_name_format = "
{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}"
}
endpoint {
type = "AzureIotHub.EventHub"
connection_string =
azurerm_eventhub_authorization_rule.my_terraform_authorization_rule.pri
mary_connection_string
name = "export2"
}
route {
name = "export"
source = "DeviceMessages"
condition = "true"
endpoint_names = ["export"]
enabled = true
}
route {
name = "export2"
source = "DeviceMessages"
condition = "true"
endpoint_names = ["export2"]
enabled = true
}
enrichment {
key = "tenant"
value = "$twin.tags.Tenant"
endpoint_names = ["export", "export2"]
}
cloud_to_device {
max_delivery_count = 30
default_ttl = "PT1H"
feedback {
time_to_live = "PT1H10M"
max_delivery_count = 15
lock_duration = "PT30S"
}
}
tags = {
purpose = "testing"
}
}
registry_read = true
registry_write = true
service_connect = true
}
sku {
name = "S1"
capacity = 1
}
linked_hub {
connection_string =
azurerm_iothub_shared_access_policy.hub_access_policy.primary_connectio
n_string
location = azurerm_resource_group.rg.location
allocation_weight = 150
apply_allocation_policy = true
}
}
Terraform
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "eventhub_namespace_name_prefix" {
default = "namespace"
description = "Prefix of the event hub namespace name that's combined
with a random ID so name is unique in your Azure subscription."
}
variable "iothub_name_prefix" {
default = "iothub"
description = "Prefix of the iot hub name that's combined with a
random ID so name is unique in your Azure subscription."
}
variable "dps_name_prefix" {
default = "dps"
description = "Prefix of the dps name that's combined with a random
ID so name is unique in your Azure subscription."
}
Terraform
output "azurerm_iothub_name" {
value = azurerm_iothub.iothub.name
}
output "azurerm_iothub_dps_name" {
value = azurerm_iothub_dps.dps.name
}
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Azure CLI
Key points:
The names of the resource group and the DPS instance display in the
terraform apply output. You can also run terraform output to view these
output values.
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
In this quickstart, you deployed an IoT hub and a Device Provisioning Service instance,
and linked the two resources. To learn how to use this setup to provision a device,
continue to the quickstart for creating a device.
This article uses Terraform to create an Azure Notification Hubs namespace and a
notification hub. The name of each resource is randomly generated to avoid naming
conflicts.
Azure Notification Hubs provides an easy-to-use and scaled-out push engine that
enables you to send notifications to any platform (iOS, Android, Windows, Kindle, etc.)
from any backend (cloud or on-premises). For more information about the service, see
What is Azure Notification Hubs.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the Azure Notification Hub namespace name using
random_string .
" Create an Azure Notification Hub namespace using
azurerm_notification_hub_namespace .
" Create a random value for the Azure Notification Hub name using random_string .
" Create an Azure Notification Hub using azurerm_notification_hub .
Prerequisites
Install and configure Terraform
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random value so name is unique in your Azure subscription."
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "notification_hub_namespace_name" {
value = azurerm_notification_hub_namespace.namespace.name
}
output "notification_hub__name" {
value = azurerm_notification_hub.hub.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
3. Run az notification-hub list to display the hubs for the specified namespace.
Azure CLI
az notification-hub list \
--resource-group $resource_group_name \
--namespace-name $notification_hub_namespace_name
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Set up push notifications in Azure Notification Hubs
Quickstart: Create a policy assignment
to identify non-compliant resources
using Terraform
Article • 07/09/2024
The first step in understanding compliance in Azure is to identify the status of your
resources. This quickstart steps you through the process of creating a policy assignment
to identify virtual machines that aren't using managed disks.
At the end of this process, you identify virtual machines that aren't using managed disks
across subscription. They're non-compliant with the policy assignment.
Prerequisites
If you don't have an Azure subscription, create a free account before you begin.
Terraform version 0.12.0 or higher configured in your environment. For
instructions, see Configure Terraform using Azure Cloud Shell.
This quickstart requires that you run Azure CLI version 2.13.0 or later. To find the
version, run az --version . If you need to install or upgrade, see Install Azure CLI.
Configure the Terraform configuration, variable, and output files. The Terraform
resources for Azure Policy use the Azure Provider .
1. Create a new folder named policy-assignment and change directories into it.
Terraform
provider "azurerm" {
features {}
}
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 2.96.0"
}
}
}
Terraform
variable "cust_scope" {
default = "{scope}"
}
Subscription: /subscriptions/{subscriptionId}
Resource group:
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}
Resource:
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/provi
ders/{resourceProviderNamespace}/[{parentResourcePath}/]
Terraform
output "assignment_id" {
value = azurerm_subscription_policy_assignment.auditvms.id
}
1. Run the terraform init command. This command downloads the Azure modules
required to create the Azure resources in the Terraform configuration.
Bash
terraform init
2. Authenticate with Azure CLI for Terraform. For more information, see Azure
Provider: Authenticating using the Azure CLI .
Azure CLI
az login
3. Create the execution plan with the terraform plan command and out parameter.
Bash
7 Note
For information about persisting execution plans and security, see Terraform
Plan: Security Warning .
Run the terraform apply command and specify the assignment.tfplan already
created.
Bash
Console
armclient post
"/subscriptions/<subscriptionID>/providers/Microsoft.PolicyInsights/policySt
ates/latest/queryResults?api-version=2019-10-01&$filter=IsCompliant eq false
and PolicyAssignmentId eq
'<policyAssignmentID>'&$apply=groupby((ResourceId))" > <json file to direct
the output with the resource IDs into>
JSON
{
"@odata.context":
"https://management.azure.com/subscriptions/<subscriptionId>/providers/Micro
soft.PolicyInsights/policyStates/$metadata#latest",
"@odata.count": 3,
"value": [
{
"@odata.id": null,
"@odata.context":
"https://management.azure.com/subscriptions/<subscriptionId>/providers/Micro
soft.PolicyInsights/policyStates/$metadata#latest/$entity",
"ResourceId":
"/subscriptions/<subscriptionId>/resourcegroups/<rgname>/providers/microsoft
.compute/virtualmachines/<virtualmachineId>"
},
{
"@odata.id": null,
"@odata.context":
"https://management.azure.com/subscriptions/<subscriptionId>/providers/Micro
soft.PolicyInsights/policyStates/$metadata#latest/$entity",
"ResourceId":
"/subscriptions/<subscriptionId>/resourcegroups/<rgname>/providers/microsoft
.compute/virtualmachines/<virtualmachine2Id>"
},
{
"@odata.id": null,
"@odata.context":
"https://management.azure.com/subscriptions/<subscriptionId>/providers/Micro
soft.PolicyInsights/policyStates/$metadata#latest/$entity",
"ResourceId":
"/subscriptions/<subscriptionName>/resourcegroups/<rgname>/providers/microso
ft.compute/virtualmachines/<virtualmachine3ID>"
}
]
}
The results are comparable to what you'd typically see listed under Non-compliant
resources in the Azure portal view.
Clean up resources
To remove the assignment created, use Azure CLI or reverse the Terraform execution
plan with terraform destroy .
Azure CLI
Azure CLI
Terraform
Bash
terraform destroy
Next steps
In this quickstart, you assigned a policy definition to identify non-compliant resources in
your Azure environment.
To learn more about assigning policies to validate that new resources are compliant,
continue to the tutorial for:
Feedback
Was this page helpful? Yes No
This quickstart describes how to use Terraform to create a Traffic Manager profile with
external endpoints using the performance routing method.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the Azure Traffic Manager profile name using
random_string .
" Create a random value for the Azure Traffic Manager profile DNS config relative
name using random_string .
" Create an Azure Traffic Manager profile using azurerm_traffic_manager_profile .
" Create two Azure Traffic Manager external endpoint using
azurerm_traffic_manager_external_endpoint .
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
resource "random_string"
"azurerm_traffic_manager_profile_dns_config_relative_name" {
length = 10
upper = false
numeric = false
special = false
}
monitor_config {
protocol = "HTTPS"
port = 443
path = "/"
expected_status_code_ranges = ["200-202", "301-302"]
}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "azurerm_traffic_manager_profile_name" {
value = azurerm_traffic_manager_profile.profile.name
}
output "azurerm_traffic_manager_profile_fqdn" {
value = azurerm_traffic_manager_profile.profile.fqdn
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
traffic_manager_profile_name=$(terraform output -raw
azurerm_traffic_manager_profile_name)
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Improve website response with Azure Traffic Manager
Quickstart: Create an Azure CDN profile
and endpoint using Terraform
Article • 03/21/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This article shows how to use Terraform to create an Azure CDN profile and endpoint
using Terraform.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string for the CDN endpoint name using random_string
" Create an Azure CDN profile using azurerm_cdn_profile
" Create an Azure CDN endpoint using azurerm_cdn_endpoint
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
origin {
name = "origin1"
host_name = var.origin_url
}
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "cdn_profile_name" {
value = azurerm_cdn_profile.profile.name
}
output "cdn_endpoint_endpoint_name" {
value = azurerm_cdn_endpoint.endpoint.name
}
output "cdn_endpoint_fqdn" {
value = azurerm_cdn_endpoint.endpoint.fqdn
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "origin_url" {
type = string
description = "Url of the origin."
default = "www.contoso.com"
}
variable "cdn_sku" {
type = string
description = "CDN SKU names."
default = "Standard_Microsoft"
validation {
condition = contains(["Standard_Akamai", "Standard_Microsoft",
"Standard_Verizon", "Premium_Verizon"], var.cdn_sku)
error_message = "The cdn_sku must be one of the following:
Standard_Akamai, Standard_Microsoft, Standard_Verizon,
Premium_Verizon."
}
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
1. Get the Azure resource group name in which the Azure CDN profile and
endpoint were created.
Console
Console
cdn_profile_name=$(terraform output -raw cdn_profile_name)
Console
4. Run az cdn custom-domain show to show details of the custom domain you
created in this article.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Next steps
Tutorial: Use CDN to serve static content from a web app
Quickstart: Create an Azure API
Management instance using Terraform
Article • 03/21/2024
This article shows how to use Terraform to create an API Management instance on
Azure. You can also use Terraform for common management tasks such as importing
APIs in your API Management instance.
Azure API Management helps organizations publish APIs to external, partner, and
internal developers to unlock the potential of their data and services. API Management
provides the core competencies to ensure a successful API program through developer
engagement, business insights, analytics, security, and protection. With API
Management, create and manage modern API gateways for existing backend services
hosted anywhere.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string for the Azure API Management service name using
random_string
" Create an Azure API Management service using azurerm_api_management
Prerequisites
If you don't have an Azure subscription, create a free account before you begin.
If you prefer to run CLI reference commands locally, install the Azure CLI. If
you're running on Windows or macOS, consider running Azure CLI in a Docker
container. For more information, see How to run the Azure CLI in a Docker
container.
If you're using a local installation, sign in to the Azure CLI by using the az
login command. To finish the authentication process, follow the steps
displayed in your terminal. For other sign-in options, see Sign in with the
Azure CLI.
When you're prompted, install the Azure CLI extension on first use. For more
information about extensions, see Use extensions with the Azure CLI.
Run az version to find the version and dependent libraries that are installed.
To upgrade to the latest version, run az upgrade.
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
2. Create a file named main.tf and insert the following code:
Terraform
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "api_management_service_name" {
value = azurerm_api_management.api.name
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "publisher_email" {
default = "[email protected]"
description = "The email address of the owner of the service"
type = string
validation {
condition = length(var.publisher_email) > 0
error_message = "The publisher_email must contain at least one
character."
}
}
variable "publisher_name" {
default = "publisher"
description = "The name of the owner of the service"
type = string
validation {
condition = length(var.publisher_name) > 0
error_message = "The publisher_name must contain at least one
character."
}
}
variable "sku" {
description = "The pricing tier of this API Management service"
default = "Developer"
type = string
validation {
condition = contains(["Developer", "Standard", "Premium"],
var.sku)
error_message = "The sku must be one of the following: Developer,
Standard, Premium."
}
}
variable "sku_count" {
description = "The instance size of this API Management service."
default = 1
type = number
validation {
condition = contains([1, 2], var.sku_count)
error_message = "The sku_count must be one of the following: 1, 2."
}
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
api_management_service_name=$(terraform output -raw
api_management_service_name)
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
) Note: The author created this article with assistance from AI. Learn more
Feedback
Was this page helpful? Yes No
This article shows how to use Terraform to create an Azure AI services account using
Terraform.
Azure AI services are cloud-based artificial intelligence (AI) services that help developers
build cognitive intelligence into applications without having direct AI or data science
skills or knowledge. They are available through REST APIs and client library SDKs in
popular development languages. Azure AI services enables developers to easily add
cognitive features into their applications with cognitive solutions that can see, hear,
speak, and analyze.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string using random_string
" Create an Azure AI services account using azurerm_cognitive_account
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "azurerm_cognitive_account_name" {
value = azurerm_cognitive_account.cognitive_service.name
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "sku" {
type = string
description = "The sku name of the Azure Analysis Services server to
create. Choose from: B1, B2, D1, S0, S1, S2, S3, S4, S8, S9. Some skus
are region specific. See https://docs.microsoft.com/en-
us/azure/analysis-services/analysis-services-overview#availability-by-
region"
default = "S0"
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
1. Get the Azure resource name in which the Azure AI services account was
created.
Console
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about Azure AI resources
Quickstart: Direct web traffic with Azure
Application Gateway - Terraform
Article • 05/30/2024
In this quickstart, you use Terraform to create an Azure Application Gateway. Then you
test the application gateway to make sure it works correctly. The Standard v2 SKU is
used in this example.
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=1.2"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0"
}
random = {
source = "hashicorp/random"
version = "~> 3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
gateway_ip_configuration {
name = "my-gateway-ip-configuration"
subnet_id = azurerm_subnet.frontend.id
}
frontend_port {
name = var.frontend_port_name
port = 80
}
frontend_ip_configuration {
name = var.frontend_ip_configuration_name
public_ip_address_id = azurerm_public_ip.pip.id
}
backend_address_pool {
name = var.backend_address_pool_name
}
backend_http_settings {
name = var.http_setting_name
cookie_based_affinity = "Disabled"
port = 80
protocol = "Http"
request_timeout = 60
}
http_listener {
name = var.listener_name
frontend_ip_configuration_name = var.frontend_ip_configuration_name
frontend_port_name = var.frontend_port_name
protocol = "Http"
}
request_routing_rule {
name = var.request_routing_rule_name
rule_type = "Basic"
http_listener_name = var.listener_name
backend_address_pool_name = var.backend_address_pool_name
backend_http_settings_name = var.http_setting_name
priority = 1
}
}
resource
"azurerm_network_interface_application_gateway_backend_address_pool_ass
ociation" "nic-assoc" {
count = 2
network_interface_id =
azurerm_network_interface.nic[count.index].id
ip_configuration_name = "nic-ipconfig-${count.index+1}"
backend_address_pool_id =
one(azurerm_application_gateway.main.backend_address_pool).id
}
network_interface_ids = [
azurerm_network_interface.nic[count.index].id,
]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2019-Datacenter"
version = "latest"
}
}
settings = <<SETTINGS
{
"commandToExecute": "powershell Add-WindowsFeature Web-Server;
powershell Add-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" -
Value $($env:computername)"
}
SETTINGS
Tip
You can modify values of the Name and Tier parameters under
resource\applicationGateWay\main\sku to use a different SKU. For example: Basic .
Terraform
variable "backend_address_pool_name" {
default = "myBackendPool"
}
variable "frontend_port_name" {
default = "myFrontendPort"
}
variable "frontend_ip_configuration_name" {
default = "myAGIPConfig"
}
variable "http_setting_name" {
default = "myHTTPsetting"
}
variable "listener_name" {
default = "myListener"
}
variable "request_routing_rule_name" {
default = "myRoutingRule"
}
Terraform
output "gateway_frontend_ip" {
value = "http://${azurerm_public_ip.pip.ip_address}"
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
2. Paste the public IP address into the address bar of your web browser. Refresh the
browser to see the name of the virtual machine. A valid response verifies the
application gateway is successfully created and can connect with the backend.
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Learn more about using Application Gateway
) Note: The author created this article with assistance from AI. Learn more
Quickstart: Create and configure Azure
DDoS Network Protection using
Terraform
Article • 03/18/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This quickstart describes how to use Terraform to create and enable a distributed denial
of service (DDoS) protection plan and Azure virtual network (VNet). An Azure DDoS
Network Protection plan defines a set of virtual networks that have DDoS protection
enabled across subscriptions. You can configure one DDoS protection plan for your
organization and link virtual networks from multiple subscriptions to the same plan.
" Create a random value for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random value for the virtual network name using random_string
" Create an Azure DDoS protection plan using
azurerm_network_ddos_protection_plan
" Create an Azure virtual network using azurerm_virtual_network
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
subnet {
name = "default"
address_prefix = var.subnet_prefix
}
ddos_protection_plan {
id = azurerm_network_ddos_protection_plan.ddos.id
enable = var.ddos_protection_plan_enabled
}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "vnet_address_prefix" {
type = string
description = "Specify the virtual network address prefix"
default = "172.17.0.0/16"
}
variable "subnet_prefix" {
type = string
description = "Specify the virtual network subnet prefix"
default = "172.17.0.0/24"
}
variable "ddos_protection_plan_enabled" {
type = bool
description = "Enable DDoS protection plan."
default = true
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "ddos_protection_plan_name" {
value = azurerm_network_ddos_protection_plan.ddos.name
}
output "virtual_network_name" {
value = azurerm_virtual_network.vnet.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
resource_group_name=$(terraform output -raw resource_group_name)
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
2. Run terraform apply to apply the execution plan.
Console
Next steps
View and configure DDoS protection telemetry
Quickstart: Create an Azure DNS zone
and record using Terraform
Article • 04/14/2023
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This article shows how to use Terraform to create an Azure DNS zone and an A record in
that zone.
" Create a random value for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random value using random_string
" Create an Azure DNS zone using azurerm_dns_zone
" Create an Azure DNS A record using azurerm_dns_a_record
Prerequisites
Install and configure Terraform
7 Note
The example code for this article is located in the Azure Terraform GitHub repo .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
2. Create a file named providers.tf and insert the following code:
Terraform
terraform {
required_version = ">=1.2"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
"www.${random_string.azurerm_dns_zone_name.result}.azurequickstart.org"
)
resource_group_name = azurerm_resource_group.rg.name
}
resource "azurerm_dns_a_record" "record" {
name = "www"
resource_group_name = azurerm_resource_group.rg.name
zone_name = azurerm_dns_zone.zone.name
ttl = var.dns_ttl
records = var.dns_records
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random value so name is unique in your Azure subscription."
}
variable "dns_zone_name" {
type = string
default = null
description = "Name of the DNS zone."
}
variable "dns_ttl" {
type = number
default = 3600
description = "Time To Live (TTL) of the DNS record (in seconds)."
}
variable "dns_records" {
type = list(string)
default = ["1.2.3.4", "1.2.3.5"]
description = "List of IPv4 addresses."
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "dns_zone_name" {
value = azurerm_dns_zone.zone.name
}
output "name_servers" {
value = azurerm_dns_zone.zone.name_servers
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
3. Run az network dns zone show to display information about the new DNS
zone.
Azure CLI
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about Azure DNS
Quickstart: Create an Azure Firewall and
IP Groups - Terraform
Article • 10/18/2023
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
In this quickstart, you use Terraform to deploy an Azure Firewall with sample IP Groups
used in a network rule and application rule. An IP Group is a top-level resource that
allows you to define and group IP addresses, ranges, and subnets into a single object. IP
Group is useful for managing IP addresses in Azure Firewall rules. You can either
manually enter IP addresses or import them from a file.
" Create a random value (to be used in the resource group name) using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random password for the Windows VM using random_password
" Create a random value (to be used as the storage name) using random_string
" Create an Azure public IP using azurerm_public_ip
" Create a storage account using azurerm_storage_account
" Create an Azure Firewall Policy using azurerm_firewall_policy
" Create an Azure Firewall Policy Rule Collection Group using
azurerm_firewall_policy_rule_collection_group
" Create an Azure Firewall using azurerm_firewall
" Create an Azure IP group using azurerm_ip_group
" Create an Azure Virtual Network using azurerm_virtual_network
" Create three Azure subnets using azurerm_subnet
" Create a network interface using azurerm_network_interface
" Create a network security group (to contain a list of network security rules) using
azurerm_network_security_group
" Create an association between the network interface and the network security
group using - azurerm_network_interface_security_group_association
" Create an Azure Linux Virtual Machine using azurerm_linux_virtual_machine
" Create a route table using azurerm_route_table
" Create an association between the route table and the subnet using -
azurerm_subnet_route_table_association
" Create an AzAPI resource azapi_resource .
" Create an AzAPI resource to generate an SSH key pair using
azapi_resource_action .
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
azapi = {
source = "azure/azapi"
version = "~>1.5"
}
}
}
provider "azurerm" {
features {}
}
Terraform
output "key_data" {
value =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
Terraform
ip_configuration {
name = "ipconfig-workload"
subnet_id = azurerm_subnet.server_subnet.id
private_ip_address_allocation = "Dynamic"
}
}
ip_configuration {
name = "ipconfig-jump"
subnet_id = azurerm_subnet.jump_subnet.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id = azurerm_public_ip.vm_jump_pip.id
}
}
resource "azurerm_network_interface_security_group_association"
"vm_server_nsg_association" {
network_interface_id =
azurerm_network_interface.vm_server_nic.id
network_security_group_id =
azurerm_network_security_group.vm_server_nsg.id
}
resource "azurerm_network_interface_security_group_association"
"vm_jump_nsg_association" {
network_interface_id = azurerm_network_interface.vm_jump_nic.id
network_security_group_id =
azurerm_network_security_group.vm_jump_nsg.id
}
resource "azurerm_subnet_route_table_association"
"jump_subnet_rt_association" {
subnet_id = azurerm_subnet.server_subnet.id
route_table_id = azurerm_route_table.rt.id
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix for the Resource Group Name that's combined
with a random id so name is unique in your Azure subcription."
default = "rg"
}
variable "firewall_sku_tier" {
type = string
description = "Firewall SKU."
default = "Premium" # Valid values are Standard and Premium
validation {
condition = contains(["Standard", "Premium"],
var.firewall_sku_tier)
error_message = "The SKU must be one of the following: Standard,
Premium"
}
}
variable "virtual_machine_size" {
type = string
description = "Size of the virtual machine."
default = "Standard_D2_v3"
}
variable "admin_username" {
type = string
description = "Value of the admin username."
default = "azureuser"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "firewall_name" {
value = azurerm_firewall.fw.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Tutorial: Deploy and configure Azure Firewall in a hybrid network using the Azure
portal
Quickstart: Create an Azure Firewall with
multiple public IP addresses - Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
In this quickstart, you use Terraform to deploy an Azure Firewall with multiple public IP
addresses from a public IP address prefix. The deployed firewall has NAT rule collection
rules that allow RDP connections to two Windows Server 2019 virtual machines.
For more information about Azure Firewall with multiple public IP addresses, see Deploy
an Azure Firewall with multiple public IP addresses using Azure PowerShell.
Create a random value (to be used in the resource group name) using
random_pet
Create a random password for the Windows VM using random_password
Create an Azure resource group using azurerm_resource_group
Create an Azure public IP prefix using azurerm_public_ip_prefix
Create an Azure public IP using azurerm_public_ip
Create an Azure Virtual Network using azurerm_virtual_network
Create an Azure subnet using azurerm_subnet
Create a network interface using azurerm_network_interface
Create a network security group (to contain a list of network security rules)
using azurerm_network_security_group
Create an association between a Network Interface and a Network Security
Group using azurerm_network_interface_security_group_association
Create an Windows Virtual Machine using azurerm_windows_virtual_machine
Create an Azure Firewall Policy using azurerm_firewall_policy
Create an Azure Firewall Policy Rule Collection Group using
azurerm_firewall_policy_rule_collection_group
Create an Azure Firewall using azurerm_firewall
Create a route table using azurerm_route_table
Create an association between the route table and the subnet using -
azurerm_subnet_route_table_association
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {
virtual_machine {
delete_os_disk_on_deletion = true
skip_shutdown_and_force_delete = true
}
}
}
Terraform
ip_configuration {
name = "ipconfig-backend-${count.index +
1}"
subnet_id = azurerm_subnet.backend_subnet.id
private_ip_address_allocation = "Dynamic"
}
}
resource "azurerm_network_interface_security_group_association"
"vm_backend_nsg_association" {
count = 2
network_interface_id =
azurerm_network_interface.backend_nic[count.index].id
network_security_group_id =
azurerm_network_security_group.backend_nsg.id
}
resource "azurerm_firewall_policy_rule_collection_group"
"policy_rule_collection_group" {
name = "RuleCollectionGroup"
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
priority = 300
application_rule_collection {
name = "web"
priority = 100
action = "Allow"
rule {
name = "wan-address"
protocols {
type = "Http"
port = 80
}
protocols {
type = "Https"
port = 443
}
destination_fqdns = ["getmywanip.com"]
source_addresses = ["*"]
}
rule {
name = "google"
protocols {
type = "Http"
port = 80
}
protocols {
type = "Https"
port = 443
}
destination_fqdns = ["www.google.com"]
source_addresses = ["10.10.1.0/24"]
}
rule {
name = "wupdate"
protocols {
type = "Http"
port = 80
}
protocols {
type = "Https"
port = 443
}
destination_fqdn_tags = ["WindowsUpdate"]
source_addresses = ["*"]
}
}
nat_rule_collection {
name = "Coll-01"
action = "Dnat"
priority = 200
rule {
name = "rdp-01"
protocols = ["TCP"]
translated_address = "10.10.1.4"
translated_port = "3389"
source_addresses = ["*"]
destination_address = azurerm_public_ip.pip_azfw.ip_address
destination_ports = ["3389"]
}
rule {
name = "rdp-02"
protocols = ["TCP"]
translated_address = "10.10.1.5"
translated_port = "3389"
source_addresses = ["*"]
destination_address = azurerm_public_ip.pip_azfw.ip_address
destination_ports = ["3389"]
}
}
}
resource "azurerm_firewall" "fw" {
name = "azfw"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku_name = "AZFW_VNet"
sku_tier = var.firewall_sku_tier
ip_configuration {
name = "azfw-ipconfig"
subnet_id = azurerm_subnet.azfw_subnet.id
public_ip_address_id = azurerm_public_ip.pip_azfw.id
}
ip_configuration {
name = "azfw-ipconfig-2"
public_ip_address_id = azurerm_public_ip.pip_azfw_2.id
}
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
}
resource "azurerm_subnet_route_table_association"
"jump_subnet_rt_association" {
subnet_id = azurerm_subnet.backend_subnet.id
route_table_id = azurerm_route_table.rt.id
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix for the Resource Group Name that's combined
with a random id so name is unique in your Azure subcription."
default = "rg"
}
variable "firewall_sku_tier" {
type = string
description = "Firewall SKU."
default = "Premium" # Valid values are Standard and Premium
validation {
condition = contains(["Standard", "Premium"],
var.firewall_sku_tier)
error_message = "The SKU must be one of the following: Standard,
Premium"
}
}
variable "virtual_machine_size" {
type = string
description = "Size of the virtual machine."
default = "Standard_D2_v3"
}
variable "admin_username" {
type = string
description = "Value of the admin username."
default = "azureuser"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "backend_admin_password" {
sensitive = true
value =
azurerm_windows_virtual_machine.vm_backend[*].admin_password
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Tutorial: Deploy and configure Azure Firewall in a hybrid network using the Azure
portal
Quickstart: Deploy Azure Firewall with
Availability Zones - Terraform
Article • 10/18/2023
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
In this quickstart, you use Terraform to deploy an Azure Firewall in three Availability
Zones.
The Terraform configuration creates a test network environment with a firewall. The
network has one virtual network (VNet) with three subnets: AzureFirewallSubnet, subnet-
server, and subnet-jump. The subnet-server and subnet-jump subnet each have a single
two-core Windows Server virtual machine.
The firewall is in the AzureFirewallSubnet subnet and has an application rule collection
with a single rule that allows access to www.microsoft.com .
A user-defined route points network traffic from the subnet-server subnet through the
firewall where the firewall rules are applied.
For more information about Azure Firewall, see Deploy and configure Azure Firewall
using the Azure portal.
" Create a random value (to be used in the resource group name) using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create an Azure Virtual Network using azurerm_virtual_network
" Create three Azure subnets using azurerm_subnet
" Create an Azure public IP using azurerm_public_ip
" Create an Azure Firewall Policy using azurerm_firewall_policy
" Create an Azure Firewall Policy Rule Collection Group using
azurerm_firewall_policy_rule_collection_group
" Create an Azure Firewall using azurerm_firewall
" Create a network interface using azurerm_network_interface
" Create a network security group (to contain a list of network security rules) using
azurerm_network_security_group
" Create an association between the network interface and the network security
group using - azurerm_network_interface_security_group_association
" Create a route table using azurerm_route_table
" Create an association between the route table and the subnet using -
azurerm_subnet_route_table_association
" Create a random value (to be used as the storage name) using random_string
" Create a storage account using azurerm_storage_account
" Create a random password for the Windows VM using random_password
" Create an Azure Windows Virtual Machine using azurerm_windows_virtual_machine
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
ip_configuration {
name = "ipconfig-workload"
subnet_id = azurerm_subnet.server_subnet.id
private_ip_address_allocation = "Dynamic"
}
}
ip_configuration {
name = "ipconfig-jump"
subnet_id = azurerm_subnet.jump_subnet.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id = azurerm_public_ip.vm_jump_pip.id
}
}
resource "azurerm_network_interface_security_group_association"
"vm_server_nsg_association" {
network_interface_id =
azurerm_network_interface.vm_server_nic.id
network_security_group_id =
azurerm_network_security_group.vm_server_nsg.id
}
resource "azurerm_network_interface_security_group_association"
"vm_jump_nsg_association" {
network_interface_id = azurerm_network_interface.vm_jump_nic.id
network_security_group_id =
azurerm_network_security_group.vm_jump_nsg.id
}
resource "azurerm_subnet_route_table_association"
"jump_subnet_rt_association" {
subnet_id = azurerm_subnet.server_subnet.id
route_table_id = azurerm_route_table.rt.id
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix for the Resource Group Name that's combined
with a random id so name is unique in your Azure subcription."
default = "rg"
}
variable "firewall_sku_tier" {
type = string
description = "Firewall SKU."
default = "Premium" # Valid values are Standard and Premium
validation {
condition = contains(["Standard", "Premium"],
var.firewall_sku_tier)
error_message = "The SKU must be one of the following: Standard,
Premium"
}
}
variable "virtual_machine_size" {
type = string
description = "Size of the virtual machine."
default = "Standard_D2_v3"
}
variable "admin_username" {
type = string
description = "Value of the admin username."
default = "azureuser"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "firewall_name" {
value = azurerm_firewall.fw.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
) Important
Azure Front Door (classic) will be retired on March 31, 2027. To avoid any service
disruption, it is important that you migrate your Azure Front Door (classic) profiles
to Azure Front Door Standard or Premium tier by March 2027. For more
information, see Azure Front Door (classic) retirement .
This quickstart describes how to use Terraform to create a Front Door (classic) profile to
set up high availability for a web endpoint.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the Front Door endpoint host name using random_id .
" Create a Front Door (classic) resource using - azurerm_frontdoor .
Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
locals {
front_door_name =
"afd-${lower(random_id.front_door_name.hex)}"
front_door_frontend_endpoint_name = "frontEndEndpoint"
front_door_load_balancing_settings_name = "loadBalancingSettings"
front_door_health_probe_settings_name = "healthProbeSettings"
front_door_routing_rule_name = "routingRule"
front_door_backend_pool_name = "backendPool"
}
frontend_endpoint {
name = local.front_door_frontend_endpoint_name
host_name = "${local.front_door_name}.azurefd.net"
session_affinity_enabled = false
}
backend_pool_load_balancing {
name =
local.front_door_load_balancing_settings_name
sample_size = 4
successful_samples_required = 2
}
backend_pool_health_probe {
name = local.front_door_health_probe_settings_name
path = "/"
protocol = "Http"
interval_in_seconds = 120
}
backend_pool {
name = local.front_door_backend_pool_name
backend {
host_header = var.backend_address
address = var.backend_address
http_port = 80
https_port = 443
weight = 50
priority = 1
}
load_balancing_name = local.front_door_load_balancing_settings_name
health_probe_name = local.front_door_health_probe_settings_name
}
backend_pool_settings {
backend_pools_send_receive_timeout_seconds = 0
enforce_backend_pools_certificate_name_check = false
}
routing_rule {
name = local.front_door_routing_rule_name
accepted_protocols = ["Http", "Https"]
patterns_to_match = ["/*"]
frontend_endpoints = [local.front_door_frontend_endpoint_name]
forwarding_configuration {
forwarding_protocol = "MatchRequest"
backend_pool_name = local.front_door_backend_pool_name
}
}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "backend_address" {
type = string
description = "Backend address."
default = "www.bing.com"
}
5. Create a file named outputs.tf and insert the following code, being sure to
update the value to your own backend hostname:
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "frontDoorEndpointHostName" {
value = azurerm_frontdoor.main.frontend_endpoint[0].host_name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
terraform init -upgrade
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Overview of Azure Front Door
Quickstart: Create an Azure Front Door
Standard/Premium profile using
Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This quickstart describes how to use Terraform to create a Front Door profile to set up
high availability for a web endpoint.
7 Note
For web workloads, we highly recommend utilizing Azure DDoS protection and a
web application firewall to safeguard against emerging DDoS attacks. Another
option is to employ Azure Front Door along with a web application firewall. Azure
Front Door offers platform-level protection against network-level DDoS attacks.
For more information, see security baseline for Azure services.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the Front Door endpoint resource name and App Service
app name using random_id .
" Create a Front Door profile using azurerm_cdn_frontdoor_profile .
" Create a Front Door endpoint using azurerm_cdn_frontdoor_endpoint .
" Create a Front Door origin group using azurerm_cdn_frontdoor_origin_group
" Create a Front Door origin, which refers to the App Service app, using
azurerm_cdn_frontdoor_origin .
" Create a Front Door route using azurerm_cdn_frontdoor_route .
" Create an App Service plan using azurerm_service_plan .
" Create an App Service app using azurerm_windows_web_app .
Prerequisites
Install and configure Terraform
Implement the Terraform code
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
locals {
front_door_profile_name = "MyFrontDoor"
front_door_endpoint_name =
"afd-${lower(random_id.front_door_endpoint_name.hex)}"
front_door_origin_group_name = "MyOriginGroup"
front_door_origin_name = "MyAppServiceOrigin"
front_door_route_name = "MyRoute"
}
load_balancing {
sample_size = 4
successful_samples_required = 3
}
health_probe {
path = "/"
request_type = "HEAD"
protocol = "Https"
interval_in_seconds = 100
}
}
enabled = true
host_name =
azurerm_windows_web_app.app.default_hostname
http_port = 80
https_port = 443
origin_host_header =
azurerm_windows_web_app.app.default_hostname
priority = 1
weight = 1000
certificate_name_check_enabled = true
}
Terraform
locals {
app_name = "myapp-${lower(random_id.app_name.hex)}"
app_service_plan_name = "AppServicePlan"
}
sku_name = var.app_service_plan_sku_name
os_type = "Windows"
worker_count = var.app_service_plan_capacity
}
https_only = true
site_config {
ftps_state = "Disabled"
minimum_tls_version = "1.2"
ip_restriction {
service_tag = "AzureFrontDoor.Backend"
ip_address = null
virtual_network_subnet_id = null
action = "Allow"
priority = 100
headers {
x_azure_fdid =
[azurerm_cdn_frontdoor_profile.my_front_door.resource_guid]
x_fd_health_probe = []
x_forwarded_for = []
x_forwarded_host = []
}
name = "Allow traffic from Front Door"
}
}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "app_service_plan_sku_name" {
type = string
description = "The SKU for the plan. Possible values include: B1, B2,
B3, D1, F1, I1, I2, I3, I1v2, I2v2, I3v2, I4v2, I5v2, I6v2, P1v2, P2v2,
P3v2, P0v3, P1v3, P2v3, P3v3, P1mv3, P2mv3, P3mv3, P4mv3, P5mv3, S1,
S2, S3, SHARED, EP1, EP2, EP3, WS1, WS2, WS3, Y1."
default = "S1"
validation {
condition = contains(["B1", "B2", "B3", "D1", "F1", "I1", "I2",
"I3", "I1v2", "I2v2", "I3v2", "I4v2", "I5v2", "I6v2", "P1v2", "P2v2",
"P3v2", "P0v3", "P1v3", "P2v3", "P3v3", "P1mv3", "P2mv3", "P3mv3",
"P4mv3", "P5mv3", "S1", "S2", "S3", "SHARED", "EP1", "EP2", "EP3",
"WS1", "WS2", "WS3", "Y1"], var.app_service_plan_sku_name)
error_message = "The SKU value must be one of the following: B1,
B2, B3, D1, F1, I1, I2, I3, I1v2, I2v2, I3v2, I4v2, I5v2, I6v2, P1v2,
P2v2, P3v2, P0v3, P1v3, P2v3, P3v3, P1mv3, P2mv3, P3mv3, P4mv3, P5mv3,
S1, S2, S3, SHARED, EP1, EP2, EP3, WS1, WS2, WS3, Y1."
}
}
variable "app_service_plan_capacity" {
type = number
description = "The number of Workers (instances) to be allocated."
default = 1
}
variable "front_door_sku_name" {
type = string
description = "The SKU for the Front Door profile. Possible values
include: Standard_AzureFrontDoor, Premium_AzureFrontDoor"
default = "Standard_AzureFrontDoor"
validation {
condition = contains(["Standard_AzureFrontDoor",
"Premium_AzureFrontDoor"], var.front_door_sku_name)
error_message = "The SKU value must be one of the following:
Standard_AzureFrontDoor, Premium_AzureFrontDoor."
}
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "frontDoorEndpointHostName" {
value = azurerm_cdn_frontdoor_endpoint.my_endpoint.host_name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Overview of Azure Front Door
Quickstart: Create a mesh network
topology with Azure Virtual Network
Manager using Terraform
Article • 06/10/2024
Get started with Azure Virtual Network Manager by using Terraform to provision
connectivity for all your virtual networks.
In this quickstart, you deploy three virtual networks and use Azure Virtual Network
Manager to create a mesh network topology. Then, you verify that the connectivity
configuration was applied. You can choose from a deployment with a Subscription
scope or a management group scope. Learn more about network manager scopes.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create an array of virtual networks using azurerm_virtual_network .
" Create an array of subnets using azurerm_subnet .
" Create a virtual network manager using azurerm_virtual_network_manager .
" Create a network manager network group using
azurerm_network_manager_network_group .
" Create a network manager static member using
azurerm_network_manager_static_member .
" Create a network manager connectivity configuration using
azurerm_network_manager_connectivity_configuration .
" Create a network manager deployment using
azurerm_network_manager_deployment .
Prerequisites
Install and configure Terraform
To modify dynamic network groups, you must be granted access via Azure RBAC
role assignment only. Classic Admin/legacy authorization is not supported
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.56.0, < 4.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
# Create the Resource Group
name =
"${random_pet.virtual_network_name.id}-0${count.index}"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
address_space = ["10.${count.index}.0.0/16"]
}
name = "default"
virtual_network_name = azurerm_virtual_network.vnet[count.index].name
resource_group_name = azurerm_resource_group.rg.name
address_prefixes = ["10.${count.index}.0.0/24"]
}
metadata = <<METADATA
{
"category": "Azure Virtual Network Manager"
}
METADATA
policy_rule = <<POLICY_RULE
{
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/virtualNetworks"
},
{
"allOf": [
{
"field": "Name",
"contains": "${random_pet.virtual_network_name.id}"
}
]
}
]
},
"then": {
"effect": "addToNetworkGroup",
"details": {
"networkGroupId":
"${azurerm_network_manager_network_group.network_group.id}"
}
}
}
POLICY_RULE
}
resource "azurerm_subscription_policy_assignment"
"azure_policy_assignment" {
name = "${random_pet.network_group_policy_name.id}-
policy-assignment"
policy_definition_id =
azurerm_policy_definition.network_group_policy.id
subscription_id = data.azurerm_subscription.current.id
}
# Commit deployment
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "msi_id" {
type = string
description = "(Optional) Manage identity id that be used as
authentication method. Defaults to `null`."
default = null
}
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "virtual_network_names" {
value = azurerm_virtual_network.vnet[*].name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
3. For each virtual network name printed in the previous step, run az network
manager list-effective-connectivity-config to print the effective (applied)
configurations. Replace the <virtual_network_name> placeholder with the vnet
name.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Block network traffic with Azure Virtual Network Manager
) Note: The author created this article with assistance from AI. Learn more
Feedback
Was this page helpful? Yes No
This article shows how to use Terraform to create an Azure CDN profile and endpoint
using Terraform.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string for the CDN endpoint name using random_string
" Create an Azure CDN profile using azurerm_cdn_profile
" Create an Azure CDN endpoint using azurerm_cdn_endpoint
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
origin {
name = "origin1"
host_name = var.origin_url
}
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "cdn_profile_name" {
value = azurerm_cdn_profile.profile.name
}
output "cdn_endpoint_endpoint_name" {
value = azurerm_cdn_endpoint.endpoint.name
}
output "cdn_endpoint_fqdn" {
value = azurerm_cdn_endpoint.endpoint.fqdn
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "origin_url" {
type = string
description = "Url of the origin."
default = "www.contoso.com"
}
variable "cdn_sku" {
type = string
description = "CDN SKU names."
default = "Standard_Microsoft"
validation {
condition = contains(["Standard_Akamai", "Standard_Microsoft",
"Standard_Verizon", "Premium_Verizon"], var.cdn_sku)
error_message = "The cdn_sku must be one of the following:
Standard_Akamai, Standard_Microsoft, Standard_Verizon,
Premium_Verizon."
}
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
1. Get the Azure resource group name in which the Azure CDN profile and
endpoint were created.
Console
Console
cdn_profile_name=$(terraform output -raw cdn_profile_name)
Console
4. Run az cdn custom-domain show to show details of the custom domain you
created in this article.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Next steps
Tutorial: Use CDN to serve static content from a web app
Quickstart: Create an Azure Traffic
Manager profile using Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This quickstart describes how to use Terraform to create a Traffic Manager profile with
external endpoints using the performance routing method.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the Azure Traffic Manager profile name using
random_string .
" Create a random value for the Azure Traffic Manager profile DNS config relative
name using random_string .
" Create an Azure Traffic Manager profile using azurerm_traffic_manager_profile .
" Create two Azure Traffic Manager external endpoint using
azurerm_traffic_manager_external_endpoint .
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
resource "random_string"
"azurerm_traffic_manager_profile_dns_config_relative_name" {
length = 10
upper = false
numeric = false
special = false
}
monitor_config {
protocol = "HTTPS"
port = 443
path = "/"
expected_status_code_ranges = ["200-202", "301-302"]
}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "azurerm_traffic_manager_profile_name" {
value = azurerm_traffic_manager_profile.profile.name
}
output "azurerm_traffic_manager_profile_fqdn" {
value = azurerm_traffic_manager_profile.profile.fqdn
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
traffic_manager_profile_name=$(terraform output -raw
azurerm_traffic_manager_profile_name)
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Improve website response with Azure Traffic Manager
Quickstart: Use Terraform to create a
virtual network
Article • 02/28/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
In this quickstart, you learn about a Terraform script that creates an Azure resource
group and a virtual network with two subnets. The script generates the names of the
resource group and the virtual network by using a random pet name with a prefix. The
script also shows the names of the created resources in output.
The script uses the Azure Resource Manager ( azurerm ) provider to interact with Azure
resources. It uses the Random ( random ) provider to generate random pet names for the
resources.
A resource group: A container that holds related resources for an Azure solution.
A virtual network: A fundamental building block for your private network in Azure.
Two subnets: Segments of a virtual network's IP address range where you can
place groups of isolated resources.
Prerequisites
An Azure account with an active subscription. You can create an account for free .
The sample code for this article is in the Azure Terraform GitHub repo . You can
view the log file that contains the test results from current and previous versions
of Terraform .
For more articles and sample code that show how to use Terraform to manage
Azure resources, see the documentation page for Terraform on Azure.
1. Create a directory in which to test and run the sample Terraform code, and make it
the current directory.
Terraform
# Resource Group
resource "azurerm_resource_group" "rg" {
location = var.resource_group_location
name = "${random_pet.prefix.id}-rg"
}
# Virtual Network
resource "azurerm_virtual_network" "my_terraform_network" {
name = "${random_pet.prefix.id}-vnet"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}
# Subnet 1
resource "azurerm_subnet" "my_terraform_subnet_1" {
name = "subnet-1"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name =
azurerm_virtual_network.my_terraform_network.name
address_prefixes = ["10.0.0.0/24"]
}
# Subnet 2
resource "azurerm_subnet" "my_terraform_subnet_2" {
name = "subnet-2"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name =
azurerm_virtual_network.my_terraform_network.name
address_prefixes = ["10.0.1.0/24"]
}
Terraform
output "resource_group_name" {
description = "The name of the created resource group."
value = azurerm_resource_group.rg.name
}
output "virtual_network_name" {
description = "The name of the created virtual network."
value = azurerm_virtual_network.my_terraform_network.name
}
output "subnet_name_1" {
description = "The name of the created subnet 1."
value = azurerm_subnet.my_terraform_subnet_1.name
}
output "subnet_name_2" {
description = "The name of the created subnet 2."
value = azurerm_subnet.my_terraform_subnet_2.name
}
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
3. Use az network vnet show to display the details of your newly created virtual
network:
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Get started with Azure NAT Gateway using Terraform. This Terraform file deploys a
virtual network, a NAT gateway resource, and Ubuntu virtual machine. The Ubuntu
virtual machine is deployed to a subnet that is associated with the NAT gateway
resource.
The script also generates a random SSH public key and associates it with the virtual
machine for secure access. The public key is outputted at the end of the script
execution.
The script uses the Random and AzAPI providers in addition to the AzureRM provider.
The Random provider is used to generate a unique name for the resource group and the
SSH key. The AzAPI provider is used to generate the SSH public key.
As with the public key, the names of the created resource group, virtual network, subnet,
and NAT gateway are printed when the script is run.
Prerequisites
An Azure account with an active subscription. You can create an account for free .
Install and configure Terraform.
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
# Resource Group
resource "azurerm_resource_group" "rg" {
location = var.resource_group_location
name = "${random_pet.prefix.id}-rg"
}
# Virtual Network
resource "azurerm_virtual_network" "my_terraform_network" {
name = "${random_pet.prefix.id}-vnet"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}
# Subnet 1
resource "azurerm_subnet" "my_terraform_subnet_1" {
name = "subnet-1"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name =
azurerm_virtual_network.my_terraform_network.name
address_prefixes = ["10.0.0.0/24"]
}
security_rule {
name = "SSH"
priority = 1001
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}
ip_configuration {
name = "my_nic_configuration"
subnet_id =
azurerm_subnet.my_terraform_subnet_1.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id =
azurerm_public_ip.my_public_ip_vm.id
}
}
byte_length = 8
}
os_disk {
name = "myOsDisk"
caching = "ReadWrite"
storage_account_type = "Premium_LRS"
}
source_image_reference {
publisher = "Canonical"
offer = "0001-com-ubuntu-server-jammy"
sku = "22_04-lts-gen2"
version = "latest"
}
computer_name = "hostname"
admin_username = var.username
admin_ssh_key {
username = var.username
public_key =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.my_storage_account.primary_blob_endpoint
}
}
Terraform
output "resource_group_name" {
description = "The name of the created resource group."
value = azurerm_resource_group.rg.name
}
output "virtual_network_name" {
description = "The name of the created virtual network."
value = azurerm_virtual_network.my_terraform_network.name
}
output "subnet_name_1" {
description = "The name of the created subnet 1."
value = azurerm_subnet.my_terraform_subnet_1.name
}
output "nat_gateway"{
description = "The name of the created NAT gateway."
value = azurerm_nat_gateway.my_nat_gateway.id
}
Terraform
terraform {
required_providers {
azapi = {
source = "azure/azapi"
version = "~>1.5"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
output "key_data" {
value =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
6. Create a file named variables.tf and insert the following code:
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "username" {
type = string
description = "The username for the local account that will be
created on the new VM."
default = "azureuser"
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
1. Run az network nat gateway show to display the details about the NAT
gateway.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Quickstart: Create a private endpoint by
using Terraform
Article • 02/23/2024
In this quickstart, you use Terraform to create a private endpoint. The private endpoint
connects to an Azure SQL Database. The private endpoint is associated with a virtual
network and a private Domain Name System (DNS) zone. The private DNS zone resolves
the private endpoint IP address. The virtual network contains a virtual machine that you
use to test the connection of the private endpoint to the instance of the SQL Database.
The script generates a random password for the SQL server and a random SSH key for
the virtual machine. The names of the created resources are output when the script is
run.
Prerequisites
You need an Azure account with an active subscription. Create an account for
free .
The sample code for this article is located in the Azure Terraform GitHub repo .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
# Resource Group
resource "azurerm_resource_group" "rg" {
location = var.resource_group_location
name = "${random_pet.prefix.id}-rg"
}
# Virtual Network
resource "azurerm_virtual_network" "my_terraform_network" {
name = "${random_pet.prefix.id}-vnet"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}
# Subnet 1
resource "azurerm_subnet" "my_terraform_subnet_1" {
name = "subnet-1"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name =
azurerm_virtual_network.my_terraform_network.name
address_prefixes = ["10.0.0.0/24"]
}
security_rule {
name = "SSH"
priority = 1001
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}
ip_configuration {
name = "my_nic_configuration"
subnet_id =
azurerm_subnet.my_terraform_subnet_1.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id =
azurerm_public_ip.my_public_ip_vm.id
}
}
byte_length = 8
}
os_disk {
name = "myOsDisk"
caching = "ReadWrite"
storage_account_type = "Premium_LRS"
}
source_image_reference {
publisher = "Canonical"
offer = "0001-com-ubuntu-server-jammy"
sku = "22_04-lts-gen2"
version = "latest"
}
computer_name = "hostname"
admin_username = var.username
admin_ssh_key {
username = var.username
public_key =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.my_storage_account.primary_blob_endpoint
}
}
locals {
admin_password = try(random_password.admin_password[0].result,
var.admin_password)
}
private_service_connection {
name = "private-serviceconnection"
private_connection_resource_id = azurerm_mssql_server.server.id
subresource_names = ["sqlServer"]
is_manual_connection = false
}
private_dns_zone_group {
name = "dns-zone-group"
private_dns_zone_ids =
[azurerm_private_dns_zone.my_terraform_dns_zone.id]
}
}
Terraform
output "resource_group_name" {
description = "The name of the created resource group."
value = azurerm_resource_group.rg.name
}
output "virtual_network_name" {
description = "The name of the created virtual network."
value = azurerm_virtual_network.my_terraform_network.name
}
output "subnet_name_1" {
description = "The name of the created subnet 1."
value = azurerm_subnet.my_terraform_subnet_1.name
}
output "nat_gateway_name" {
description = "The name of the created NAT gateway."
value = azurerm_nat_gateway.my_nat_gateway.name
}
output "sql_server_name" {
value = azurerm_mssql_server.server.name
}
output "admin_password" {
sensitive = true
value = local.admin_password
}
Terraform
terraform {
required_providers {
azapi = {
source = "azure/azapi"
version = "~>1.5"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}
Terraform
resource "random_pet" "ssh_key_name" {
prefix = "ssh"
separator = ""
}
output "key_data" {
value =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "username" {
type = string
description = "The username for the local account that will be
created on the new VM."
default = "azureuser"
}
variable "sql_db_name" {
type = string
description = "The name of the SQL Database."
default = "SampleDB"
}
variable "admin_username" {
type = string
description = "The administrator username of the SQL logical server."
default = "azureadmin"
}
variable "admin_password" {
type = string
description = "The administrator password of the SQL logical server."
sensitive = true
default = null
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Quickstart: Direct web traffic with Azure
Application Gateway - Terraform
Article • 05/30/2024
In this quickstart, you use Terraform to create an Azure Application Gateway. Then you
test the application gateway to make sure it works correctly. The Standard v2 SKU is
used in this example.
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=1.2"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0"
}
random = {
source = "hashicorp/random"
version = "~> 3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
gateway_ip_configuration {
name = "my-gateway-ip-configuration"
subnet_id = azurerm_subnet.frontend.id
}
frontend_port {
name = var.frontend_port_name
port = 80
}
frontend_ip_configuration {
name = var.frontend_ip_configuration_name
public_ip_address_id = azurerm_public_ip.pip.id
}
backend_address_pool {
name = var.backend_address_pool_name
}
backend_http_settings {
name = var.http_setting_name
cookie_based_affinity = "Disabled"
port = 80
protocol = "Http"
request_timeout = 60
}
http_listener {
name = var.listener_name
frontend_ip_configuration_name = var.frontend_ip_configuration_name
frontend_port_name = var.frontend_port_name
protocol = "Http"
}
request_routing_rule {
name = var.request_routing_rule_name
rule_type = "Basic"
http_listener_name = var.listener_name
backend_address_pool_name = var.backend_address_pool_name
backend_http_settings_name = var.http_setting_name
priority = 1
}
}
resource
"azurerm_network_interface_application_gateway_backend_address_pool_ass
ociation" "nic-assoc" {
count = 2
network_interface_id =
azurerm_network_interface.nic[count.index].id
ip_configuration_name = "nic-ipconfig-${count.index+1}"
backend_address_pool_id =
one(azurerm_application_gateway.main.backend_address_pool).id
}
network_interface_ids = [
azurerm_network_interface.nic[count.index].id,
]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2019-Datacenter"
version = "latest"
}
}
settings = <<SETTINGS
{
"commandToExecute": "powershell Add-WindowsFeature Web-Server;
powershell Add-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" -
Value $($env:computername)"
}
SETTINGS
Tip
You can modify values of the Name and Tier parameters under
resource\applicationGateWay\main\sku to use a different SKU. For example: Basic .
Terraform
variable "backend_address_pool_name" {
default = "myBackendPool"
}
variable "frontend_port_name" {
default = "myFrontendPort"
}
variable "frontend_ip_configuration_name" {
default = "myAGIPConfig"
}
variable "http_setting_name" {
default = "myHTTPsetting"
}
variable "listener_name" {
default = "myListener"
}
variable "request_routing_rule_name" {
default = "myRoutingRule"
}
Terraform
output "gateway_frontend_ip" {
value = "http://${azurerm_public_ip.pip.ip_address}"
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
2. Paste the public IP address into the address bar of your web browser. Refresh the
browser to see the name of the virtual machine. A valid response verifies the
application gateway is successfully created and can connect with the backend.
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Learn more about using Application Gateway
) Note: The author created this article with assistance from AI. Learn more
Quickstart: Create an Azure Attestation
provider by using Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create an Azure Attestation provider using azurerm_attestation_provider .
Prerequisites
Install and configure Terraform
Policy Signing Certificate: You need to upload an X.509 certificate, which is used
by the attestation provider to validate signed policies. This certificate is either
signed by a certificate authority or self-signed. Supported file extensions include
pem , txt , and cer . This article assumes that you already have a valid X.509
certificate.
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
2. Create a file named providers.tf and insert the following code:
Terraform
terraform {
required_version = ">=0.12"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
tls = {
source = "hashicorp/tls"
version = "4.0.4"
}
}
}
provider "azurerm" {
features {}
}
Terraform
locals {
create_signing_cert = try(!fileexists(var.cert_path), true)
}
algorithm = "RSA"
rsa_bits = 4096
}
private_key_pem = tls_private_key.signing_cert[0].private_key_pem
validity_period_hours = 12
allowed_uses = [
"cert_signing",
]
}
Terraform
variable "attestation_provider_name" {
default = "attestation"
}
variable "cert_path" {
default = "~/.certs/cert.pem"
}
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "resource_group_name_prefix" {
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
Key points:
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
2. Run az attestation list to list the providers for the specified resource group
name.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following
steps:
Key points:
Console
Next steps
Overview of Azure Attestation .
Quickstart: Create and configure Azure
DDoS Network Protection using
Terraform
Article • 03/18/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This quickstart describes how to use Terraform to create and enable a distributed denial
of service (DDoS) protection plan and Azure virtual network (VNet). An Azure DDoS
Network Protection plan defines a set of virtual networks that have DDoS protection
enabled across subscriptions. You can configure one DDoS protection plan for your
organization and link virtual networks from multiple subscriptions to the same plan.
" Create a random value for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random value for the virtual network name using random_string
" Create an Azure DDoS protection plan using
azurerm_network_ddos_protection_plan
" Create an Azure virtual network using azurerm_virtual_network
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
subnet {
name = "default"
address_prefix = var.subnet_prefix
}
ddos_protection_plan {
id = azurerm_network_ddos_protection_plan.ddos.id
enable = var.ddos_protection_plan_enabled
}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "vnet_address_prefix" {
type = string
description = "Specify the virtual network address prefix"
default = "172.17.0.0/16"
}
variable "subnet_prefix" {
type = string
description = "Specify the virtual network subnet prefix"
default = "172.17.0.0/24"
}
variable "ddos_protection_plan_enabled" {
type = bool
description = "Enable DDoS protection plan."
default = true
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "ddos_protection_plan_name" {
value = azurerm_network_ddos_protection_plan.ddos.name
}
output "virtual_network_name" {
value = azurerm_virtual_network.vnet.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
resource_group_name=$(terraform output -raw resource_group_name)
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
2. Run terraform apply to apply the execution plan.
Console
Next steps
View and configure DDoS protection telemetry
Quickstart: Create an Azure Firewall and
IP Groups - Terraform
Article • 10/18/2023
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
In this quickstart, you use Terraform to deploy an Azure Firewall with sample IP Groups
used in a network rule and application rule. An IP Group is a top-level resource that
allows you to define and group IP addresses, ranges, and subnets into a single object. IP
Group is useful for managing IP addresses in Azure Firewall rules. You can either
manually enter IP addresses or import them from a file.
" Create a random value (to be used in the resource group name) using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random password for the Windows VM using random_password
" Create a random value (to be used as the storage name) using random_string
" Create an Azure public IP using azurerm_public_ip
" Create a storage account using azurerm_storage_account
" Create an Azure Firewall Policy using azurerm_firewall_policy
" Create an Azure Firewall Policy Rule Collection Group using
azurerm_firewall_policy_rule_collection_group
" Create an Azure Firewall using azurerm_firewall
" Create an Azure IP group using azurerm_ip_group
" Create an Azure Virtual Network using azurerm_virtual_network
" Create three Azure subnets using azurerm_subnet
" Create a network interface using azurerm_network_interface
" Create a network security group (to contain a list of network security rules) using
azurerm_network_security_group
" Create an association between the network interface and the network security
group using - azurerm_network_interface_security_group_association
" Create an Azure Linux Virtual Machine using azurerm_linux_virtual_machine
" Create a route table using azurerm_route_table
" Create an association between the route table and the subnet using -
azurerm_subnet_route_table_association
" Create an AzAPI resource azapi_resource .
" Create an AzAPI resource to generate an SSH key pair using
azapi_resource_action .
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
azapi = {
source = "azure/azapi"
version = "~>1.5"
}
}
}
provider "azurerm" {
features {}
}
Terraform
output "key_data" {
value =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
Terraform
ip_configuration {
name = "ipconfig-workload"
subnet_id = azurerm_subnet.server_subnet.id
private_ip_address_allocation = "Dynamic"
}
}
ip_configuration {
name = "ipconfig-jump"
subnet_id = azurerm_subnet.jump_subnet.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id = azurerm_public_ip.vm_jump_pip.id
}
}
resource "azurerm_network_interface_security_group_association"
"vm_server_nsg_association" {
network_interface_id =
azurerm_network_interface.vm_server_nic.id
network_security_group_id =
azurerm_network_security_group.vm_server_nsg.id
}
resource "azurerm_network_interface_security_group_association"
"vm_jump_nsg_association" {
network_interface_id = azurerm_network_interface.vm_jump_nic.id
network_security_group_id =
azurerm_network_security_group.vm_jump_nsg.id
}
resource "azurerm_subnet_route_table_association"
"jump_subnet_rt_association" {
subnet_id = azurerm_subnet.server_subnet.id
route_table_id = azurerm_route_table.rt.id
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix for the Resource Group Name that's combined
with a random id so name is unique in your Azure subcription."
default = "rg"
}
variable "firewall_sku_tier" {
type = string
description = "Firewall SKU."
default = "Premium" # Valid values are Standard and Premium
validation {
condition = contains(["Standard", "Premium"],
var.firewall_sku_tier)
error_message = "The SKU must be one of the following: Standard,
Premium"
}
}
variable "virtual_machine_size" {
type = string
description = "Size of the virtual machine."
default = "Standard_D2_v3"
}
variable "admin_username" {
type = string
description = "Value of the admin username."
default = "azureuser"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "firewall_name" {
value = azurerm_firewall.fw.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Tutorial: Deploy and configure Azure Firewall in a hybrid network using the Azure
portal
Quickstart: Create an Azure Firewall with
multiple public IP addresses - Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
In this quickstart, you use Terraform to deploy an Azure Firewall with multiple public IP
addresses from a public IP address prefix. The deployed firewall has NAT rule collection
rules that allow RDP connections to two Windows Server 2019 virtual machines.
For more information about Azure Firewall with multiple public IP addresses, see Deploy
an Azure Firewall with multiple public IP addresses using Azure PowerShell.
Create a random value (to be used in the resource group name) using
random_pet
Create a random password for the Windows VM using random_password
Create an Azure resource group using azurerm_resource_group
Create an Azure public IP prefix using azurerm_public_ip_prefix
Create an Azure public IP using azurerm_public_ip
Create an Azure Virtual Network using azurerm_virtual_network
Create an Azure subnet using azurerm_subnet
Create a network interface using azurerm_network_interface
Create a network security group (to contain a list of network security rules)
using azurerm_network_security_group
Create an association between a Network Interface and a Network Security
Group using azurerm_network_interface_security_group_association
Create an Windows Virtual Machine using azurerm_windows_virtual_machine
Create an Azure Firewall Policy using azurerm_firewall_policy
Create an Azure Firewall Policy Rule Collection Group using
azurerm_firewall_policy_rule_collection_group
Create an Azure Firewall using azurerm_firewall
Create a route table using azurerm_route_table
Create an association between the route table and the subnet using -
azurerm_subnet_route_table_association
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {
virtual_machine {
delete_os_disk_on_deletion = true
skip_shutdown_and_force_delete = true
}
}
}
Terraform
ip_configuration {
name = "ipconfig-backend-${count.index +
1}"
subnet_id = azurerm_subnet.backend_subnet.id
private_ip_address_allocation = "Dynamic"
}
}
resource "azurerm_network_interface_security_group_association"
"vm_backend_nsg_association" {
count = 2
network_interface_id =
azurerm_network_interface.backend_nic[count.index].id
network_security_group_id =
azurerm_network_security_group.backend_nsg.id
}
resource "azurerm_firewall_policy_rule_collection_group"
"policy_rule_collection_group" {
name = "RuleCollectionGroup"
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
priority = 300
application_rule_collection {
name = "web"
priority = 100
action = "Allow"
rule {
name = "wan-address"
protocols {
type = "Http"
port = 80
}
protocols {
type = "Https"
port = 443
}
destination_fqdns = ["getmywanip.com"]
source_addresses = ["*"]
}
rule {
name = "google"
protocols {
type = "Http"
port = 80
}
protocols {
type = "Https"
port = 443
}
destination_fqdns = ["www.google.com"]
source_addresses = ["10.10.1.0/24"]
}
rule {
name = "wupdate"
protocols {
type = "Http"
port = 80
}
protocols {
type = "Https"
port = 443
}
destination_fqdn_tags = ["WindowsUpdate"]
source_addresses = ["*"]
}
}
nat_rule_collection {
name = "Coll-01"
action = "Dnat"
priority = 200
rule {
name = "rdp-01"
protocols = ["TCP"]
translated_address = "10.10.1.4"
translated_port = "3389"
source_addresses = ["*"]
destination_address = azurerm_public_ip.pip_azfw.ip_address
destination_ports = ["3389"]
}
rule {
name = "rdp-02"
protocols = ["TCP"]
translated_address = "10.10.1.5"
translated_port = "3389"
source_addresses = ["*"]
destination_address = azurerm_public_ip.pip_azfw.ip_address
destination_ports = ["3389"]
}
}
}
resource "azurerm_firewall" "fw" {
name = "azfw"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku_name = "AZFW_VNet"
sku_tier = var.firewall_sku_tier
ip_configuration {
name = "azfw-ipconfig"
subnet_id = azurerm_subnet.azfw_subnet.id
public_ip_address_id = azurerm_public_ip.pip_azfw.id
}
ip_configuration {
name = "azfw-ipconfig-2"
public_ip_address_id = azurerm_public_ip.pip_azfw_2.id
}
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
}
resource "azurerm_subnet_route_table_association"
"jump_subnet_rt_association" {
subnet_id = azurerm_subnet.backend_subnet.id
route_table_id = azurerm_route_table.rt.id
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix for the Resource Group Name that's combined
with a random id so name is unique in your Azure subcription."
default = "rg"
}
variable "firewall_sku_tier" {
type = string
description = "Firewall SKU."
default = "Premium" # Valid values are Standard and Premium
validation {
condition = contains(["Standard", "Premium"],
var.firewall_sku_tier)
error_message = "The SKU must be one of the following: Standard,
Premium"
}
}
variable "virtual_machine_size" {
type = string
description = "Size of the virtual machine."
default = "Standard_D2_v3"
}
variable "admin_username" {
type = string
description = "Value of the admin username."
default = "azureuser"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "backend_admin_password" {
sensitive = true
value =
azurerm_windows_virtual_machine.vm_backend[*].admin_password
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Tutorial: Deploy and configure Azure Firewall in a hybrid network using the Azure
portal
Quickstart: Deploy Azure Firewall with
Availability Zones - Terraform
Article • 10/18/2023
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
In this quickstart, you use Terraform to deploy an Azure Firewall in three Availability
Zones.
The Terraform configuration creates a test network environment with a firewall. The
network has one virtual network (VNet) with three subnets: AzureFirewallSubnet, subnet-
server, and subnet-jump. The subnet-server and subnet-jump subnet each have a single
two-core Windows Server virtual machine.
The firewall is in the AzureFirewallSubnet subnet and has an application rule collection
with a single rule that allows access to www.microsoft.com .
A user-defined route points network traffic from the subnet-server subnet through the
firewall where the firewall rules are applied.
For more information about Azure Firewall, see Deploy and configure Azure Firewall
using the Azure portal.
" Create a random value (to be used in the resource group name) using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create an Azure Virtual Network using azurerm_virtual_network
" Create three Azure subnets using azurerm_subnet
" Create an Azure public IP using azurerm_public_ip
" Create an Azure Firewall Policy using azurerm_firewall_policy
" Create an Azure Firewall Policy Rule Collection Group using
azurerm_firewall_policy_rule_collection_group
" Create an Azure Firewall using azurerm_firewall
" Create a network interface using azurerm_network_interface
" Create a network security group (to contain a list of network security rules) using
azurerm_network_security_group
" Create an association between the network interface and the network security
group using - azurerm_network_interface_security_group_association
" Create a route table using azurerm_route_table
" Create an association between the route table and the subnet using -
azurerm_subnet_route_table_association
" Create a random value (to be used as the storage name) using random_string
" Create a storage account using azurerm_storage_account
" Create a random password for the Windows VM using random_password
" Create an Azure Windows Virtual Machine using azurerm_windows_virtual_machine
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
ip_configuration {
name = "ipconfig-workload"
subnet_id = azurerm_subnet.server_subnet.id
private_ip_address_allocation = "Dynamic"
}
}
ip_configuration {
name = "ipconfig-jump"
subnet_id = azurerm_subnet.jump_subnet.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id = azurerm_public_ip.vm_jump_pip.id
}
}
resource "azurerm_network_interface_security_group_association"
"vm_server_nsg_association" {
network_interface_id =
azurerm_network_interface.vm_server_nic.id
network_security_group_id =
azurerm_network_security_group.vm_server_nsg.id
}
resource "azurerm_network_interface_security_group_association"
"vm_jump_nsg_association" {
network_interface_id = azurerm_network_interface.vm_jump_nic.id
network_security_group_id =
azurerm_network_security_group.vm_jump_nsg.id
}
resource "azurerm_subnet_route_table_association"
"jump_subnet_rt_association" {
subnet_id = azurerm_subnet.server_subnet.id
route_table_id = azurerm_route_table.rt.id
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix for the Resource Group Name that's combined
with a random id so name is unique in your Azure subcription."
default = "rg"
}
variable "firewall_sku_tier" {
type = string
description = "Firewall SKU."
default = "Premium" # Valid values are Standard and Premium
validation {
condition = contains(["Standard", "Premium"],
var.firewall_sku_tier)
error_message = "The SKU must be one of the following: Standard,
Premium"
}
}
variable "virtual_machine_size" {
type = string
description = "Size of the virtual machine."
default = "Standard_D2_v3"
}
variable "admin_username" {
type = string
description = "Value of the admin username."
default = "azureuser"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "firewall_name" {
value = azurerm_firewall.fw.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
) Important
Azure Front Door (classic) will be retired on March 31, 2027. To avoid any service
disruption, it is important that you migrate your Azure Front Door (classic) profiles
to Azure Front Door Standard or Premium tier by March 2027. For more
information, see Azure Front Door (classic) retirement .
This quickstart describes how to use Terraform to create a Front Door (classic) profile to
set up high availability for a web endpoint.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the Front Door endpoint host name using random_id .
" Create a Front Door (classic) resource using - azurerm_frontdoor .
Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
locals {
front_door_name =
"afd-${lower(random_id.front_door_name.hex)}"
front_door_frontend_endpoint_name = "frontEndEndpoint"
front_door_load_balancing_settings_name = "loadBalancingSettings"
front_door_health_probe_settings_name = "healthProbeSettings"
front_door_routing_rule_name = "routingRule"
front_door_backend_pool_name = "backendPool"
}
frontend_endpoint {
name = local.front_door_frontend_endpoint_name
host_name = "${local.front_door_name}.azurefd.net"
session_affinity_enabled = false
}
backend_pool_load_balancing {
name =
local.front_door_load_balancing_settings_name
sample_size = 4
successful_samples_required = 2
}
backend_pool_health_probe {
name = local.front_door_health_probe_settings_name
path = "/"
protocol = "Http"
interval_in_seconds = 120
}
backend_pool {
name = local.front_door_backend_pool_name
backend {
host_header = var.backend_address
address = var.backend_address
http_port = 80
https_port = 443
weight = 50
priority = 1
}
load_balancing_name = local.front_door_load_balancing_settings_name
health_probe_name = local.front_door_health_probe_settings_name
}
backend_pool_settings {
backend_pools_send_receive_timeout_seconds = 0
enforce_backend_pools_certificate_name_check = false
}
routing_rule {
name = local.front_door_routing_rule_name
accepted_protocols = ["Http", "Https"]
patterns_to_match = ["/*"]
frontend_endpoints = [local.front_door_frontend_endpoint_name]
forwarding_configuration {
forwarding_protocol = "MatchRequest"
backend_pool_name = local.front_door_backend_pool_name
}
}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "backend_address" {
type = string
description = "Backend address."
default = "www.bing.com"
}
5. Create a file named outputs.tf and insert the following code, being sure to
update the value to your own backend hostname:
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "frontDoorEndpointHostName" {
value = azurerm_frontdoor.main.frontend_endpoint[0].host_name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
terraform init -upgrade
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Overview of Azure Front Door
Quickstart: Create an Azure Front Door
Standard/Premium profile using
Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This quickstart describes how to use Terraform to create a Front Door profile to set up
high availability for a web endpoint.
7 Note
For web workloads, we highly recommend utilizing Azure DDoS protection and a
web application firewall to safeguard against emerging DDoS attacks. Another
option is to employ Azure Front Door along with a web application firewall. Azure
Front Door offers platform-level protection against network-level DDoS attacks.
For more information, see security baseline for Azure services.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the Front Door endpoint resource name and App Service
app name using random_id .
" Create a Front Door profile using azurerm_cdn_frontdoor_profile .
" Create a Front Door endpoint using azurerm_cdn_frontdoor_endpoint .
" Create a Front Door origin group using azurerm_cdn_frontdoor_origin_group
" Create a Front Door origin, which refers to the App Service app, using
azurerm_cdn_frontdoor_origin .
" Create a Front Door route using azurerm_cdn_frontdoor_route .
" Create an App Service plan using azurerm_service_plan .
" Create an App Service app using azurerm_windows_web_app .
Prerequisites
Install and configure Terraform
Implement the Terraform code
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
locals {
front_door_profile_name = "MyFrontDoor"
front_door_endpoint_name =
"afd-${lower(random_id.front_door_endpoint_name.hex)}"
front_door_origin_group_name = "MyOriginGroup"
front_door_origin_name = "MyAppServiceOrigin"
front_door_route_name = "MyRoute"
}
load_balancing {
sample_size = 4
successful_samples_required = 3
}
health_probe {
path = "/"
request_type = "HEAD"
protocol = "Https"
interval_in_seconds = 100
}
}
enabled = true
host_name =
azurerm_windows_web_app.app.default_hostname
http_port = 80
https_port = 443
origin_host_header =
azurerm_windows_web_app.app.default_hostname
priority = 1
weight = 1000
certificate_name_check_enabled = true
}
Terraform
locals {
app_name = "myapp-${lower(random_id.app_name.hex)}"
app_service_plan_name = "AppServicePlan"
}
sku_name = var.app_service_plan_sku_name
os_type = "Windows"
worker_count = var.app_service_plan_capacity
}
https_only = true
site_config {
ftps_state = "Disabled"
minimum_tls_version = "1.2"
ip_restriction {
service_tag = "AzureFrontDoor.Backend"
ip_address = null
virtual_network_subnet_id = null
action = "Allow"
priority = 100
headers {
x_azure_fdid =
[azurerm_cdn_frontdoor_profile.my_front_door.resource_guid]
x_fd_health_probe = []
x_forwarded_for = []
x_forwarded_host = []
}
name = "Allow traffic from Front Door"
}
}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "app_service_plan_sku_name" {
type = string
description = "The SKU for the plan. Possible values include: B1, B2,
B3, D1, F1, I1, I2, I3, I1v2, I2v2, I3v2, I4v2, I5v2, I6v2, P1v2, P2v2,
P3v2, P0v3, P1v3, P2v3, P3v3, P1mv3, P2mv3, P3mv3, P4mv3, P5mv3, S1,
S2, S3, SHARED, EP1, EP2, EP3, WS1, WS2, WS3, Y1."
default = "S1"
validation {
condition = contains(["B1", "B2", "B3", "D1", "F1", "I1", "I2",
"I3", "I1v2", "I2v2", "I3v2", "I4v2", "I5v2", "I6v2", "P1v2", "P2v2",
"P3v2", "P0v3", "P1v3", "P2v3", "P3v3", "P1mv3", "P2mv3", "P3mv3",
"P4mv3", "P5mv3", "S1", "S2", "S3", "SHARED", "EP1", "EP2", "EP3",
"WS1", "WS2", "WS3", "Y1"], var.app_service_plan_sku_name)
error_message = "The SKU value must be one of the following: B1,
B2, B3, D1, F1, I1, I2, I3, I1v2, I2v2, I3v2, I4v2, I5v2, I6v2, P1v2,
P2v2, P3v2, P0v3, P1v3, P2v3, P3v3, P1mv3, P2mv3, P3mv3, P4mv3, P5mv3,
S1, S2, S3, SHARED, EP1, EP2, EP3, WS1, WS2, WS3, Y1."
}
}
variable "app_service_plan_capacity" {
type = number
description = "The number of Workers (instances) to be allocated."
default = 1
}
variable "front_door_sku_name" {
type = string
description = "The SKU for the Front Door profile. Possible values
include: Standard_AzureFrontDoor, Premium_AzureFrontDoor"
default = "Standard_AzureFrontDoor"
validation {
condition = contains(["Standard_AzureFrontDoor",
"Premium_AzureFrontDoor"], var.front_door_sku_name)
error_message = "The SKU value must be one of the following:
Standard_AzureFrontDoor, Premium_AzureFrontDoor."
}
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "frontDoorEndpointHostName" {
value = azurerm_cdn_frontdoor_endpoint.my_endpoint.host_name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Overview of Azure Front Door
Quickstart: Create an Azure key vault
and key using Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
Azure Key Vault is a cloud service that provides a secure store for secrets, such as keys,
passwords, and certificate. This article focuses on the process of deploying a Terraform
file to create a key vault and a key.
" Create a random value for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random value using random_string
" Create an Azure key vault using azurerm_key_vault
" Create an Azure key vault key using azurerm_key_vault_key
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
access_policy {
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = local.current_user_id
key_permissions = var.key_permissions
secret_permissions = var.secret_permissions
}
}
key_vault_id = azurerm_key_vault.vault.id
key_type = var.key_type
key_size = var.key_size
key_opts = var.key_ops
rotation_policy {
automatic {
time_before_expiry = "P30D"
}
expire_after = "P90D"
notify_before_expiry = "P29D"
}
}
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "vault_name" {
type = string
description = "The name of the key vault to be created. The value
will be randomly generated if blank."
default = ""
}
variable "key_name" {
type = string
description = "The name of the key to be created. The value will be
randomly generated if blank."
default = ""
}
variable "sku_name" {
type = string
description = "The SKU of the vault to be created."
default = "standard"
validation {
condition = contains(["standard", "premium"], var.sku_name)
error_message = "The sku_name must be one of the following:
standard, premium."
}
}
variable "key_permissions" {
type = list(string)
description = "List of key permissions."
default = ["List", "Create", "Delete", "Get", "Purge", "Recover",
"Update", "GetRotationPolicy", "SetRotationPolicy"]
}
variable "secret_permissions" {
type = list(string)
description = "List of secret permissions."
default = ["Set"]
}
variable "key_type" {
description = "The JsonWebKeyType of the key to be created."
default = "RSA"
type = string
validation {
condition = contains(["EC", "EC-HSM", "RSA", "RSA-HSM"],
var.key_type)
error_message = "The key_type must be one of the following: EC, EC-
HSM, RSA, RSA-HSM."
}
}
variable "key_ops" {
type = list(string)
description = "The permitted JSON web key operations of the key to be
created."
default = ["decrypt", "encrypt", "sign", "unwrapKey", "verify",
"wrapKey"]
}
variable "key_size" {
type = number
description = "The size in bits of the key to be created."
default = 2048
}
variable "msi_id" {
type = string
description = "The Managed Service Identity ID. If this value isn't
null (the default), 'data.azurerm_client_config.current.object_id' will
be set to this value."
default = null
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "azurerm_key_vault_name" {
value = azurerm_key_vault.vault.name
}
output "azurerm_key_vault_id" {
value = azurerm_key_vault.vault.id
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
2. Run az keyvault key list to display information about the key vault's keys.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Key Vault security overview
Create an Azure Managed Lustre file
system using Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
In this article, you use Terraform to create an Azure Managed Lustre file system.
" Create a random value (to be used in the resource group name) using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create an Azure Virtual Network using azurerm_virtual_network
" Create an Azure subnet using azurerm_subnet
" Create a random value (to be used as the Managed Lustre file system name) using
random_string
" Create a Managed Lustre file system using azurerm_managed_lustre_file_system
7 Note
The code example in this article uses the random_pet and random_string
resources to generate unique values for the resource group name and the
Managed Lustre file system name. You can replace these values with your own
resource names in the variables.tf and main.tf files.
Prerequisites
Install and configure Terraform
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
Terraform
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location of the resource group."
}
variable "virtual_network_name" {
type = string
description = "The name of the virtual network resource. The value
will be randomly generated if blank."
default = ""
}
variable "subnet_name" {
type = string
description = "The name of the virtual network subnet. The value will
be randomly generated if blank."
default = ""
}
variable "amlfs_name" {
type = string
description = "The name of the Manage Lustre file system resource.
The value will be randomly generated if blank."
default = ""
}
variable "amlfs_sku_name" {
type = string
default = "AMLFS-Durable-Premium-40"
validation {
condition = contains(["AMLFS-Durable-Premium-40", "AMLFS-
Durable-Premium-125", "AMLFS-Durable-Premium-250", "AMLFS-Durable-
Premium-500"], var.amlfs_sku_name)
error_message = "The SKU value must be one of the following: AMLFS-
Durable-Premium-40, AMLFS-Durable-Premium-125, AMLFS-Durable-Premium-
250, AMLFS-Durable-Premium-500."
}
description = "SKU name for the Azure Managed Lustre file system."
}
variable "amlfs_storage_capacity_in_tb" {
type = number
default = 48
description = "The size of the Managed Lustre file system, in TiB.
This might be rounded up."
}
variable "amlfs_maintenance_day_of_week" {
type = string
default = "Saturday"
validation {
condition = contains(["Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday"],
var.amlfs_maintenance_day_of_week)
error_message = "The maintenance day of week value must be one of
the following: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday,
Saturday."
}
description = "Day of the week on which the maintenance window will
occur."
}
variable "amlfs_maintenance_time_of_day" {
type = string
default = "02:00"
description = "The time of day (in UTC) to start the maintenance
window."
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "virtual_network_name" {
value = azurerm_virtual_network.example.name
}
output "subnet_name" {
value = azurerm_subnet.example.name
}
output "managed_lustre_file_system_name" {
value = azurerm_managed_lustre_file_system.example.name
}
output "amlfs_sku_name" {
value = azurerm_managed_lustre_file_system.example.sku_name
}
output "amlfs_storage_capacity_in_tb" {
value =
azurerm_managed_lustre_file_system.example.storage_capacity_in_tb
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
terraform apply main.tfplan
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
3. Run az amlfs show to display the Managed Lustre file system name.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
1. Run terraform plan and specify the destroy flag.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Next, you can explore more about Azure Managed Lustre.
Feedback
Was this page helpful? Yes No
Quickstart: Deploy a static website on
Azure Storage using Terraform
Article • 11/17/2023
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
In this quickstart, you learn how to deploy an Azure Storage account with static
website hosting enabled.
" Create a random value (to be used in the resource group name) using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random value (to be used in the storage acccount name) using
random_string
" Create a storage account with a static website using azurerm_storage_account
" Create a storage account blob in the using azurerm_storage_blob
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test the sample Terraform code and make it the
current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
name = random_string.storage_account_name.result
account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"
static_website {
index_document = "index.html"
}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location of the resource group."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "storage_account_name" {
value = azurerm_storage_account.storage_account.name
}
output "primary_web_host" {
value = azurerm_storage_account.storage_account.primary_web_host
}
HTML
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
2. Open a browser and enter the URL in your browser's address bar.
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Introduction to Azure Blob Storage
Quickstart: Create an Azure API
Management instance using Terraform
Article • 03/21/2024
This article shows how to use Terraform to create an API Management instance on
Azure. You can also use Terraform for common management tasks such as importing
APIs in your API Management instance.
Azure API Management helps organizations publish APIs to external, partner, and
internal developers to unlock the potential of their data and services. API Management
provides the core competencies to ensure a successful API program through developer
engagement, business insights, analytics, security, and protection. With API
Management, create and manage modern API gateways for existing backend services
hosted anywhere.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string for the Azure API Management service name using
random_string
" Create an Azure API Management service using azurerm_api_management
Prerequisites
If you don't have an Azure subscription, create a free account before you begin.
If you prefer to run CLI reference commands locally, install the Azure CLI. If
you're running on Windows or macOS, consider running Azure CLI in a Docker
container. For more information, see How to run the Azure CLI in a Docker
container.
If you're using a local installation, sign in to the Azure CLI by using the az
login command. To finish the authentication process, follow the steps
displayed in your terminal. For other sign-in options, see Sign in with the
Azure CLI.
When you're prompted, install the Azure CLI extension on first use. For more
information about extensions, see Use extensions with the Azure CLI.
Run az version to find the version and dependent libraries that are installed.
To upgrade to the latest version, run az upgrade.
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
2. Create a file named main.tf and insert the following code:
Terraform
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "api_management_service_name" {
value = azurerm_api_management.api.name
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
}
variable "publisher_email" {
default = "[email protected]"
description = "The email address of the owner of the service"
type = string
validation {
condition = length(var.publisher_email) > 0
error_message = "The publisher_email must contain at least one
character."
}
}
variable "publisher_name" {
default = "publisher"
description = "The name of the owner of the service"
type = string
validation {
condition = length(var.publisher_name) > 0
error_message = "The publisher_name must contain at least one
character."
}
}
variable "sku" {
description = "The pricing tier of this API Management service"
default = "Developer"
type = string
validation {
condition = contains(["Developer", "Standard", "Premium"],
var.sku)
error_message = "The sku must be one of the following: Developer,
Standard, Premium."
}
}
variable "sku_count" {
description = "The instance size of this API Management service."
default = 1
type = number
validation {
condition = contains([1, 2], var.sku_count)
error_message = "The sku_count must be one of the following: 1, 2."
}
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
api_management_service_name=$(terraform output -raw
api_management_service_name)
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
) Note: The author created this article with assistance from AI. Learn more
Feedback
Was this page helpful? Yes No
This article shows how to use Terraform to create an Azure AI Search service using
Terraform.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string using random_string
" Create an Azure AI Search service using azurerm_search_service
Prerequisites
Install and configure Terraform
7 Note
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "azurerm_search_service_name" {
value = azurerm_search_service.search.name
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "sku" {
description = "The pricing tier of the search service you want to
create (for example, basic or standard)."
default = "standard"
type = string
validation {
condition = contains(["free", "basic", "standard", "standard2",
"standard3", "storage_optimized_l1", "storage_optimized_l2"], var.sku)
error_message = "The sku must be one of the following values: free,
basic, standard, standard2, standard3, storage_optimized_l1,
storage_optimized_l2."
}
}
variable "replica_count" {
type = number
description = "Replicas distribute search workloads across the
service. You need at least two replicas to support high availability of
query workloads (not applicable to the free tier)."
default = 1
validation {
condition = var.replica_count >= 1 && var.replica_count <= 12
error_message = "The replica_count must be between 1 and 12."
}
}
variable "partition_count" {
type = number
description = "Partitions allow for scaling of document count as well
as faster indexing by sharding your index over multiple search units."
default = 1
validation {
condition = contains([1, 2, 3, 4, 6, 12], var.partition_count)
error_message = "The partition_count must be one of the following
values: 1, 2, 3, 4, 6, 12."
}
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
3. Run az search service show to show the Azure AI Search service you created in this
article.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Create an Azure AI Search index using the Azure portal
Quickstart: Provision Azure Spring Apps
using Terraform
Article • 04/23/2024
7 Note
Azure Spring Apps is the new name for the Azure Spring Cloud service. Although
the service has a new name, you'll see the old name in some places for a while as
we work to update assets such as screenshots, videos, and diagrams.
This quickstart describes how to use Terraform to deploy an Azure Spring Apps cluster
into an existing virtual network.
Azure Spring Apps makes it easy to deploy Spring applications to Azure without any
code changes. The service manages the infrastructure of Spring applications so
developers can focus on their code. Azure Spring Apps provides lifecycle management
using comprehensive monitoring and diagnostics, configuration management, service
discovery, CI/CD integration, blue-green deployments, and more.
Build Service
Application Configuration Service
Service Registry
Spring Cloud Gateway
API Portal
The API Portal component will be included when it becomes available through the
AzureRM Terraform provider.
For more customization including custom domain support, see the Azure Spring Apps
Terraform provider documentation.
Prerequisites
An Azure subscription. If you don't have a subscription, create a free account
before you begin.
Hashicorp Terraform
Two dedicated subnets for the Azure Spring Apps cluster, one for the service
runtime and another for the Spring applications. For subnet and virtual network
requirements, see the Virtual network requirements section of Deploy Azure Spring
Apps in a virtual network.
An existing Log Analytics workspace for Azure Spring Apps diagnostics settings
and a workspace-based Application Insights resource. For more information, see
Analyze logs and metrics with diagnostics settings and Application Insights Java In-
Process Agent in Azure Spring Apps.
Three internal Classless Inter-Domain Routing (CIDR) ranges (at least /16 each) that
you've identified for use by the Azure Spring Apps cluster. These CIDR ranges
won't be directly routable and will be used only internally by the Azure Spring
Apps cluster. Clusters may not use 169.254.0.0/16, 172.30.0.0/16, 172.31.0.0/16, or
192.0.2.0/24 for the internal Azure Spring Apps CIDR. Clusters also may not use
any IP ranges included within the cluster virtual network address range.
Service permission granted to the virtual network. The Azure Spring Apps Resource
Provider requires Owner permission to your virtual network in order to grant a
dedicated and dynamic service principal on the virtual network for further
deployment and maintenance. For instructions and more information, see the
Grant service permission to the virtual network section of Deploy Azure Spring
Apps in a virtual network.
If you're using Azure Firewall or a Network Virtual Appliance (NVA), you'll also
need to satisfy the following prerequisites:
Network and fully qualified domain name (FQDN) rules. For more information,
see Virtual network requirements.
A unique User Defined Route (UDR) applied to each of the service runtime and
Spring application subnets. For more information about UDRs, see Virtual
network traffic routing. The UDR should be configured with a route for 0.0.0.0/0
with a destination of your NVA before deploying the Azure Spring Apps cluster.
For more information, see the Bring your own route table section of Deploy
Azure Spring Apps in a virtual network.
If you're deploying an Azure Spring Apps Enterprise plan instance for the first time
in the target subscription, see the Requirements section of Enterprise plan in Azure
Marketplace.
Enterprise plan
HashiCorp Configuration Language
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "= 3.21.1"
}
}
}
provider "azurerm" {
features {}
}
depends_on = [azurerm_resource_group.sc_corp_rg]
}
network {
app_subnet_id =
"/subscriptions/${var.subscription}/resourceGroups/${var.azurespringclou
dvnetrg}/providers/Microsoft.Network/virtualNetworks/${var.vnet_spoke_na
me}/subnets/${var.app_subnet_id}"
service_runtime_subnet_id =
"/subscriptions/${var.subscription}/resourceGroups/${var.azurespringclou
dvnetrg}/providers/Microsoft.Network/virtualNetworks/${var.vnet_spoke_na
me}/subnets/${var.service_runtime_subnet_id}"
cidr_ranges = var.sc_cidr
}
timeouts {
create = "60m"
delete = "2h"
}
depends_on = [azurerm_resource_group.sc_corp_rg]
tags = var.tags
log {
category = "ApplicationConsole"
enabled = true
retention_policy {
enabled = false
}
}
metric {
category = "AllMetrics"
retention_policy {
enabled = false
}
}
}
secrets = {
connection-string =
azurerm_application_insights.sc_app_insights.connection_string
}
}
}
# Configuration service
resource "azurerm_spring_cloud_configuration_service" "configservice" {
name = "default"
spring_cloud_service_id = azurerm_spring_cloud_service.sc.id
}
# Gateway
resource "azurerm_spring_cloud_gateway" "scgateway" {
name = "default"
spring_cloud_service_id = azurerm_spring_cloud_service.sc.id
instance_count = 2
}
1. Save the variables.tf file for the Standard plan or the Enterprise plan locally,
then open it in an editor.
Azure CLI
The name of the resource group where the existing virtual network resides.
The name of the existing scope virtual network.
The name of the existing subnet to be used by the Azure Spring Apps
Application Service.
The name of the existing subnet to be used by the Azure Spring Apps
Runtime Service.
The name of the Azure Log Analytics workspace.
Bash
terraform init
Bash
Bash
Clean up resources
If you plan to continue working with subsequent quickstarts and tutorials, you might
want to leave these resources in place. When no longer needed, delete the resources
created in this article by using the following command.
Bash
Next steps
In this quickstart, you deployed an Azure Spring Apps instance into an existing virtual
network using Terraform, and then validated the deployment. To learn more about Azure
Spring Apps, continue on to the resources below.
Deploy one of the following sample applications from the locations below:
Pet Clinic App with MySQL Integration
Simple Hello World
Use custom domains with Azure Spring Apps.
Expose applications in Azure Spring Apps to the internet using Azure Application
Gateway. For more information, see Expose applications with end-to-end TLS in a
virtual network.
View the secure end-to-end Azure Spring Apps reference architecture, which is
based on the Microsoft Azure Well-Architected Framework.
Quickstart: Create an Azure CDN profile
and endpoint using Terraform
Article • 03/21/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This article shows how to use Terraform to create an Azure CDN profile and endpoint
using Terraform.
" Create a random pet name for the Azure resource group name using random_pet
" Create an Azure resource group using azurerm_resource_group
" Create a random string for the CDN endpoint name using random_string
" Create an Azure CDN profile using azurerm_cdn_profile
" Create an Azure CDN endpoint using azurerm_cdn_endpoint
Prerequisites
Install and configure Terraform
7 Note
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
origin {
name = "origin1"
host_name = var.origin_url
}
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "cdn_profile_name" {
value = azurerm_cdn_profile.profile.name
}
output "cdn_endpoint_endpoint_name" {
value = azurerm_cdn_endpoint.endpoint.name
}
output "cdn_endpoint_fqdn" {
value = azurerm_cdn_endpoint.endpoint.fqdn
}
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "resource_group_location" {
type = string
description = "Location for all resources."
default = "eastus"
}
variable "resource_group_name_prefix" {
type = string
description = "Prefix of the resource group name that's combined with
a random ID so name is unique in your Azure subscription."
default = "rg"
}
variable "origin_url" {
type = string
description = "Url of the origin."
default = "www.contoso.com"
}
variable "cdn_sku" {
type = string
description = "CDN SKU names."
default = "Standard_Microsoft"
validation {
condition = contains(["Standard_Akamai", "Standard_Microsoft",
"Standard_Verizon", "Premium_Verizon"], var.cdn_sku)
error_message = "The cdn_sku must be one of the following:
Standard_Akamai, Standard_Microsoft, Standard_Verizon,
Premium_Verizon."
}
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
1. Get the Azure resource group name in which the Azure CDN profile and
endpoint were created.
Console
Console
cdn_profile_name=$(terraform output -raw cdn_profile_name)
Console
4. Run az cdn custom-domain show to show details of the custom domain you
created in this article.
Azure CLI
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Next steps
Tutorial: Use CDN to serve static content from a web app
Quickstart: Create an Azure notification
hub using Terraform
Article • 02/23/2024
) AI-assisted content. This article was partially created with the help of AI. An author reviewed and
revised the content as needed. Learn more
This article uses Terraform to create an Azure Notification Hubs namespace and a
notification hub. The name of each resource is randomly generated to avoid naming
conflicts.
Azure Notification Hubs provides an easy-to-use and scaled-out push engine that
enables you to send notifications to any platform (iOS, Android, Windows, Kindle, etc.)
from any backend (cloud or on-premises). For more information about the service, see
What is Azure Notification Hubs.
" Create a random value for the Azure resource group name using random_pet .
" Create an Azure resource group using azurerm_resource_group .
" Create a random value for the Azure Notification Hub namespace name using
random_string .
" Create an Azure Notification Hub namespace using
azurerm_notification_hub_namespace .
" Create a random value for the Azure Notification Hub name using random_string .
" Create an Azure Notification Hub using azurerm_notification_hub .
Prerequisites
Install and configure Terraform
The sample code for this article is located in the Azure Terraform GitHub repo .
You can view the log file containing the test results from current and previous
versions of Terraform .
See more articles and sample code showing how to use Terraform to manage
Azure resources
1. Create a directory in which to test and run the sample Terraform code and make it
the current directory.
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
Terraform
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location for all resources."
}
variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with
a random value so name is unique in your Azure subscription."
}
Terraform
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "notification_hub_namespace_name" {
value = azurerm_notification_hub_namespace.namespace.name
}
output "notification_hub__name" {
value = azurerm_notification_hub.hub.name
}
Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Console
Console
3. Run az notification-hub list to display the hubs for the specified namespace.
Azure CLI
az notification-hub list \
--resource-group $resource_group_name \
--namespace-name $notification_hub_namespace_name
Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Next steps
Set up push notifications in Azure Notification Hubs
Testing Terraform code
Article • 05/27/2022
Terraform is an Infrastructure as Code (IaC) tool. This category of tool refers to the fact
that you treat your Terraform files as you would the project's source code. Part of that
process includes versioning and source code control. Also, testing should also be a part
of your process. This article gives an overview of the different types of tests that can be
run against a Terraform project.
Unit testing can be especially beneficial when your Terraform modules start to become
more complex:
Generate dynamic blocks
Use loops
Calculate local variables
As with integration tests, many times unit tests are included in the continuous
integration process.
E2E testing is typically a three-step process. First, the configuration is applied to a test
environment. Code would then be run to verify the results. Finally, the test environment
is either reinitialized or taken down (such as deallocating a virtual machine).
Integration features
To achieve scale, DevOps teams are always looking for ways to quickly deploy code
with a trusted and repeatable process. When it comes to the cloud and
infrastructure, this process is increasingly accomplished with infrastructure-as-code
(IaC). IaC tools range from general-purpose tools to tools intended for specific
environments. Terraform is an example of the former, while Bicep is designed to
handle Azure-related tasks.
In this article, we compare nine infrastructure and integration features of Bicep and
Terraform. Understanding these differences helps you decide which tool best
supports your infrastructure and processes.
secure your state files. Like Terraform, Bicep is declarative and goal-seeking.
However, Bicep doesn't store state. Instead, Bicep relies on incremental
deployment.
Infrastructure targets
When comparing Bicep to Terraform for managing cloud infrastructure, it's
important to consider your target cloud environment:
Azure-only
Multi or hybrid-clouds
Bicep is Azure-specific and not designed to work with other cloud services.
Terraform interacts with other cloud providers or APIs using plugins called providers.
There are several Terraform Azure providers that enable the management of Azure
infrastructure. When coding a Terraform configuration, you specify the required
providers you're using. When you run terraform init , the specified provider is
installed and usable from your code.
CLI tools
Command Line Interface (CLI) tools play a key role in orchestration through the
implementation and management of automation technology. Both Bicep and
Terraform offer CLI tools.
Bicep integrates with Azure CLI, allowing developers to use az commands such as:
The Terraform CLI allows you to perform such tasks as validate and format your
Terraform code, and create and apply an execution plan.
The article Quickstart: Create an Azure resource group using Terraform shows
you how to use several of the Terraform commands to create an Azure
resource group.
Bicep also provides a feature that makes it easy to integrate Bicep with Azure
Pipelines. There's a similar feature available for Terraform but you must download
and install the Azure Pipelines Terraform Tasks extension for Visual Studio . Once
installed, you can run Terraform CLI commands from Azure Pipelines. Moreover,
both Terraform and Bicep support GitHub Actions to automate software builds,
tests, and deployments.
Processing
There are some important differences between Bicep and Terraform in terms of the
efficiency and optimizations of deployments. With Bicep, processing occurs within
the core Azure infrastructure service side. This feature offers advantages such as
preflight processing to check policy or the availability for deploying multiple
instances within a region. With Terraform, processing is done within the Terraform
client. Thus, preprocessing involves no calls to Azure since it uses state and HCL
(HashiCorp Language) to determine the required changes.
Authentication
The Azure authentication features vary between Bicep and Terraform. With Bicep, an
authorization token is supplied during the request to submit a Bicep file and ARM
Template. ARM ensures that you have permission to both create the deployment
and deploy resources within the specified template. Terraform authenticates each
API based on provider credentials – such as Azure CLI, service principal, or managed
identities for Azure resources. Moreover, multiple provider credentials can be
utilized in a single configuration.
Azure integrations
You should also consider your use of Azure features such as Azure Policy and how
each interacts with other tools and languages. Bicep's preflight validation
determines whether a resource doesn't comply with a policy so that it fails before a
deployment. Thus, developers can remediate resources with policy using provided
ARM templates. The ARM template can be used to create a policy assignment to
another resource for automated remediation. Terraform, however, fails when a
resource is deployed that is disallowed due to policy.
Portal integration
One major advantage that Bicep has over Terraform is the ability to automate portal
actions. With Bicep, you can use the Azure portal to export templates. Exporting a
template helps you to understand the JSON syntax and properties that deploy your
resources. You can automate future deployments by starting with the exported
template and modifying it to meet your needs. Until Bicep templates are supported,
you need to decompile the exported ARM template.
Although Terraform doesn't provide the same portal integrations as Bicep, existing
Azure infrastructure can be taken under Terraform management using Azure Export
for Terraform. (Azure Export for Terraform is an open-source tool owned and
maintained by Microsoft on the Azure/aztfexport GitHub repo .)
Out-of-band changes
Out-of-band configuration changes are changes made to a device configuration
outside the context of the tool. For example, let's say you deploy a Virtual Machine
Scale Set using Bicep or Terraform. If you change that Virtual Machine Scale Set
using the portal, the change would be "out-of-band" and unknown to your IaC tool.
If you're using Bicep, out-of-band changes should be reconciled with Bicep and the
ARM Template code to avoid having those changes overwritten on the next
deployment. These changes don't block the deployment.
If you're using Terraform, you need to import the out-of-band changes into the
Terraform state and update the HCL.
Cloud frameworks
The Cloud Adoption Framework (CAF) is a collection of documentation, best
practices, and tools to accelerate cloud adoption throughout your cloud journey.
Azure provides native services for deploying landing zones. Bicep simplifies this
process with a portal experience based on ARM templates and landing-zone
implementation. Terraform utilizes an Enterprise-Scale Landing Zones module to
deploy, manage, and operationalize with Azure.
Summary
Bicep and Terraform offer many user-friendly infrastructure and integration
features. These features make it easier to implement and manage automation
technology. When deciding which is best for your environment, it's important to
consider if you're deploying to more than one cloud or whether your infrastructure
consists of a multi or hybrid-cloud environment. Moreover, be sure to consider the
nine features discussed in this article to make the best choice for your organization.
Provision infrastructure with Azure
deployment slots using Terraform
Article • 10/26/2023
You can use Azure deployment slots to swap between different versions of your app.
That ability helps you minimize the impact of broken deployments.
This article illustrates an example use of deployment slots by walking you through the
deployment of two apps via GitHub and Azure. One app is hosted in a production slot.
The second app is hosted in a staging slot. (The names "production" and "staging" are
arbitrary. They can be whatever is appropriate for your scenario.) After you configure
your deployment slots, you use Terraform to swap between the two slots as needed.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
GitHub account: You need a GitHub account to fork and use the test GitHub
repo.
2. Create and apply the Terraform plan
1. Browse to the Azure portal .
2. Open Azure Cloud Shell. If you didn't select an environment previously, select Bash
as your environment.
Bash
cd clouddrive
Bash
mkdir deploy
Bash
mkdir swap
6. Use the ls bash command to verify that you successfully created both directories.
cd deploy
Bash
code deploy.tf
10. Save the file (<Ctrl>S) and exit the editor (<Ctrl>Q).
11. Now that you've created the file, verify its contents.
Bash
cat deploy.tf
Bash
terraform init
Bash
terraform plan
14. Provision the resources that are defined in the deploy.tf configuration file.
(Confirm the action by entering yes at the prompt.)
Bash
terraform apply
16. On the main menu of the Azure portal, select Resource groups.
17. On the Resource groups tab, select slotDemoResourceGroup.
You now see all the resources that Terraform has created.
2. Select slotDemoResourceGroup.
3. Select slotAppService.
7. On the Authorization tab, select Authorize, and supply the credentials that Azure
needs to access your GitHub account.
8. After Azure validates your GitHub credentials, a message appears and says that the
authorization process has finished. Select OK to close the Authorization tab.
At this point, you've deployed the production slot. To deploy the staging slot, do the
previous steps with the following modifications:
2. Select slotDemoResourceGroup.
slotAppService web app - Blue page with a page title of Slot Demo App 1.
slotAppServiceSlotOne web app - Green page with a page title of Slot Demo
App 2.
1. Switch to the browser tab that's running slotAppService (the app with the blue
page).
Bash
cd clouddrive/swap
Bash
code swap.tf
6. Insert the following code into the editor:
8. Initialize Terraform.
Bash
terraform init
Bash
terraform plan
10. Provision the resources that are defined in the swap.tf configuration file. (Confirm
the action by entering yes at the prompt.)
Bash
terraform apply
11. After Terraform has swapped the slots, return to the browser. Refresh the page.
The web app in your slotAppServiceSlotOne staging slot has been swapped with the
production slot and is now rendered in green.
To return to the original production version of the app, reapply the Terraform plan that
you created from the swap.tf configuration file.
Bash
terraform apply
Next steps
Learn more about using Terraform in Azure
Configure Azure Virtual Desktop with
Terraform
Article • 03/20/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.7
AzureRM Provider v.2.99.0
This article provides an overview of how to use Terraform to deploy an ARM Azure
Virtual Desktop environment, not AVD Classic.
New to Azure Virtual Desktop? Start with What is Azure Virtual Desktop?
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
resource "azurerm_virtual_desktop_host_pool_registration_info"
"registrationinfo" {
hostpool_id = azurerm_virtual_desktop_host_pool.hostpool.id
expiration_date = var.rfc3339
}
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "rg_name" {
type = string
default = "rg-avd-resources"
description = "Name of the Resource group in which to deploy service
objects"
}
variable "workspace" {
type = string
description = "Name of the Azure Virtual Desktop workspace"
default = "AVD TF Workspace"
}
variable "hostpool" {
type = string
description = "Name of the Azure Virtual Desktop host pool"
default = "AVD-TF-HP"
}
variable "rfc3339" {
type = string
default = "2022-03-30T12:43:13Z"
description = "Registration token expiration"
}
variable "prefix" {
type = string
default = "avdtf"
description = "Prefix of the name of the AVD machine(s)"
}
output "azure_virtual_desktop_compute_resource_group" {
description = "Name of the Resource group in which to deploy session
host"
value = azurerm_resource_group.sh.name
}
output "azure_virtual_desktop_host_pool" {
description = "Name of the Azure Virtual Desktop host pool"
value = azurerm_virtual_desktop_host_pool.hostpool.name
}
output "azurerm_virtual_desktop_application_group" {
description = "Name of the Azure Virtual Desktop DAG"
value = azurerm_virtual_desktop_application_group.dag.name
}
output "azurerm_virtual_desktop_workspace" {
description = "Name of the Azure Virtual Desktop workspace"
value = azurerm_virtual_desktop_workspace.workspace.name
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.sh.location
}
output "AVD_user_groupname" {
description = "Azure Active Directory Group for AVD users"
value = azuread_group.aad_group.display_name
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Configure Azure Virtual Desktop session
hosts using Terraform
Article • 10/26/2023
This article shows you how to build Session Hosts and deploy them to an AVD Host Pool
with Terraform. This article assumes you've already deployed the Azure Virtual Desktop
Infrastructure.
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.7
AzureRM Provider v.2.99.0
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Key points:
of these resources from that section, you also need to update the references
here.
Terraform
locals {
registration_token =
azurerm_virtual_desktop_host_pool_registration_info.registrationinfo.to
ken
}
ip_configuration {
name = "nic${count.index + 1}_config"
subnet_id = azurerm_subnet.subnet.id
private_ip_address_allocation = "dynamic"
}
depends_on = [
azurerm_resource_group.rg
]
}
os_disk {
name = "${lower(var.prefix)}-${count.index + 1}"
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "MicrosoftWindowsDesktop"
offer = "Windows-10"
sku = "20h2-evd"
version = "latest"
}
depends_on = [
azurerm_resource_group.rg,
azurerm_network_interface.avd_vm_nic
]
}
settings = <<SETTINGS
{
"Name": "${var.domain_name}",
"OUPath": "${var.ou_path}",
"User": "${var.domain_user_upn}@${var.domain_name}",
"Restart": "true",
"Options": "3"
}
SETTINGS
protected_settings = <<PROTECTED_SETTINGS
{
"Password": "${var.domain_password}"
}
PROTECTED_SETTINGS
lifecycle {
ignore_changes = [settings, protected_settings]
}
depends_on = [
azurerm_virtual_network_peering.peer1,
azurerm_virtual_network_peering.peer2
]
}
settings = <<-SETTINGS
{
"modulesUrl":
"https://wvdportalstorageblob.blob.core.windows.net/galleryartifacts/Co
nfiguration_09-08-2022.zip",
"configurationFunction": "Configuration.ps1\\AddSessionHost",
"properties": {
"HostPoolName":"${azurerm_virtual_desktop_host_pool.hostpool.name}"
}
}
SETTINGS
protected_settings = <<PROTECTED_SETTINGS
{
"properties": {
"registrationInfoToken": "${local.registration_token}"
}
}
PROTECTED_SETTINGS
depends_on = [
azurerm_virtual_machine_extension.domain_join,
azurerm_virtual_desktop_host_pool.hostpool
]
}
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "rg" {
type = string
default = "rg-avd-compute"
description = "Name of the Resource group in which to deploy session host"
}
variable "rdsh_count" {
description = "Number of AVD machines to deploy"
default = 2
}
variable "prefix" {
type = string
default = "avdtf"
description = "Prefix of the name of the AVD machine(s)"
}
variable "domain_name" {
type = string
default = "infra.local"
description = "Name of the domain to join"
}
variable "domain_user_upn" {
type = string
default = "domainjoineruser" # do not include domain name as this is
appended
description = "Username for domain join (do not include domain name as
this is appended)"
}
variable "domain_password" {
type = string
default = "ChangeMe123!"
description = "Password of the user to authenticate with the domain"
sensitive = true
}
variable "vm_size" {
description = "Size of the machine to deploy"
default = "Standard_DS2_v2"
}
variable "ou_path" {
default = ""
}
variable "local_admin_username" {
type = string
default = "localadm"
description = "local admin username"
}
variable "local_admin_password" {
type = string
default = "ChangeMe123!"
description = "local admin password"
sensitive = true
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.rg.location
}
output "session_host_count" {
description = "The number of VMs created"
value = var.rdsh_count
}
output "dnsservers" {
description = "Custom DNS configuration"
value = azurerm_virtual_network.vnet.dns_servers
}
output "vnetrange" {
description = "Address range for deployment vnet"
value = azurerm_virtual_network.vnet.address_space
}
1. Create a file named terraform.tfvars and insert the following code:
Terraform
# Customized the sample values below for your environment and either
rename to terraform.tfvars or env.auto.tfvars
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
terraform plan -out main.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Configure Azure Virtual Desktop role-
based access control using Terraform
Article • 11/07/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.4
AzureRM Provider v.2.94.0
This article will walk through adding our users and Microsoft Entra group and then
assign the group to the "Desktop Virtualization User" role, scoped to our host pool.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "avd_users" {
description = "AVD users"
default = [
"[email protected]",
"[email protected]"
]
}
variable "aad_group_name" {
type = string
default = "AVDUsers"
description = "Azure Active Directory Group for AVD users"
}
output "AVD_user_groupname" {
description = "Azure Active Directory Group for AVD users"
value = azuread_group.aad_group.display_name
}
6. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
7. Create a Terraform execution plan
Run terraform plan to create an execution plan.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
You are now ready to build and deploy your infrastructure with role based access
control.
9. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about Configuring Azure Virtual Desktop session hosts using
Terraform in Azure
Configure Azure Virtual Desktop
Network Settings with Terraform
Article • 10/26/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.7
AzureRM Provider v.2.99.0
This article provides an overview of how to use Terraform to configure the network
settings for Azure Virtual Desktop.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
resource "azurerm_subnet_network_security_group_association"
"nsg_assoc" {
subnet_id = azurerm_subnet.subnet.id
network_security_group_id = azurerm_network_security_group.nsg.id
}
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "rg_name" {
type = string
default = "rg-avd-resources"
description = "Name of the Resource group in which to deploy service
objects"
}
variable "rg_shared_name" {
type = string
default = "rg-shared-resources"
description = "Name of the Resource group in which to deploy shared
resources"
}
variable "deploy_location" {
type = string
default = "eastus"
description = "The Azure Region in which all resources in this example
should be created."
}
variable "ad_vnet" {
type = string
default = "infra-network"
description = "Name of domain controller vnet"
}
variable "dns_servers" {
type = list(string)
default = ["10.0.1.4", "168.63.129.16"]
description = "Custom DNS configuration"
}
variable "vnet_range" {
type = list(string)
default = ["10.2.0.0/16"]
description = "Address range for deployment VNet"
}
variable "subnet_range" {
type = list(string)
default = ["10.2.0.0/24"]
description = "Address range for session host subnet"
}
variable "prefix" {
type = string
default = "avdtf"
description = "Prefix of the name of the AVD machine(s)"
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.rg.location
}
output "dnsservers" {
description = "Custom DNS configuration"
value = azurerm_virtual_network.vnet.dns_servers
}
output "vnetrange" {
description = "Address range for deployment vnet"
value = azurerm_virtual_network.vnet.address_space
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
5. Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Configure Azure Files using Terraform
Article • 10/26/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.7
AzureRM Provider v.2.99.0
Azure offers multiple storage solutions that you can use to store your FSLogix profiles
container. This article covers configuring Azure Files storage solutions for Azure Virtual
Desktop FSLogix user profile containers using Terraform
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "deploy_location" {
type = string
default = "eastus"
description = "The Azure Region in which all resources in this example
should be created."
}
variable "rg_stor" {
type = string
default = "rg-avd-storage"
description = "Name of the Resource group in which to deploy storage"
}
variable "avd_users" {
description = "AVD users"
default = [
"[email protected]",
"[email protected]"
]
}
variable "aad_group_name" {
type = string
default = "AVDUsers"
description = "Azure Active Directory Group for AVD users"
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.rg_storage.location
}
output "storage_account" {
description = "Storage account for Profiles"
value = azurerm_storage_account.storage.name
}
output "storage_account_share" {
description = "Name of the Azure File Share created for FSLogix"
value = azurerm_storage_share.FSShare.name
}
output "AVD_user_groupname" {
description = "Azure Active Directory Group for AVD users"
value = azuread_group.aad_group.display_name
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
terraform plan -out main.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
6. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Configure Azure Compute Gallery with
Terraform
Article • 10/26/2023
" Use Terraform to configure Azure Compute Gallery (formerly Shared Image Gallery)
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
tags = {
Environment = "Demo"
Tech = "Terraform"
}
}
identifier {
publisher = "MicrosoftWindowsDesktop"
offer = "office-365"
sku = "20h2-evd-o365pp"
}
}
variable "deploy_location" {
type = string
default = "eastus"
description = "The Azure Region in which all resources in this example
should be created."
}
variable "rg_shared_name" {
type = string
default = "rg-shared-resources"
description = "Name of the Resource group in which to deploy shared
resources"
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.sigrg.location
}
output "Compute_Gallery" {
description = "Azure Compute Gallery"
value = azurerm_shared_image_gallery.sig.name
}
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
5. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Create an Azure Log Analytics
Workspace using Terraform
Article • 10/26/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.7
AzureRM Provider v.2.99.0
Azure offers multiple storage solutions that you can use to store your FSLogix profiles
container. This article covers configuring Azure Files storage solutions for Azure Virtual
Desktop FSLogix user profile containers using Terraform. This article shows you how to
create a Log Analytics workspace using Terraform.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "deploy_location" {
type = string
default = "eastus"
description = "The Azure Region in which all resources in this example
should be created."
}
variable "rg_shared_name" {
type = string
default = "rg-shared-resources"
description = "Name of the Resource group in which to deploy shared
resources"
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.log.location
}
output "log_analytics" {
description = "Log Analytics Workspace"
value = azurerm_log_analytics_workspace.law.name
}
4. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
terraform plan -out main.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Create an Azure virtual machine scale
set using Terraform
Article • 10/26/2023
Azure virtual machine scale sets allow you to configure identical VMs. The number of
VM instances can adjust based on demand or a schedule. For more information, see
Automatically scale a virtual machine scale set in the Azure portal.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Create an SSH key pair: For more information, see How to create and use an SSH
public and private key pair for Linux VMs in Azure.
Terraform
terraform {
required_version = ">=0.12"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
}
}
provider "azurerm" {
features {}
}
frontend_ip_configuration {
name = "PublicIPAddress"
public_ip_address_id = azurerm_public_ip.vmss.id
}
tags = var.tags
}
sku {
name = "Standard_DS1_v2"
tier = "Standard"
capacity = 2
}
storage_profile_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
storage_profile_os_disk {
name = ""
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
storage_profile_data_disk {
lun = 0
caching = "ReadWrite"
create_option = "Empty"
disk_size_gb = 10
}
os_profile {
computer_name_prefix = "vmlab"
admin_username = var.admin_user
admin_password = var.admin_password
custom_data = file("web.conf")
}
os_profile_linux_config {
disable_password_authentication = false
}
network_profile {
name = "terraformnetworkprofile"
primary = true
ip_configuration {
name = "IPConfiguration"
subnet_id = azurerm_subnet.vmss.id
load_balancer_backend_address_pool_ids =
[azurerm_lb_backend_address_pool.bpepool.id]
primary = true
}
}
tags = var.tags
}
ip_configuration {
name = "IPConfiguration"
subnet_id = azurerm_subnet.vmss.id
private_ip_address_allocation = "dynamic"
public_ip_address_id = azurerm_public_ip.jumpbox.id
}
tags = var.tags
}
storage_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
storage_os_disk {
name = "jumpbox-osdisk"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
os_profile {
computer_name = "jumpbox"
admin_username = var.admin_user
admin_password = var.admin_password
}
os_profile_linux_config {
disable_password_authentication = false
}
tags = var.tags
}
3. Create a file named variables.tf to contain the project variables and insert the
following code:
Terraform
variable "resource_group_name" {
description = "Name of the resource group in which the resources
will be created"
default = "myResourceGroup"
}
variable "location" {
default = "eastus"
description = "Location where resources will be created"
}
variable "tags" {
description = "Map of the tags to use for the resources that are
deployed"
type = map(string)
default = {
environment = "codelab"
}
}
variable "application_port" {
description = "Port that you want to expose to the external load
balancer"
default = 80
}
variable "admin_user" {
description = "User name to use as the admin account on the VMs that
will be part of the VM scale set"
default = "azureuser"
}
variable "admin_password" {
description = "Default password for admin account"
}
4. Create a file named output.tf to specify what values Terraform displays and insert
the following code:
Terraform
output "vmss_public_ip_fqdn" {
value = azurerm_public_ip.vmss.fqdn
}
output "jumpbox_public_ip_fqdn" {
value = azurerm_public_ip.jumpbox.fqdn
}
output "jumpbox_public_ip" {
value = azurerm_public_ip.jumpbox.ip_address
}
Terraform
#cloud-config
packages:
- nginx
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
2. Browse to the virtual machine URL to confirm a default page with the text
Welcome to nginx!.
3. Use SSH to connect to the jumpbox VM using the user name defined in the
variables file and the password you specified when you ran terraform apply . For
example: ssh azureuser@<ip_address> .
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
1. Run terraform plan and specify the destroy flag.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Create an Azure virtual machine scale
set from a Packer custom image by
using Terraform
Article • 03/15/2024
Azure virtual machine scale sets allow you to configure identical VMs. The number of
VM instances can adjust based on demand or a schedule. For more information, see
Automatically scale a virtual machine scale set in the Azure portal.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Key points:
To confirm that you have access to the Packer executable, run the following
command: packer -v .
Depending on your environment, you might need to set your path and
reopen the command-line.
2. Run az group create to create a resource group to hold the Packer image.
Azure CLI
Azure CLI
Key points:
Azure CLI
5. Create a Packer template variables file named ubuntu.pkr.hcl and insert the
following code. Update the highlighted lines with your service principal and Azure
subscription information.
Terraform
packer {
required_plugins {
azure = {
source = "github.com/hashicorp/azure"
version = "~> 2"
}
}
}
variable client_id {
type = string
default = null
}
variable client_secret {
type = string
default = null
}
variable subscription_id {
type = string
default = null
}
variable tenant_id {
type = string
default = null
}
variable location {
default = "eastus"
}
variable "image_resource_group_name" {
description = "Name of the resource group in which the Packer image
will be created"
default = "myPackerImages"
}
build {
sources = ["source.azure-arm.builder"]
provisioner "shell" {
execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{
.Path }}'"
inline = [
"apt-get update",
"apt-get upgrade -y",
"apt-get -y install nginx",
"/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0
&& sync",
]
}
}
Key points:
Console
Terraform
terraform {
required_version = ">=0.12"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azapi = {
source = "Azure/azapi"
version = "~> 1.0"
}
local = {
source = "hashicorp/local"
version = "2.4.0"
}
random = {
source = "hashicorp/random"
version = "3.5.1"
}
tls = {
source = "hashicorp/tls"
version = "4.0.4"
}
}
}
provider "azurerm" {
features {}
}
frontend_ip_configuration {
name = "PublicIPAddress"
public_ip_address_id = azurerm_public_ip.vmss.id
}
tags = var.tags
}
locals {
admin_password = try(random_password.password[0].result,
var.admin_password)
}
sku {
name = "Standard_DS1_v2"
tier = "Standard"
capacity = 2
}
storage_profile_image_reference {
id = data.azurerm_image.image.id
}
storage_profile_os_disk {
name = ""
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
storage_profile_data_disk {
lun = 0
caching = "ReadWrite"
create_option = "Empty"
disk_size_gb = 10
}
os_profile {
computer_name_prefix = "vmlab"
admin_username = var.admin_user
admin_password = local.admin_password
}
os_profile_linux_config {
disable_password_authentication = true
ssh_keys {
path = "/home/azureuser/.ssh/authorized_keys"
key_data =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
}
network_profile {
name = "terraformnetworkprofile"
primary = true
ip_configuration {
name = "IPConfiguration"
subnet_id = azurerm_subnet.vmss.id
load_balancer_backend_address_pool_ids =
[azurerm_lb_backend_address_pool.bpepool.id]
primary = true
}
}
tags = var.tags
}
ip_configuration {
name = "IPConfiguration"
subnet_id = azurerm_subnet.vmss.id
private_ip_address_allocation = "dynamic"
public_ip_address_id = azurerm_public_ip.jumpbox.id
}
tags = var.tags
}
storage_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
storage_os_disk {
name = "jumpbox-osdisk"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
os_profile {
computer_name = "jumpbox"
admin_username = var.admin_user
admin_password = local.admin_password
}
os_profile_linux_config {
disable_password_authentication = true
ssh_keys {
path = "/home/azureuser/.ssh/authorized_keys"
key_data =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
}
tags = var.tags
}
3. Create a file named variables.tf to contain the project variables and insert the
following code:
Terraform
variable "packer_resource_group_name" {
description = "Name of the resource group in which the Packer image
will be created"
default = "myPackerImages"
}
variable "packer_image_name" {
description = "Name of the Packer image"
default = "myPackerImage"
}
variable "resource_group_name" {
description = "Name of the resource group in which the Packer image
will be created"
default = null
}
variable "location" {
default = "eastus"
description = "Location where resources will be created"
}
variable "tags" {
description = "Map of the tags to use for the resources that are
deployed"
type = map(string)
default = {
environment = "codelab"
}
}
variable "application_port" {
description = "Port that you want to expose to the external load
balancer"
default = 80
}
variable "admin_user" {
description = "User name to use as the admin account on the VMs that
will be part of the VM scale set"
default = "azureuser"
}
variable "admin_password" {
description = "Default password for admin account"
default = null
}
4. Create a file named output.tf to specify what values Terraform displays and insert
the following code:
Terraform
output "vmss_public_ip_fqdn" {
value = azurerm_public_ip.vmss.fqdn
}
output "jumpbox_public_ip_fqdn" {
value = azurerm_public_ip.jumpbox.fqdn
}
output "jumpbox_public_ip" {
value = azurerm_public_ip.jumpbox.ip_address
}
4. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
Console
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
2. Browse to the virtual machine URL to confirm a default page with the text
Welcome to nginx!.
3. Use SSH to connect to the jumpbox VM using the user name defined in the
variables file and the password you specified when you ran terraform apply . For
example: ssh azureuser@<ip_address> .
8. Clean up resources
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
Console
Azure CLI
Next steps
Learn more about using Terraform in Azure
Deploy a PostgreSQL Flexible Server
Database using Terraform
Article • 10/26/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.4
AzureRM Provider v.2.94.0
This article shows how to deploy a PostgreSQL Flexible Server Database using Terraform.
7 Note
The example code in this article is located in the Azure Terraform GitHub repo .
1. Configure your environment
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = ">= 3.4.0"
}
}
}
provider "azurerm" {
features {}
}
3. Create a file named main.tf and insert the following code to deploy the
PostgreSQL Flexible Server on which the database runs.
Terraform
resource "random_pet" "name_prefix" {
prefix = var.name_prefix
length = 1
}
security_rule {
name = "test123"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}
delegation {
name = "fs"
service_delegation {
name = "Microsoft.DBforPostgreSQL/flexibleServers"
actions = [
"Microsoft.Network/virtualNetworks/subnets/join/action",
]
}
}
}
resource "azurerm_subnet_network_security_group_association" "default"
{
subnet_id = azurerm_subnet.default.id
network_security_group_id = azurerm_network_security_group.default.id
}
depends_on =
[azurerm_subnet_network_security_group_association.default]
}
depends_on = [azurerm_private_dns_zone_virtual_network_link.default]
}
Terraform
Terraform
variable "name_prefix" {
default = "postgresqlfs"
description = "Prefix of the resource name."
}
variable "location" {
default = "eastus"
description = "Location of the resource."
}
6. Create a file named outputs.tf and insert the following code to output the
resource group name, Azure PostgreSQL server name, and Azure PostgreSQL
database name:
Terraform
output "resource_group_name" {
value = azurerm_resource_group.default.name
}
output "azurerm_postgresql_flexible_server" {
value = azurerm_postgresql_flexible_server.default.name
}
output "postgresql_flexible_server_database_name" {
value = azurerm_postgresql_flexible_server_database.default.name
}
output "postgresql_flexible_server_admin_password" {
sensitive = true
value =
azurerm_postgresql_flexible_server.default.administrator_password
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Azure CLI
Key points:
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about PostgreSQL Flexible Server
Deploy a PostgreSQL Flexible Server
Database using Terraform
Article • 10/26/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.4
AzureRM Provider v.2.94.0
This article shows how to deploy a PostgreSQL Flexible Server Database using Terraform.
7 Note
The example code in this article is located in the Azure Terraform GitHub repo .
1. Configure your environment
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = ">= 3.4.0"
}
}
}
provider "azurerm" {
features {}
}
3. Create a file named main.tf and insert the following code to deploy the
PostgreSQL Flexible Server on which the database runs.
Terraform
resource "random_pet" "name_prefix" {
prefix = var.name_prefix
length = 1
}
security_rule {
name = "test123"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}
delegation {
name = "fs"
service_delegation {
name = "Microsoft.DBforPostgreSQL/flexibleServers"
actions = [
"Microsoft.Network/virtualNetworks/subnets/join/action",
]
}
}
}
resource "azurerm_subnet_network_security_group_association" "default"
{
subnet_id = azurerm_subnet.default.id
network_security_group_id = azurerm_network_security_group.default.id
}
depends_on =
[azurerm_subnet_network_security_group_association.default]
}
depends_on = [azurerm_private_dns_zone_virtual_network_link.default]
}
Terraform
Terraform
variable "name_prefix" {
default = "postgresqlfs"
description = "Prefix of the resource name."
}
variable "location" {
default = "eastus"
description = "Location of the resource."
}
6. Create a file named outputs.tf and insert the following code to output the
resource group name, Azure PostgreSQL server name, and Azure PostgreSQL
database name:
Terraform
output "resource_group_name" {
value = azurerm_resource_group.default.name
}
output "azurerm_postgresql_flexible_server" {
value = azurerm_postgresql_flexible_server.default.name
}
output "postgresql_flexible_server_database_name" {
value = azurerm_postgresql_flexible_server_database.default.name
}
output "postgresql_flexible_server_admin_password" {
sensitive = true
value =
azurerm_postgresql_flexible_server.default.administrator_password
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Azure CLI
Key points:
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about PostgreSQL Flexible Server
Configure an Azure Network Watcher
Connection using Terraform
Article • 10/26/2023
This article shows example Terraform code for setting up Network Watcher on Azure to
monitor the network health for a Network Security Group.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
features {}
}
security_rule {
name = "test123"
priority = 110
direction = "Inbound"
access = "Deny"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}
account_tier = "Standard"
account_replication_type = "GRS"
min_tls_version = "TLS1_2"
}
network_security_group_id =
azurerm_network_security_group.application1.id
storage_account_id =
azurerm_storage_account.network_log_data.id
enabled = true
retention_policy {
enabled = true
days = 90
}
traffic_analytics {
enabled = true
workspace_id =
azurerm_log_analytics_workspace.traffic_analytics.workspace_id
workspace_region =
azurerm_log_analytics_workspace.traffic_analytics.location
workspace_resource_id =
azurerm_log_analytics_workspace.traffic_analytics.id
interval_in_minutes = 10
}
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Next steps
Network security group flow logging
Provision infrastructure with Azure
deployment slots using Terraform
Article • 10/26/2023
You can use Azure deployment slots to swap between different versions of your app.
That ability helps you minimize the impact of broken deployments.
This article illustrates an example use of deployment slots by walking you through the
deployment of two apps via GitHub and Azure. One app is hosted in a production slot.
The second app is hosted in a staging slot. (The names "production" and "staging" are
arbitrary. They can be whatever is appropriate for your scenario.) After you configure
your deployment slots, you use Terraform to swap between the two slots as needed.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
GitHub account: You need a GitHub account to fork and use the test GitHub
repo.
2. Create and apply the Terraform plan
1. Browse to the Azure portal .
2. Open Azure Cloud Shell. If you didn't select an environment previously, select Bash
as your environment.
Bash
cd clouddrive
Bash
mkdir deploy
Bash
mkdir swap
6. Use the ls bash command to verify that you successfully created both directories.
cd deploy
Bash
code deploy.tf
10. Save the file (<Ctrl>S) and exit the editor (<Ctrl>Q).
11. Now that you've created the file, verify its contents.
Bash
cat deploy.tf
Bash
terraform init
Bash
terraform plan
14. Provision the resources that are defined in the deploy.tf configuration file.
(Confirm the action by entering yes at the prompt.)
Bash
terraform apply
16. On the main menu of the Azure portal, select Resource groups.
17. On the Resource groups tab, select slotDemoResourceGroup.
You now see all the resources that Terraform has created.
2. Select slotDemoResourceGroup.
3. Select slotAppService.
7. On the Authorization tab, select Authorize, and supply the credentials that Azure
needs to access your GitHub account.
8. After Azure validates your GitHub credentials, a message appears and says that the
authorization process has finished. Select OK to close the Authorization tab.
At this point, you've deployed the production slot. To deploy the staging slot, do the
previous steps with the following modifications:
2. Select slotDemoResourceGroup.
slotAppService web app - Blue page with a page title of Slot Demo App 1.
slotAppServiceSlotOne web app - Green page with a page title of Slot Demo
App 2.
1. Switch to the browser tab that's running slotAppService (the app with the blue
page).
Bash
cd clouddrive/swap
Bash
code swap.tf
6. Insert the following code into the editor:
8. Initialize Terraform.
Bash
terraform init
Bash
terraform plan
10. Provision the resources that are defined in the swap.tf configuration file. (Confirm
the action by entering yes at the prompt.)
Bash
terraform apply
11. After Terraform has swapped the slots, return to the browser. Refresh the page.
The web app in your slotAppServiceSlotOne staging slot has been swapped with the
production slot and is now rendered in green.
To return to the original production version of the app, reapply the Terraform plan that
you created from the swap.tf configuration file.
Bash
terraform apply
Next steps
Learn more about using Terraform in Azure
What is Application Gateway for
Containers?
Article • 05/09/2024
Application Gateway for Containers is an application layer (layer 7) load balancing and
dynamic traffic management product for workloads running in a Kubernetes cluster. It
extends Azure's Application Load Balancing portfolio and is a new offering under the
Application Gateway product family.
Application Gateway for Containers is the evolution of the Application Gateway Ingress
Controller (AGIC), a Kubernetes application that enables Azure Kubernetes Service (AKS)
customers to use Azure's native Application Gateway application load-balancer. In its
current form, AGIC monitors a subset of Kubernetes Resources for changes and applies
them to the Application Gateway, utilizing Azure Resource Manager (ARM).
Private IP address
Subnet Delegation
User-assigned Managed Identity
Application Gateway for Containers offers an elastic and scalable ingress to AKS clusters
and comprises a new data plane as well as control plane with new set of ARM APIs,
different from existing Application Gateway. These APIs are different from the current
implementation of Application Gateway. Application Gateway for Containers is outside
the AKS cluster data plane and is responsible for ingress. The service is managed by an
ALB controller component that runs inside the AKS cluster and adheres to Kubernetes
Gateway APIs.
Automatic retries
Autoscaling
Availability zone resiliency
Default and custom health probes
ECDSA and RSA certificate support
Header rewrite
HTTP/2
HTTPS traffic management:
SSL termination
End to End SSL
Ingress and Gateway API support
Layer 7 HTTP/HTTPS request forwarding based on prefix/exact match on:
Hostname
Path
Header
Query string
Methods
Ports (80/443)
Mutual authentication (mTLS) to backend target
Server-sent event (SSE) support
Traffic splitting / weighted round robin
TLS policies
URL redirect
URL rewrite
Deployment strategies
There are two deployment strategies for management of Application Gateway for
Containers:
Bring your own (BYO) deployment: In this deployment strategy, deployment and
lifecycle of the Application Gateway for Containers resource, Association resource,
and Frontend resource is assumed via Azure portal, CLI, PowerShell, Terraform, etc.
and referenced in configuration within Kubernetes.
In Gateway API: Every time you wish to create a new Gateway resource in
Kubernetes, a Frontend resource should be provisioned in Azure prior and
referenced by the Gateway resource. Deletion of the Frontend resource is
responsible by the Azure administrator and isn't deleted when the Gateway
resource in Kubernetes is deleted.
Managed by ALB Controller: In this deployment strategy, ALB Controller deployed
in Kubernetes is responsible for the lifecycle of the Application Gateway for
Containers resource and its sub resources. ALB Controller creates the Application
Gateway for Containers resource when an ApplicationLoadBalancer custom
resource is defined on the cluster and its lifecycle is based on the lifecycle of the
custom resource.
In Gateway API: Every time a Gateway resource is created referencing the
ApplicationLoadBalancer resource, ALB Controller provisions a new Frontend
resource and manage its lifecycle based on the lifecycle of the Gateway
resource.
Supported regions
Application Gateway for Containers is currently offered in the following regions:
Australia East
Canada Central
Central India
Central US
East Asia
East US
East US2
France Central
Germany West Central
Korea Central
North Central US
North Europe
Norway East
South Central US
Southeast Asia
Switzerland North
UAE North
UK South
West US
West Europe
ノ Expand table
GatewayClass Yes
Gateway Yes Support for HTTP and HTTPS protocol on the listener. The only
ports allowed on the listener are 80 and 443.
HTTPRoute Yes
ノ Expand table
Ingress Yes Support for HTTP and HTTPS protocol on the listener.
For Application Gateway for Containers SLA information, see Service Level Agreements
(SLA) for Online Services .
What's new
To learn what's new with Application Gateway for Containers, see Azure updates .
Next steps
Concepts: Application Gateway for Containers components
Quickstart: Deploy Application Gateway for Containers ALB Controller
Feedback
Was this page helpful? Yes No
If you use Terraform to deploy standard Azure Firewall with classic rules, you can modify
your Terraform configuration file to migrate your firewall to Azure Firewall Premium
using a Premium firewall policy.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
ip_configuration {
name = "configuration"
subnet_id = azurerm_subnet.subnet.id
public_ip_address_id = azurerm_public_ip.pip.id
}
}
rule {
name = "testrule"
source_addresses = [
"10.0.0.0/16",
]
target_fqdns = [
"*.google.com",
]
protocol {
port = "443"
type = "Https"
}
}
}
rule {
name = "dnsrule"
source_addresses = [
"10.0.0.0/16",
]
destination_ports = [
"53",
]
destination_addresses = [
"8.8.8.8",
"8.8.4.4",
]
protocols = [
"TCP",
"UDP",
]
}
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location of the resource group."
}
variable "prefix" {
type = string
default = "firewall-standard"
description = "Prefix of the resource name"
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Terraform
Terraform
ip_configuration {
name = "configuration"
subnet_id = azurerm_subnet.subnet.id
public_ip_address_id = azurerm_public_ip.pip.id
}
}
Terraform
rule {
name = "testrule"
source_addresses = [
"10.0.0.0/16",
]
target_fqdns = [
"*.google.com",
]
protocol {
port = "443"
type = "Https"
}
}
}
rule {
name = "dnsrule"
source_addresses = [
"10.0.0.0/16",
]
destination_ports = [
"53",
]
destination_addresses = [
"8.8.8.8",
"8.8.4.4",
]
protocols = [
"TCP",
"UDP",
]
}
}
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
terraform apply main.destroy.tfplan
Next steps
Learn more about using Terraform in Azure
Create a hub and spoke hybrid network
topology in Azure using Terraform
Article • 10/26/2023
This articles series shows how to use Terraform to implement in Azure a hub and spoke
network topology.
A hub and spoke topology is a way to isolate workloads while sharing common services.
These services include identity and security. The hub is a virtual network (VNet) that acts
as a central connection point to an on-premises network. The spokes are VNets that
peer with the hub. Shared services are deployed in the hub, while individual workloads
are deployed inside spoke networks.
" Lay out hub and spoke hybrid network reference architecture resources
" Create hub network appliance resources
" Create hub network in Azure to act as common point for all resources
" Create individual workloads as spoke VNets in Azure
" Establish gateways and connections between on premises and Azure networks
" Create VNet peerings to spoke networks
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
VPN device. A VPN device or service provides external connectivity to the on-
premises network. The VPN device may be a hardware appliance or a software
solution.
Hub VNet. The hub is the central point of connectivity to your on-premises
network and a place to host services. These services can be consumed by the
different workloads hosted in the spoke VNets.
Gateway subnet. The VNet gateways are held in the same subnet.
Spoke VNets. Spokes can be used to isolate workloads in their own VNets,
managed separately from other spokes. Each workload might include multiple
tiers, with multiple subnets connected through Azure load balancers.
VNet peering. Two VNets can be connected using a peering connection. Peering
connections are non-transitive, low latency connections between VNets. Once
peered, the VNets exchange traffic by using the Azure backbone, without needing
a router. In a hub and spoke network topology, VNet peering is used to connect
the hub to each spoke. You can peer VNets in the same region, or different
regions.
Terraform
terraform {
required_version = ">=0.12"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
}
}
provider "azurerm" {
features {}
}
3. Create a file named variables.tf to contain the project variables and insert the
following code:
Terraform
variable "location" {
description = "Location of the network"
default = "eastus"
}
variable "username" {
description = "Username for Virtual Machines"
default = "azureuser"
}
variable "password" {
description = "Password for Virtual Machines"
}
variable "vmsize" {
description = "Size of the VMs"
default = "Standard_DS1_v2"
}
Key points:
This article uses a password you enter when you call terraform plan . In a
real-world app, you might consider using a SSH public/private key pair.
For more information about SSH keys and Azure, see How to use SSH keys
with Windows on Azure.
Next steps
Create on-premises virtual network with Terraform in Azure
Create on-premises virtual network in
Azure using Terraform
Article • 10/26/2023
This article shows how to implement an on-premises network in Azure. You can replace
the sample network with a private virtual network. To do so, modify the subnet IP
addresses to suit your environment.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Create a hub and spoke hybrid network topology with Terraform in Azure.
Terraform
locals {
onprem-location = "eastus"
onprem-resource-group = "onprem-vnet-rg"
prefix-onprem = "onprem"
}
tags = {
environment = local.prefix-onprem
}
}
tags = {
environment = local.prefix-onprem
}
}
ip_configuration {
name = local.prefix-onprem
subnet_id = azurerm_subnet.onprem-mgmt.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id = azurerm_public_ip.onprem-pip.id
}
}
security_rule {
name = "SSH"
priority = 1001
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "*"
destination_address_prefix = "*"
}
tags = {
environment = "onprem"
}
}
storage_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
storage_os_disk {
name = "myosdisk1"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
os_profile {
computer_name = "${local.prefix-onprem}-vm"
admin_username = var.username
admin_password = var.password
}
os_profile_linux_config {
disable_password_authentication = false
}
tags = {
environment = local.prefix-onprem
}
}
allocation_method = "Dynamic"
}
type = "Vpn"
vpn_type = "RouteBased"
active_active = false
enable_bgp = false
sku = "VpnGw1"
ip_configuration {
name = "vnetGatewayConfig"
public_ip_address_id = azurerm_public_ip.onprem-vpn-
gateway1-pip.id
private_ip_address_allocation = "Dynamic"
subnet_id = azurerm_subnet.onprem-gateway-
subnet.id
}
depends_on = [azurerm_public_ip.onprem-vpn-gateway1-pip]
Next steps
Create a hub virtual network with Terraform in Azure
Create a hub virtual network in Azure by
using Terraform
Article • 10/26/2023
The hub virtual network acts as the central point of connectivity to the on-premises
network. The virtual network hosts shared services consumed by workloads hosted in
the spoke virtual networks. For demo purposes, no shared services are implemented in
this article.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
1. Make the example directory created in the first article of this series the current
directory.
Terraform
locals {
prefix-hub = "hub"
hub-location = "eastus"
hub-resource-group = "hub-vnet-rg"
shared-key = "4-v3ry-53cr37-1p53c-5h4r3d-k3y"
}
tags = {
environment = "hub-spoke"
}
}
ip_configuration {
name = local.prefix-hub
subnet_id = azurerm_subnet.hub-mgmt.id
private_ip_address_allocation = "Dynamic"
}
tags = {
environment = local.prefix-hub
}
}
#Virtual Machine
resource "azurerm_virtual_machine" "hub-vm" {
name = "${local.prefix-hub}-vm"
location = azurerm_resource_group.hub-vnet-rg.location
resource_group_name = azurerm_resource_group.hub-vnet-rg.name
network_interface_ids = [azurerm_network_interface.hub-nic.id]
vm_size = var.vmsize
storage_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
storage_os_disk {
name = "myosdisk1"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
os_profile {
computer_name = "${local.prefix-hub}-vm"
admin_username = var.username
admin_password = var.password
}
os_profile_linux_config {
disable_password_authentication = false
}
tags = {
environment = local.prefix-hub
}
}
allocation_method = "Dynamic"
}
type = "Vpn"
vpn_type = "RouteBased"
active_active = false
enable_bgp = false
sku = "VpnGw1"
ip_configuration {
name = "vnetGatewayConfig"
public_ip_address_id = azurerm_public_ip.hub-vpn-gateway1-
pip.id
private_ip_address_allocation = "Dynamic"
subnet_id = azurerm_subnet.hub-gateway-
subnet.id
}
depends_on = [azurerm_public_ip.hub-vpn-gateway1-pip]
}
type = "Vnet2Vnet"
routing_weight = 1
virtual_network_gateway_id =
azurerm_virtual_network_gateway.hub-vnet-gateway.id
peer_virtual_network_gateway_id =
azurerm_virtual_network_gateway.onprem-vpn-gateway.id
shared_key = local.shared-key
}
shared_key = local.shared-key
}
Next steps
Create a hub virtual network appliance with Terraform in Azure
Create a hub virtual network appliance
in Azure using Terraform
Article • 10/26/2023
Azure supports a broad variety of network virtual appliances from which to select. For
this article, an Ubuntu image is used. To learn more about the broad variety of device
solutions supported in Azure, see the Network Appliances home page .
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Create a hub and spoke hybrid network topology with Terraform in Azure.
Terraform
locals {
prefix-hub-nva = "hub-nva"
hub-nva-location = "eastus"
hub-nva-resource-group = "hub-nva-rg"
}
tags = {
environment = local.prefix-hub-nva
}
}
ip_configuration {
name = local.prefix-hub-nva
subnet_id = azurerm_subnet.hub-dmz.id
private_ip_address_allocation = "Static"
private_ip_address = "10.0.0.36"
}
tags = {
environment = local.prefix-hub-nva
}
}
storage_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
storage_os_disk {
name = "myosdisk1"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
os_profile {
computer_name = "${local.prefix-hub-nva}-vm"
admin_username = var.username
admin_password = var.password
}
os_profile_linux_config {
disable_password_authentication = false
}
tags = {
environment = local.prefix-hub-nva
}
}
settings = <<SETTINGS
{
"fileUris": [
"https://raw.githubusercontent.com/mspnp/reference-
architectures/master/scripts/linux/enable-ip-forwarding.sh"
],
"commandToExecute": "bash enable-ip-forwarding.sh"
}
SETTINGS
tags = {
environment = local.prefix-hub-nva
}
}
resource "azurerm_route_table" "hub-gateway-rt" {
name = "hub-gateway-rt"
location = azurerm_resource_group.hub-nva-
rg.location
resource_group_name = azurerm_resource_group.hub-nva-
rg.name
disable_bgp_route_propagation = false
route {
name = "toHub"
address_prefix = "10.0.0.0/16"
next_hop_type = "VnetLocal"
}
route {
name = "toSpoke1"
address_prefix = "10.1.0.0/16"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address = "10.0.0.36"
}
route {
name = "toSpoke2"
address_prefix = "10.2.0.0/16"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address = "10.0.0.36"
}
tags = {
environment = local.prefix-hub-nva
}
}
route {
name = "toSpoke2"
address_prefix = "10.2.0.0/16"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address = "10.0.0.36"
}
route {
name = "default"
address_prefix = "0.0.0.0/0"
next_hop_type = "vnetlocal"
}
tags = {
environment = local.prefix-hub-nva
}
}
route {
name = "toSpoke1"
address_prefix = "10.1.0.0/16"
next_hop_in_ip_address = "10.0.0.36"
next_hop_type = "VirtualAppliance"
}
route {
name = "default"
address_prefix = "0.0.0.0/0"
next_hop_type = "vnetlocal"
}
tags = {
environment = local.prefix-hub-nva
}
}
Next steps
Create a spoke virtual networks with Terraform in Azure
Create a spoke network in Azure using
Terraform
Article • 10/26/2023
In this article, you implement two separate spoke networks to demonstrate separation
of workloads. The networks share common resources using hub virtual network. Spokes
can be used to isolate workloads in their own VNets, managed separately from other
spokes. Each workload might include multiple tiers, with multiple subnets connected
through Azure load balancers.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Create a hub and spoke hybrid network topology with Terraform in Azure.
1. Make the example directory created in the first article of this series the current
directory.
Terraform
locals {
spoke1-location = "eastus"
spoke1-resource-group = "spoke1-vnet-rg"
prefix-spoke1 = "spoke1"
}
tags = {
environment = local.prefix-spoke1
}
}
allow_virtual_network_access = true
allow_forwarded_traffic = true
allow_gateway_transit = false
use_remote_gateways = true
depends_on = [azurerm_virtual_network.spoke1-vnet,
azurerm_virtual_network.hub-vnet , azurerm_virtual_network_gateway.hub-
vnet-gateway]
}
ip_configuration {
name = local.prefix-spoke1
subnet_id = azurerm_subnet.spoke1-mgmt.id
private_ip_address_allocation = "Dynamic"
}
}
storage_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
storage_os_disk {
name = "myosdisk1"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
os_profile {
computer_name = "${local.prefix-spoke1}-vm"
admin_username = var.username
admin_password = var.password
}
os_profile_linux_config {
disable_password_authentication = false
}
tags = {
environment = local.prefix-spoke1
}
}
Terraform
locals {
spoke2-location = "eastus"
spoke2-resource-group = "spoke2-vnet-rg"
prefix-spoke2 = "spoke2"
}
tags = {
environment = local.prefix-spoke2
}
}
allow_virtual_network_access = true
allow_forwarded_traffic = true
allow_gateway_transit = false
use_remote_gateways = true
depends_on = [azurerm_virtual_network.spoke2-vnet,
azurerm_virtual_network.hub-vnet, azurerm_virtual_network_gateway.hub-
vnet-gateway]
}
ip_configuration {
name = local.prefix-spoke2
subnet_id = azurerm_subnet.spoke2-mgmt.id
private_ip_address_allocation = "Dynamic"
}
tags = {
environment = local.prefix-spoke2
}
}
storage_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
storage_os_disk {
name = "myosdisk1"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
os_profile {
computer_name = "${local.prefix-spoke2}-vm"
admin_username = var.username
admin_password = var.password
}
os_profile_linux_config {
disable_password_authentication = false
}
tags = {
environment = local.prefix-spoke2
}
}
In this article, you execute the terraform files created in the previous article in this series.
The result is a validation of the connectivity between the demo virtual networks.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Create a hub and spoke hybrid network topology with Terraform in Azure
main.tf Create a hub and spoke hybrid network topology with Terraform in Azure
variables.tf Create a hub and spoke hybrid network topology with Terraform in Azure
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Bash
ssh azureuser@<onprem_vm_ip_address>
Key points:
If you changed the user name from azureuser in the variables.tf file, make
sure to insert that value in the ssh command.
Use the password you specified when you ran terraform plan .
6. Once connected to the onprem-vm virtual machine, run the ping command to
test connectivity to the jumpbox VM in the hub VNet:
Bash
ping 10.0.0.68
7. Run the ping command to test connectivity to the jumpbox VMs in each spoke:
Bash
ping 10.1.0.68
ping 10.2.0.68
8. To exit the ssh session on the onprem-vm virtual machine, enter exit and press
<Enter>.
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Configure an Azure Network Watcher
Connection using Terraform
Article • 10/26/2023
This article shows example Terraform code for setting up Network Watcher on Azure to
monitor the network health for a Network Security Group.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
features {}
}
security_rule {
name = "test123"
priority = 110
direction = "Inbound"
access = "Deny"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}
account_tier = "Standard"
account_replication_type = "GRS"
min_tls_version = "TLS1_2"
}
network_security_group_id =
azurerm_network_security_group.application1.id
storage_account_id =
azurerm_storage_account.network_log_data.id
enabled = true
retention_policy {
enabled = true
days = 90
}
traffic_analytics {
enabled = true
workspace_id =
azurerm_log_analytics_workspace.traffic_analytics.workspace_id
workspace_region =
azurerm_log_analytics_workspace.traffic_analytics.location
workspace_resource_id =
azurerm_log_analytics_workspace.traffic_analytics.id
interval_in_minutes = 10
}
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Next steps
Network security group flow logging
What is Application Gateway for
Containers?
Article • 05/09/2024
Application Gateway for Containers is an application layer (layer 7) load balancing and
dynamic traffic management product for workloads running in a Kubernetes cluster. It
extends Azure's Application Load Balancing portfolio and is a new offering under the
Application Gateway product family.
Application Gateway for Containers is the evolution of the Application Gateway Ingress
Controller (AGIC), a Kubernetes application that enables Azure Kubernetes Service (AKS)
customers to use Azure's native Application Gateway application load-balancer. In its
current form, AGIC monitors a subset of Kubernetes Resources for changes and applies
them to the Application Gateway, utilizing Azure Resource Manager (ARM).
Private IP address
Subnet Delegation
User-assigned Managed Identity
Application Gateway for Containers offers an elastic and scalable ingress to AKS clusters
and comprises a new data plane as well as control plane with new set of ARM APIs,
different from existing Application Gateway. These APIs are different from the current
implementation of Application Gateway. Application Gateway for Containers is outside
the AKS cluster data plane and is responsible for ingress. The service is managed by an
ALB controller component that runs inside the AKS cluster and adheres to Kubernetes
Gateway APIs.
Automatic retries
Autoscaling
Availability zone resiliency
Default and custom health probes
ECDSA and RSA certificate support
Header rewrite
HTTP/2
HTTPS traffic management:
SSL termination
End to End SSL
Ingress and Gateway API support
Layer 7 HTTP/HTTPS request forwarding based on prefix/exact match on:
Hostname
Path
Header
Query string
Methods
Ports (80/443)
Mutual authentication (mTLS) to backend target
Server-sent event (SSE) support
Traffic splitting / weighted round robin
TLS policies
URL redirect
URL rewrite
Deployment strategies
There are two deployment strategies for management of Application Gateway for
Containers:
Bring your own (BYO) deployment: In this deployment strategy, deployment and
lifecycle of the Application Gateway for Containers resource, Association resource,
and Frontend resource is assumed via Azure portal, CLI, PowerShell, Terraform, etc.
and referenced in configuration within Kubernetes.
In Gateway API: Every time you wish to create a new Gateway resource in
Kubernetes, a Frontend resource should be provisioned in Azure prior and
referenced by the Gateway resource. Deletion of the Frontend resource is
responsible by the Azure administrator and isn't deleted when the Gateway
resource in Kubernetes is deleted.
Managed by ALB Controller: In this deployment strategy, ALB Controller deployed
in Kubernetes is responsible for the lifecycle of the Application Gateway for
Containers resource and its sub resources. ALB Controller creates the Application
Gateway for Containers resource when an ApplicationLoadBalancer custom
resource is defined on the cluster and its lifecycle is based on the lifecycle of the
custom resource.
In Gateway API: Every time a Gateway resource is created referencing the
ApplicationLoadBalancer resource, ALB Controller provisions a new Frontend
resource and manage its lifecycle based on the lifecycle of the Gateway
resource.
Supported regions
Application Gateway for Containers is currently offered in the following regions:
Australia East
Canada Central
Central India
Central US
East Asia
East US
East US2
France Central
Germany West Central
Korea Central
North Central US
North Europe
Norway East
South Central US
Southeast Asia
Switzerland North
UAE North
UK South
West US
West Europe
ノ Expand table
GatewayClass Yes
Gateway Yes Support for HTTP and HTTPS protocol on the listener. The only
ports allowed on the listener are 80 and 443.
HTTPRoute Yes
ノ Expand table
Ingress Yes Support for HTTP and HTTPS protocol on the listener.
For Application Gateway for Containers SLA information, see Service Level Agreements
(SLA) for Online Services .
What's new
To learn what's new with Application Gateway for Containers, see Azure updates .
Next steps
Concepts: Application Gateway for Containers components
Quickstart: Deploy Application Gateway for Containers ALB Controller
Feedback
Was this page helpful? Yes No
If you use Terraform to deploy standard Azure Firewall with classic rules, you can modify
your Terraform configuration file to migrate your firewall to Azure Firewall Premium
using a Premium firewall policy.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
ip_configuration {
name = "configuration"
subnet_id = azurerm_subnet.subnet.id
public_ip_address_id = azurerm_public_ip.pip.id
}
}
rule {
name = "testrule"
source_addresses = [
"10.0.0.0/16",
]
target_fqdns = [
"*.google.com",
]
protocol {
port = "443"
type = "Https"
}
}
}
rule {
name = "dnsrule"
source_addresses = [
"10.0.0.0/16",
]
destination_ports = [
"53",
]
destination_addresses = [
"8.8.8.8",
"8.8.4.4",
]
protocols = [
"TCP",
"UDP",
]
}
}
Terraform
variable "resource_group_location" {
type = string
default = "eastus"
description = "Location of the resource group."
}
variable "prefix" {
type = string
default = "firewall-standard"
description = "Prefix of the resource name"
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
Terraform
Terraform
ip_configuration {
name = "configuration"
subnet_id = azurerm_subnet.subnet.id
public_ip_address_id = azurerm_public_ip.pip.id
}
}
Terraform
rule {
name = "testrule"
source_addresses = [
"10.0.0.0/16",
]
target_fqdns = [
"*.google.com",
]
protocol {
port = "443"
type = "Https"
}
}
}
rule {
name = "dnsrule"
source_addresses = [
"10.0.0.0/16",
]
destination_ports = [
"53",
]
destination_addresses = [
"8.8.8.8",
"8.8.4.4",
]
protocols = [
"TCP",
"UDP",
]
}
}
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
terraform apply main.destroy.tfplan
Next steps
Learn more about using Terraform in Azure
Configure Azure Virtual Desktop with
Terraform
Article • 03/20/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.7
AzureRM Provider v.2.99.0
This article provides an overview of how to use Terraform to deploy an ARM Azure
Virtual Desktop environment, not AVD Classic.
New to Azure Virtual Desktop? Start with What is Azure Virtual Desktop?
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
resource "azurerm_virtual_desktop_host_pool_registration_info"
"registrationinfo" {
hostpool_id = azurerm_virtual_desktop_host_pool.hostpool.id
expiration_date = var.rfc3339
}
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "rg_name" {
type = string
default = "rg-avd-resources"
description = "Name of the Resource group in which to deploy service
objects"
}
variable "workspace" {
type = string
description = "Name of the Azure Virtual Desktop workspace"
default = "AVD TF Workspace"
}
variable "hostpool" {
type = string
description = "Name of the Azure Virtual Desktop host pool"
default = "AVD-TF-HP"
}
variable "rfc3339" {
type = string
default = "2022-03-30T12:43:13Z"
description = "Registration token expiration"
}
variable "prefix" {
type = string
default = "avdtf"
description = "Prefix of the name of the AVD machine(s)"
}
output "azure_virtual_desktop_compute_resource_group" {
description = "Name of the Resource group in which to deploy session
host"
value = azurerm_resource_group.sh.name
}
output "azure_virtual_desktop_host_pool" {
description = "Name of the Azure Virtual Desktop host pool"
value = azurerm_virtual_desktop_host_pool.hostpool.name
}
output "azurerm_virtual_desktop_application_group" {
description = "Name of the Azure Virtual Desktop DAG"
value = azurerm_virtual_desktop_application_group.dag.name
}
output "azurerm_virtual_desktop_workspace" {
description = "Name of the Azure Virtual Desktop workspace"
value = azurerm_virtual_desktop_workspace.workspace.name
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.sh.location
}
output "AVD_user_groupname" {
description = "Azure Active Directory Group for AVD users"
value = azuread_group.aad_group.display_name
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Configure Azure Virtual Desktop session
hosts using Terraform
Article • 10/26/2023
This article shows you how to build Session Hosts and deploy them to an AVD Host Pool
with Terraform. This article assumes you've already deployed the Azure Virtual Desktop
Infrastructure.
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.7
AzureRM Provider v.2.99.0
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Key points:
of these resources from that section, you also need to update the references
here.
Terraform
locals {
registration_token =
azurerm_virtual_desktop_host_pool_registration_info.registrationinfo.to
ken
}
ip_configuration {
name = "nic${count.index + 1}_config"
subnet_id = azurerm_subnet.subnet.id
private_ip_address_allocation = "dynamic"
}
depends_on = [
azurerm_resource_group.rg
]
}
os_disk {
name = "${lower(var.prefix)}-${count.index + 1}"
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "MicrosoftWindowsDesktop"
offer = "Windows-10"
sku = "20h2-evd"
version = "latest"
}
depends_on = [
azurerm_resource_group.rg,
azurerm_network_interface.avd_vm_nic
]
}
settings = <<SETTINGS
{
"Name": "${var.domain_name}",
"OUPath": "${var.ou_path}",
"User": "${var.domain_user_upn}@${var.domain_name}",
"Restart": "true",
"Options": "3"
}
SETTINGS
protected_settings = <<PROTECTED_SETTINGS
{
"Password": "${var.domain_password}"
}
PROTECTED_SETTINGS
lifecycle {
ignore_changes = [settings, protected_settings]
}
depends_on = [
azurerm_virtual_network_peering.peer1,
azurerm_virtual_network_peering.peer2
]
}
settings = <<-SETTINGS
{
"modulesUrl":
"https://wvdportalstorageblob.blob.core.windows.net/galleryartifacts/Co
nfiguration_09-08-2022.zip",
"configurationFunction": "Configuration.ps1\\AddSessionHost",
"properties": {
"HostPoolName":"${azurerm_virtual_desktop_host_pool.hostpool.name}"
}
}
SETTINGS
protected_settings = <<PROTECTED_SETTINGS
{
"properties": {
"registrationInfoToken": "${local.registration_token}"
}
}
PROTECTED_SETTINGS
depends_on = [
azurerm_virtual_machine_extension.domain_join,
azurerm_virtual_desktop_host_pool.hostpool
]
}
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "rg" {
type = string
default = "rg-avd-compute"
description = "Name of the Resource group in which to deploy session host"
}
variable "rdsh_count" {
description = "Number of AVD machines to deploy"
default = 2
}
variable "prefix" {
type = string
default = "avdtf"
description = "Prefix of the name of the AVD machine(s)"
}
variable "domain_name" {
type = string
default = "infra.local"
description = "Name of the domain to join"
}
variable "domain_user_upn" {
type = string
default = "domainjoineruser" # do not include domain name as this is
appended
description = "Username for domain join (do not include domain name as
this is appended)"
}
variable "domain_password" {
type = string
default = "ChangeMe123!"
description = "Password of the user to authenticate with the domain"
sensitive = true
}
variable "vm_size" {
description = "Size of the machine to deploy"
default = "Standard_DS2_v2"
}
variable "ou_path" {
default = ""
}
variable "local_admin_username" {
type = string
default = "localadm"
description = "local admin username"
}
variable "local_admin_password" {
type = string
default = "ChangeMe123!"
description = "local admin password"
sensitive = true
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.rg.location
}
output "session_host_count" {
description = "The number of VMs created"
value = var.rdsh_count
}
output "dnsservers" {
description = "Custom DNS configuration"
value = azurerm_virtual_network.vnet.dns_servers
}
output "vnetrange" {
description = "Address range for deployment vnet"
value = azurerm_virtual_network.vnet.address_space
}
1. Create a file named terraform.tfvars and insert the following code:
Terraform
# Customized the sample values below for your environment and either
rename to terraform.tfvars or env.auto.tfvars
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
terraform plan -out main.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Configure Azure Virtual Desktop role-
based access control using Terraform
Article • 11/07/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.4
AzureRM Provider v.2.94.0
This article will walk through adding our users and Microsoft Entra group and then
assign the group to the "Desktop Virtualization User" role, scoped to our host pool.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "avd_users" {
description = "AVD users"
default = [
"[email protected]",
"[email protected]"
]
}
variable "aad_group_name" {
type = string
default = "AVDUsers"
description = "Azure Active Directory Group for AVD users"
}
output "AVD_user_groupname" {
description = "Azure Active Directory Group for AVD users"
value = azuread_group.aad_group.display_name
}
6. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
7. Create a Terraform execution plan
Run terraform plan to create an execution plan.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
You are now ready to build and deploy your infrastructure with role based access
control.
9. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about Configuring Azure Virtual Desktop session hosts using
Terraform in Azure
Configure Azure Virtual Desktop
Network Settings with Terraform
Article • 10/26/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.7
AzureRM Provider v.2.99.0
This article provides an overview of how to use Terraform to configure the network
settings for Azure Virtual Desktop.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
resource "azurerm_subnet_network_security_group_association"
"nsg_assoc" {
subnet_id = azurerm_subnet.subnet.id
network_security_group_id = azurerm_network_security_group.nsg.id
}
variable "resource_group_location" {
default = "eastus"
description = "Location of the resource group."
}
variable "rg_name" {
type = string
default = "rg-avd-resources"
description = "Name of the Resource group in which to deploy service
objects"
}
variable "rg_shared_name" {
type = string
default = "rg-shared-resources"
description = "Name of the Resource group in which to deploy shared
resources"
}
variable "deploy_location" {
type = string
default = "eastus"
description = "The Azure Region in which all resources in this example
should be created."
}
variable "ad_vnet" {
type = string
default = "infra-network"
description = "Name of domain controller vnet"
}
variable "dns_servers" {
type = list(string)
default = ["10.0.1.4", "168.63.129.16"]
description = "Custom DNS configuration"
}
variable "vnet_range" {
type = list(string)
default = ["10.2.0.0/16"]
description = "Address range for deployment VNet"
}
variable "subnet_range" {
type = list(string)
default = ["10.2.0.0/24"]
description = "Address range for session host subnet"
}
variable "prefix" {
type = string
default = "avdtf"
description = "Prefix of the name of the AVD machine(s)"
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.rg.location
}
output "dnsservers" {
description = "Custom DNS configuration"
value = azurerm_virtual_network.vnet.dns_servers
}
output "vnetrange" {
description = "Address range for deployment vnet"
value = azurerm_virtual_network.vnet.address_space
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
5. Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Configure Azure Files using Terraform
Article • 10/26/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.7
AzureRM Provider v.2.99.0
Azure offers multiple storage solutions that you can use to store your FSLogix profiles
container. This article covers configuring Azure Files storage solutions for Azure Virtual
Desktop FSLogix user profile containers using Terraform
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "deploy_location" {
type = string
default = "eastus"
description = "The Azure Region in which all resources in this example
should be created."
}
variable "rg_stor" {
type = string
default = "rg-avd-storage"
description = "Name of the Resource group in which to deploy storage"
}
variable "avd_users" {
description = "AVD users"
default = [
"[email protected]",
"[email protected]"
]
}
variable "aad_group_name" {
type = string
default = "AVDUsers"
description = "Azure Active Directory Group for AVD users"
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.rg_storage.location
}
output "storage_account" {
description = "Storage account for Profiles"
value = azurerm_storage_account.storage.name
}
output "storage_account_share" {
description = "Name of the Azure File Share created for FSLogix"
value = azurerm_storage_share.FSShare.name
}
output "AVD_user_groupname" {
description = "Azure Active Directory Group for AVD users"
value = azuread_group.aad_group.display_name
}
3. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
terraform plan -out main.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
6. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Configure Azure Compute Gallery with
Terraform
Article • 10/26/2023
" Use Terraform to configure Azure Compute Gallery (formerly Shared Image Gallery)
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
tags = {
Environment = "Demo"
Tech = "Terraform"
}
}
identifier {
publisher = "MicrosoftWindowsDesktop"
offer = "office-365"
sku = "20h2-evd-o365pp"
}
}
variable "deploy_location" {
type = string
default = "eastus"
description = "The Azure Region in which all resources in this example
should be created."
}
variable "rg_shared_name" {
type = string
default = "rg-shared-resources"
description = "Name of the Resource group in which to deploy shared
resources"
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.sigrg.location
}
output "Compute_Gallery" {
description = "Azure Compute Gallery"
value = azurerm_shared_image_gallery.sig.name
}
Console
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
5. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Key points:
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Create an Azure Log Analytics
Workspace using Terraform
Article • 10/26/2023
Article tested with the following Terraform and Terraform provider versions:
Terraform v1.1.7
AzureRM Provider v.2.99.0
Azure offers multiple storage solutions that you can use to store your FSLogix profiles
container. This article covers configuring Azure Files storage solutions for Azure Virtual
Desktop FSLogix user profile containers using Terraform. This article shows you how to
create a Log Analytics workspace using Terraform.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
Terraform
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}
provider "azurerm" {
features {}
}
Terraform
variable "deploy_location" {
type = string
default = "eastus"
description = "The Azure Region in which all resources in this example
should be created."
}
variable "rg_shared_name" {
type = string
default = "rg-shared-resources"
description = "Name of the Resource group in which to deploy shared
resources"
}
output "location" {
description = "The Azure region"
value = azurerm_resource_group.log.location
}
output "log_analytics" {
description = "Log Analytics Workspace"
value = azurerm_log_analytics_workspace.law.name
}
4. Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads
the Azure provider required to manage your Azure resources.
Console
Key points:
The -upgrade parameter upgrades the necessary provider plugins to the newest
version that complies with the configuration's version constraints.
Console
terraform plan -out main.tfplan
Key points:
The terraform plan command creates an execution plan, but doesn't execute it.
Instead, it determines what actions are necessary to create the configuration
specified in your configuration files. This pattern allows you to verify whether the
execution plan matches your expectations before making any changes to actual
resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what is
applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Key points:
The example terraform apply command assumes you previously ran terraform
plan -out main.tfplan .
If you specified a different filename for the -out parameter, use that same
filename in the call to terraform apply .
If you didn't use the -out parameter, call terraform apply without any parameters.
7. Clean up resources
When you no longer need the resources created via Terraform, do the following steps:
Console
The terraform plan command creates an execution plan, but doesn't execute
it. Instead, it determines what actions are necessary to create the
configuration specified in your configuration files. This pattern allows you to
verify whether the execution plan matches your expectations before making
any changes to actual resources.
The optional -out parameter allows you to specify an output file for the plan.
Using the -out parameter ensures that the plan you reviewed is exactly what
is applied.
To read more about persisting execution plans and security, see the security
warning section .
Console
Next steps
Learn more about using Terraform in Azure
Provision infrastructure with Azure
deployment slots using Terraform
Article • 10/26/2023
You can use Azure deployment slots to swap between different versions of your app.
That ability helps you minimize the impact of broken deployments.
This article illustrates an example use of deployment slots by walking you through the
deployment of two apps via GitHub and Azure. One app is hosted in a production slot.
The second app is hosted in a staging slot. (The names "production" and "staging" are
arbitrary. They can be whatever is appropriate for your scenario.) After you configure
your deployment slots, you use Terraform to swap between the two slots as needed.
Configure Terraform: If you haven't already done so, configure Terraform using
one of the following options:
Configure Terraform in Azure Cloud Shell with Bash
Configure Terraform in Azure Cloud Shell with PowerShell
Configure Terraform in Windows with Bash
Configure Terraform in Windows with PowerShell
GitHub account: You need a GitHub account to fork and use the test GitHub
repo.
2. Create and apply the Terraform plan
1. Browse to the Azure portal .
2. Open Azure Cloud Shell. If you didn't select an environment previously, select Bash
as your environment.
Bash
cd clouddrive
Bash
mkdir deploy
Bash
mkdir swap
6. Use the ls bash command to verify that you successfully created both directories.
cd deploy
Bash
code deploy.tf
10. Save the file (<Ctrl>S) and exit the editor (<Ctrl>Q).
11. Now that you've created the file, verify its contents.
Bash
cat deploy.tf
Bash
terraform init
Bash
terraform plan
14. Provision the resources that are defined in the deploy.tf configuration file.
(Confirm the action by entering yes at the prompt.)
Bash
terraform apply
16. On the main menu of the Azure portal, select Resource groups.
17. On the Resource groups tab, select slotDemoResourceGroup.
You now see all the resources that Terraform has created.
2. Select slotDemoResourceGroup.
3. Select slotAppService.
7. On the Authorization tab, select Authorize, and supply the credentials that Azure
needs to access your GitHub account.
8. After Azure validates your GitHub credentials, a message appears and says that the
authorization process has finished. Select OK to close the Authorization tab.
At this point, you've deployed the production slot. To deploy the staging slot, do the
previous steps with the following modifications:
2. Select slotDemoResourceGroup.
slotAppService web app - Blue page with a page title of Slot Demo App 1.
slotAppServiceSlotOne web app - Green page with a page title of Slot Demo
App 2.
1. Switch to the browser tab that's running slotAppService (the app with the blue
page).
Bash
cd clouddrive/swap
Bash
code swap.tf
6. Insert the following code into the editor:
8. Initialize Terraform.
Bash
terraform init
Bash
terraform plan
10. Provision the resources that are defined in the swap.tf configuration file. (Confirm
the action by entering yes at the prompt.)
Bash
terraform apply
11. After Terraform has swapped the slots, return to the browser. Refresh the page.
The web app in your slotAppServiceSlotOne staging slot has been swapped with the
production slot and is now rendered in green.
To return to the original production version of the app, reapply the Terraform plan that
you created from the swap.tf configuration file.
Bash
terraform apply
Next steps
Learn more about using Terraform in Azure
Terraform AzureRM provider version
history
Article • 06/21/2024
This article contains the following change logs from the HashiCorp site showing the
Terraform AzureRM provider versions:
(#25449 )
New Resource: azurerm_system_center_virtual_machine_manager_virtual_network
(#25451 )
ENHANCEMENTS:
properties (#26397 )
BUG FIXES:
(#26339 )
azurerm_virtual_hub_* - spliting create and update so lifecycle ignore changes
DEPRECATIONS:
(#26354 )
ENHANCEMENTS:
provider: support subscription ID hinting when using Azure CLI authentication
(#26282 )
serviceconnector : updating to use API Version 2024-04-01 (#26248 )
azurerm_container_groups - can now be created with a User Assigned Identity
property to azure and calico when it isn't previously set is supported (#26176 )
azurerm_kubernetes_cluster - respect Pod Distruption Budgets when rotating the
default_node_pool (#26274 )
azurerm_lb_backend_address_pool - support for the synchronous_mode property
(#26309 )
azurerm_private_endpoint - support symultaneous creation of multiple resources
BUG FIXES:
azurerm_express_route_circuit_peering , azurerm_express_route_circuit ,
update (#26237 )
azurerm_lb_backend_address_pool_address - when using this resource, values are
DEPRECATIONS:
(#26293 )
azurerm_api_management - the policy block is deprecated and superseded with the
azurerm_api_management_policy resource (#26305 )
azurerm_kubernetes_cluster - the ebpf_data_plane property is deprecated and
New Resource:
azurerm_data_protection_backup_policy_postgresql_flexible_server (#26024 )
ENHANCEMENTS:
(#26196 )
network/virtualnetworks - update to use hashicorp/go-azure-sdk (#26217 )
network/virtualwans : update route resources to use hashicorp/go-azure-sdk
(#26189 )
azurerm_container_app_job - support for the key_vault_secret_id and identity
(#26188 )
azurerm_subnet - support for the default_outbound_access_enabled property
(#25259 )
BUG FIXES:
azurerm_api_management_named_value - now enforces setting the secret property
inconsistencies (#26204 )
azurerm_virtual_network - split create and update function to fix lifecycle - ignore
(#26246 )
azurerm_vpn_server_configuration - split create and update function to fix lifecycle
- ignore (#26175 )
azurerm_vpn_server_configuration_policy_group - split create and update function
changes (#26163 )
DEPRECATIONS:
This release updates the Key Vault cache to load Key Vaults using both the Key
Vaults List API and the Resources API to workaround the API returning
incomplete/stale data. To achieve this pattern, and provide consistency between
tooling, we're intentionally using the same older version of the Resources API as
the current version of Azure CLI. (#26070 )
FEATURES:
ENHANCEMENTS:
(#26106 )
azurerm_bastion_host - support for Developer SKU (#26068 )
azurerm_container_app_environment - support for the mutual_tls_enabled property
(#25993 )
azurerm_container_registry - validation to fail fast when setting
public_network_access_enabled with an invalid SKU (#26054 )
azurerm_key_vault_managed_hardware_security_module - the
public_network_access_enabled property can now be updated (#26075 )
azurerm_kubernetes_cluster - support for the cost_analysis_enabled property
(#26052 )
azurerm_kubernetes_cluster - support for the drain_timeout_in_minutes and
(#26137 )
azurerm_kubernetes_cluster_node_pool - support for the drain_timeout_in_minutes
updated (#26112 )
azurerm_logic_app_trigger_custom - support for the property callback_url
(#25979 )
azurerm_machine_learning_workspace - support for the serverless_compute block
(#25660 )
azurerm_mssql_elasticpool - support the sku HS_PRMS (#26161 )
azurerm_new_relic_monitor - support for the identity block (#26115 )
azurerm_route_map - the parameter property is now Optional when the action type
is Drop (#26003 )
azurerm_windows_virtual_machine - the hibernation_enabled property can now be
updated (#26112 )
BUG FIXES:
Assigned Identity used for accessing the Key Vault is assigned to the EventHub
Namespace (#28509 )
azurerm_linux_function_app - fix update handling of
health_check_eviction_time_in_min and WEBSITE_HEALTHCHECK_MAXPINGFAILURES
(#26107 )
azurerm_linux_function_app_slot - fix update handling of
(#26107 )
azurerm_linux_web_app - fix update handling of
(#26107 )
azurerm_linux_web_app_slot - fix update handling of
health_check_eviction_time_in_min and WEBSITE_HEALTHCHECK_MAXPINGFAILURES
(#26107 )
azurerm_postgresql_flexible_server - prevent premature check on updated
storage_mb value that prevents the resource from being re-created (#25986 )
azurerm_redis_access_cache_policy_assignment - add locks to stabilize creation of
(#26107 )
azurerm_windows_function_app_slot - fix update handling of
health_check_eviction_time_in_min and WEBSITE_HEALTHCHECK_MAXPINGFAILURES
(#26107 )
azurerm_windows_web_app - fix update handling of
(#26107 )
azurerm_windows_web_app_slot - fix update handling of
(#26107 )
workload_autoscaler_profile.vertical_pod_autoscaler_update_mode and
workload_autoscaler_profile.vertical_pod_autoscaler_controlled_values are no
FEATURES:
ENHANCEMENTS:
(#25885 )
azurerm_machine_learning_compute_cluster - add validation for name (#26060 )
azurerm_machine_learning_compute_cluster - improve validation to allow an empty
(#26073 )
azurerm_postgresql_flexible_server - the field public_network_access_enabled is
now configurable (previously this was computed-only/not settable via the API)
(#25812 )
azurerm_snapshot - support for disk_access_id (#25996 )
azurerm_windows_web_app - normalising the value for virtual_network_subnet_id
(#25885 )
BUG FIXES:
specified (#26059 )
azurerm_pim_eligible_role_assignment - fix a persistent diff when ticket is not
specified (#26059 )
azurerm_policy_definition - recreate the resource if the parameters property is
ENHANCEMENTS:
property (#25919 )
azurerm_key_vault - allow previously existing key vaults to continue to manage the
BUG FIXES:
be 0 (#25931 )
azurerm_container_app_job - update validation to allow the replica_retry_limit
virtual network status when creating a node pool with a subnet ID (#25888 )
azurerm_postgresql_flexible_server - fix for default storage_tier value when
(#25956 )
azurerm_pim_eligible_role_assignment - resolves several potential crashes
(#25956 )
azurerm_redis_enterprise_cluster_location_zone_support - add Central India
zones support (#26000 )
azurerm_sentinel_alert_rule_scheduled - the alert_rule_template_version
loadtest - fixing an issue where the SDK Clients weren't registered (#25920 )
ENHANCEMENTS:
hibernation_enabled (#25807 )
azurerm_linux_virtual_machine - support for more values for the license_type
property (#25909 )
azurerm_linux_virtual_machine_scale_set - support for the
maximum_surge_instances property for vmss rolling upgrades (#24914 )
azurerm_windows_virtual_machine - support for the more capability
hibernation_enabled (#25807 )
azurerm_windows_virtual_machine_scale_set - support for the
BUG FIXES:
(#25530 )
azurerm_log_analytics_saved_search - the function_parameters property now
(#25853 )
azurerm_web_pubsub_network_acl - fixing a crash when
DEPRECATIONS:
ENHANCEMENTS:
(#25088 )
azurerm_storage_account_customer_managed_key - support for the
default (#23911 )
azurerm_resource_group - work around sporadic eventual consistency errors
(#25758 )
DEPRECATIONS:
azurerm_key_vault_managed_hardware_security_module_role_assignment - the
(#25601 )
ConversationalLanguageUnderstanding (#25735 )
azurerm_container_app_custom_domain - support the ability to use Azure Managed
Certificates (#25356 )
BUG FIXES:
(#25712 )
azurerm_virtual_network_gateway - preserve existing nat_rules on updates
(#25690 )
purge_soft_deleted_workspace_on_destroy (#25624 )
loganalytics - update cluster resource to use hashicorp/go-azure-sdk (#23373 )
Data Source: azurerm_management_group - now exports the tenant_scoped_id
attribute (#25555 )
azurerm_container_app - the ingress.ip_security_restriction.ip_address_range
block (#25629 )
azurerm_hdinsight_hbase_cluster - support for the private_link_configuration
block (#25629 )
azurerm_hdinsight_interactive_query_cluster - support for the
block (#25629 )
azurerm_management_group - now exports the tenant_scoped_id attribute
(#25555 )
azurerm_monitor_activity_log_alert - support for the location property
(#25389 )
azurerm_mysql_flexible_server - update validating regex for sku_name (#25642 )
azurerm_postgresql_flexible_server - support for the GeoRestore create_mode
(#25664 )
azurerm_virtual_network_gateway_connection - support for the
BUG FIXES:
storage: prevent a bug causing the second storage account key to be used for
authentication instead of the first (#25652 )
azurerm_active_directory_domain_service - prevent an issue where
filtered_sync_enabled was not being updated (#25594 )
azurerm_application_insights - add a state migration to fix the resource ID casing
blob_properties.restore_policy (#25450 )
azurerm_web_app_hybrid_connection - can now use relay resources created in a
(#25488 )
azurerm_windows_web_app_slot - prevent removal of
(#25489 )
DEPRECATIONS:
logz - the Logz resources are deprecated and will be removed in v4.0 of the
AzureRM Provider since the API no longer allows new instances to be created
(#25405 )
azurerm_machine_learning_compute_instance - marked the location field as
the API no longer supports cluster creation with legacy Azure Entra integration:
client_app_id , server_app_id , server_app_secret and managed (#25200 )
ENHANCEMENTS:
(#25546 )
dependencies: updating to v0.26.1 of github.com/tombuildsstuff/giovanni
(#25551 )
azurerm_key_vault - deprecate the contact property from v3.x provider and
optional to allow for deletion of contacts from the key vault (#25552 )
azurerm_signalr_service - support for setting the sku property to Premium_P2
(#25578 )
azurerm_snapshot - support for the network_access_policy and
public_network_access_enabled properties (#25421 )
azurerm_storage_account - extend the support level of
(blob|queue|share)_properties for Storage kind (#25427 )
azurerm_storage_blob - support for the encryption_scope property (#25551 )
azurerm_storage_container - support for the default_encryption_scope and
encryption_scope_override_enabled properties (#25551 )
azurerm_storage_data_lake_gen2_filesystem - support for the
default_encryption_scope property (#25551 )
azurerm_subnet - the delegation.x.service_delegation.x.name property now
BUG FIXES:
provider: fix an issue where the provider was not correctly configured when using a
custom metadata host (#25546 )
storage: fixes several potential crashes during plan/apply with resources using the
Storage data plane API (#25525 )
azurerm_application_insights - fix issue where the wrong Application ID was set
(#24520 )
azurerm_linux_function_app - now taints the resource when partially created
(#24520 )
azurerm_managed_disk - filtering the Resource SKUs response to reduce the
(#24520 )
azurerm_windows_function_app - doesn't taint the resource when partially created
(#24520 )
DEPRECATIONS:
free_tier_enabled (#25510 )
azurerm_cosmosdb_account - the enable_multiple_write_locations property is
by automatic_failover_enabled (#25510 )
ENHANCEMENTS:
(#25486 )
applicationinsights - updating remaining resources to use hashicorp/go-azure-
sdk (#25376 )
compute - update to API version 2024-03-01 (#25436 )
compute - update shared image resources and data sources to use hashicorp/go-
azure-sdk (#25503 )
containerinstance - update to use the transport layer from hashicorp/go-azure-
vm_backup_stop_protection_and_retain_data_on_destroy and
purge_protected_items_from_vault_on_destroy (#25515 )
storage - the Storage Account cache is now populated using hashicorp/go-azure-
sdk (#25437 )
azurerm_bot_service_azure_bot - support for the cmk_key_vault_key_url property
(#23640 )
azurerm_capacity_reservation - update validation for capacity (#25471 )
azurerm_container_app - add support for key_vault_id and identity properties in
CMK's. (#25091 )
azurerm_databricks_workspace_root_dbfs_customer_managed_key - expose
key_vault_id to support cross subscription CMK's. (#25091 )
azurerm_managed_hsm_role_*_ids - use specific resource id to replace generic
(#25365 )
azurerm_mssql_server_extended_auditing_policy - support for
audit_actions_and_groups and predicate_expression (#25425 )
azurerm_netapp_account - can now be imported (#25384 )
azurerm_netapp_volume - support for the kerberos_enabled ,
smb_continuous_availability_enabled , kerberos_5_read_only_enabled ,
kerberos_5_read_write_enabled , kerberos_5i_read_only_enabled ,
kerberos_5i_read_write_enabled , kerberos_5p_read_only_enabled , and
BUG FIXES:
network - updating the GatewaySubnet validation to show the Subnet Name when
the validation fails (#25484 )
azurerm_function_app_hybrid_connection - fix an issue during creation when
send_key_name is specified (#25379 )
azurerm_linux_web_app_slot - fix a crash when upgrading the provider to v3.88.0
or later (#25406 )
azurerm_mssql_database - update the behavior of the enclave_type field.
(#25508 )
azurerm_mssql_elasticpool - update the behavior of the enclave_type field.
(#25508 )
azurerm_network_manager_deployment - add locking (#25368 )
azurerm_resource_group_template_deployment - changes to parameters_content
(#25404 )
azurerm_storage_container - fix a potential crash when the endpoint is
unreachable (#25404 )
azurerm_storage_data_lake_gen2_filesystem - fix a potential crash when the
(#25404 )
azurerm_storage_share - fix a potential crash when the endpoint is unreachable
(#25404 )
azurerm_storage_share_directory - fix a potential crash when the endpoint is
unreachable (#25404 )
azurerm_storage_share_directory - resolve an issue where directories might fail to
destroy (#25404 )
azurerm_storage_share_file - fix a potential crash when the endpoint is
unreachable (#25404 )
azurerm_storage_share_file - fix several bugs with path handling when creating
BUG FIXES:
FEATURES:
ENHANCEMENTS:
(#25350 )
cosmosdb : updating to use the transport layer from hashicorp/go-azure-sdk rather
(#25271 )
azurerm_automanage_configuration - refactoring to use hashicorp/go-azure-sdk
(#25293 )
azurerm_container_app_environment - add support for Consumption workload
profile (#25285 )
azurerm_cosmosdb_postgresql_cluster - expose list of server names and FQDN in
BUG FIXES:
Data Source: azurerm_storage_blob - fix a bug that incorrectly parsed the endpoint
in the resource ID (#25283 )
Data Source: azurerm_storage_table_entity - fixing a regression when parsing the
table endpoint (#25307 )
netapp_account_resource - correct the smb_server_name property validation
(#25340 )
azurerm_backup_policy_file_share - prevent a bug when the include_last_days
property does not work when days is empty (#25280 )
azurerm_backup_policy_vm - prevent a bug when the include_last_days property
(#25181 )
BUG FIXES:
import (#25192 )
azurerm_windows_web_app - fix incorrect warning message when checking name
availability (#25214 )
azurerm_virtual_machine_run_command - prevent a bug during updates (#25186 )
Data Source: azurerm_storage_table_entities - Fix items.x.properties truncating
to one entry (#25211 )
ENHANCEMENTS:
(#25127 )
azurerm_windows_function_app - support for the description property in the
properties (#25131 )
azurerm_windows_web_app - support for the description property in the
response (#25108 )
azurerm_app_service_public_certificate - fix issue where certificate information
(#25132 )
azurerm_storage_account - fix issue where the queue encryption key type was set
DEPRECATIONS:
(#25010 )
ENHANCEMENTS:
(#24966 )
azurerm_federated_identity_credential - the federated credentials can now be
property (#25079 )
azurerm_kubernetes_cluster - private DNS is now allowed for the web_app_routing
property (#25038 )
azurerm_kubernetes_cluster - migration between different outbound_type s is now
allowed (#25021 )
azurerm_mssql_database - support for the recovery_point_id and
treat_failure_as_deployment_failure_enabled , and
vm_agent_platform_updates_enabled properties (#23394 )
azurerm_nginx_deployment - support for the automatic_upgrade_channel property
(#24867 )
azurerm_netapp_volume - support for the smb_access_based_enumeration and
(#25008 )
azurerm_redis_cache - allow AAD auth for all SKUs (#25006 )
azurerm_sql_managed_instance - support for the zone_redundant_enabled property
(#25089 )
azurerm_spring_cloud_gateway - support for the
application_performance_monitoring_ids property (#24919 )
azurerm_spring_cloud_configuration_service - support for the
treat_failure_as_deployment_failure_enabled , and
BUG FIXES:
(#25000 )
azurerm_pim_active_role_assignment - fix an isue where the resource would
correctly (#25055 )
BUG FIXES:
azurerm_key_vault - conditionally polling the Data Plane endpoint when
public_network_access_enabled is set to false (#23823 )
azurerm_storage_account - allow the identity.type property to be
SystemAssigned, UserAssigned when using a Customer Managed Key (#24923 )
azurerm_automation_account - prevent the identity.identity_ids User Assigned
ENHANCEMENTS:
property (#24370 )
azurerm_servicebus_namespace - support for the premium_messaging_partitions
property (#24676 )
azurerm_windows_virtual_machine - the virtual_machine_scale_set_id proeprty
BUG FIXES:
(#24921 )
azurerm_kusto_cluster - optimized_auto_scale is now updated after sku is
updated (#24906 )
azurerm_key_vault_certificate - now only updates the lifetime_action of the
resource (#24905 )
azurerm_orchestrated_virtual_machine_scale_set - the disk_size_gb and lun
ENHANCEMENTS:
(#24258 )
azurerm_cosmosdb_account - add default values for the consistency_policy code
block (#24830 )
azurerm_dashboard_grafana - support for the smtp block (#24717 )
azurerm_key_vault_certificates - support for the tags property (#24857 )
azurerm_key_vault_secrets - support for the tags property (#24857 )
azurerm_orchestrated_virtual_machine_scale_set - support for the
additional_unattend_content block (#24292 )
azurerm_virtual_desktop_host_pool - support for the vm_template property
(#24369 )
BUG FIXES:
(#24877 )
azurerm_linux_web_app_slot - support off for the file_system_level property
(#24877 )
azurerm_private_endpoint - fixing an issue where updating the Private Endpoint
behaviour (#24837 )
azurerm_search_service - fixed the update function to adjust for changed API
behaviour (#24903 )
azurerm_windows_web_app - support off for the file_system_level property
(#24877 )
azurerm_windows_web_app_slot - support off for the file_system_level property
(#24877 )
(#24750 )
ENHANCEMENTS:
property (#24760 )
azurerm_storage_account - support for the local_user_enabled property
(#24800 )
azurerm_log_analytics_workspace_table - support for the total_retention_in_days
property (#24513 )
azurerm_maching_learning_workspace - support for the feature_store and kind
properties (#24716 )
azurerm_traffic_manager_azure_endpoint - support for the always_serve_enabled
property (#24573 )
azurerm_traffic_manager_external_endpoint - support for the
BUG FIXES:
with limited permissions, note that you must disable automatic Resource Provider
Registration and ensure that any Resource Providers Terraform requires are
registered. (#24645 )
FEATURES:
ENHANCEMENTS:
(#24615 )
azurerm_mssql_managed_database - support for the immutable_backups_enabled
property (#24745 )
azurerm_mssql_database - support for the immutable_backups_enabled property
(#24745 )
azurerm_palo_alto_next_generation_firewall_virtual_hub_panorama - support for
(#24650 )
azurerm_spring_cloud_api_portal - support for the api_try_out_enabled property
(#24696 )
azurerm_spring_cloud_gateway - support for the local_response_cache_per_route
(#24668 )
BUG FIXES:
provider: skip registration for resource providers that are unavailable (#24571 )
azurerm_app_configuration - no longer require lifecycle_ignore_changes for the
(#24700 )
azurerm_dns_cname_record - prevent casing issue in target_resource_id by parsing
(#24669 )
azurerm_storage_account - change update order for access_tier to prevent errors
ENHANCEMENTS:
to ZoneRedundant (#24556 )
azurerm_data_factory_integration_runtime_azure_ssis - support for the
credential_name property (#24458 )
azurerm_orchestrated_virtual_machine_scale_set - support 2022-datacenter-
BUG FIXES:
removed/emptied (#24582 )
insensitively (#24626 )
case-insensitively (#24626 )
specified (#24614 )
(#24264 )
(#24509 )
insensitively (#24626 )
case-insensitively (#24626 )
(#24562 )
(#24535 )
azurerm_mssql_managed_instance - now exports the dns_zone attribute (#24435 )
azurerm_linux_web_app_slot - support for setting python_version to 3.12
(#24363 )
azurerm_linux_web_app - support for setting python_version to 3.12 (#24363 )
azurerm_linux_function_app_slot - support for setting python_version to 3.12
(#24363 )
azurerm_linux_function_app - support for setting python_version to 3.12
(#24363 )
BUG FIXES:
transparent_data_encryption_key_vault_key_id and
transparent_data_encryption_key_automatic_rotation_enabled (#24412 )
Data Source: azurerm_mssql_server - support for
transparent_data_encryption_key_vault_key_id (#24412 )
machinelearning : updating to API Version 2023-10-01 (#24416 )
paloaltonetworks : updating to API Version 2023-09-01 (#24290 )
azurerm_container_app - update create time validations for
ingress.0.traffic_weight (#24042 )
azurerm_container_app - support for the ip_security_restriction block
(#23870 )
azurerm_kubernetes_cluster - properties in
default_node_pool.linux_os_config.sysctl_config are now updateable via node
transparent_data_encryption_key_automatic_rotation_enabled (#24412 )
azurerm_postgres_flexible_server - the sku_name property now supports being
property (#24406 )
BUG FIXES:
sensitive properties for bucket and git_repository were being overwritten after
an update to the resource is made (#24066 )
azurerm_kubernetes_flux_configuration - prevent a bug where certain sensitive
properties for bucket and git_repository were being overwritten after an update
to the resource is made (#24066 )
azure_linux_web_app - prevent a bug in App Service processing of
updated (#24409 )
ENHANCEMENTS:
property (#24312 )
azurerm_data_protection_backup_policy_disk - support for the time_zone property
(#24312 )
azurerm_key_vault_managed_hardware_security_module -the tags property can now
be updated (#24333 )
azurerm_logic_app_standard - support for the
(#24341 )
azurerm_linux_web_app - support the value 20-lts for the node_version property
(#24289 )
azurerm_recovery_services_vault - support creation with immutability set to
locked (#23806 )
azurerm_spring_cloud_service - support for the sku_tier property (#24103 )
BUG FIXES:
(#24306 )
azurerm_linux_virtual_machine - the
update (#24274 )
azurerm_logic_app_standard - update the default value of version from ~3 which
(#24322 )
azurerm_iothub_device_update_account - changing the sku property now creates a
update (#24274 )
azurerm_scheduled_query_rules_alert - changing the data_source_id now creates
ENHANCEMENTS:
hashicorp/go-azure-sdk (#24238 )
Data Source: azurerm_cognitive_account - export the identity block (#24214 )
Data Source: azurerm_monitor_workspace - add support for the
default_data_collection_endpoint_id and default_data_collection_rule_id
properties (#24153 )
Data Source: azurerm_shared_image_gallery - add support for the image_names
property (#24176 )
azurerm_dns_txt_record - allow up to 4096 characters for the property
record.value (#24169 )
azurerm_container_app - support for the workload_profile_name property
(#24219 )
azurerm_container_app - suppot for the init_container block (#23955 )
azurerm_hpc_cache_blob_nfs_target - support for the
(#24221 )
azurerm_linux_web_app_slot - fix a bug in app_settings where settings could be
lost (#24221 )
azurerm_log_analytics_workspace - add support for the
(#24236 )
azurerm_machine_learning_datastore_blobstorage - resource now skips validation
(#24101 )
azurerm_storage_blob - support for the source_content type Page (#24177 )
azurerm_web_application_firewall_policy - support new values to the
(#24221 )
azurerm_windows_web_app_slot - fix a bug in app_settings where settings could be
lost (#24221 )
azurerm_cognitive_account - add ContentSafety to the kind property validation
(#24205 )
BUG FIXES:
provider: fix an authentication issue with Azure Storage when running in Azure
China cloud (#24246 )
Data Source: azurerm_role_definition - fix bug where role_definition_id and
scope were being incorrectly set (#24211 )
azurerm_batch_account - fix bug where UserAssigned, SystemAssigned could be
(#24210 )
azurerm_storage_account - Fix crash when checking for
routingInputs.PublishInternetEndpoints and
routingInputs.PublishMicrosoftEndpoints (#24228 )
azurerm_storage_share_file - prevent panic when the file specified by source is
empty (#24179 )
azurerm_subscription_template_deployment - fixing a bug where
template_spec_version_id couldn't be updated (#24072 )
azurerm_tenant_template_deployment - fixing a bug where
template_spec_version_id couldn't be updated (#24072 )
azurerm_virtual_machine - prevent a panic by nil checking the first element of
additional_capabilities (#24159 )
azurerm_windows_web_app_slot - error when service_plan_id is identical to the
ENHANCEMENTS:
secondary_readonly_sql_connection_string , primary_mongodb_connection_string ,
secondary_mongodb_connection_string ,
primary_readonly_mongodb_connection_string , and
property (#24125 )
azurerm_container_app_environment - support for the workload_profile property
(#23478 )
azurerm_cosmosdb_cassandra_datacenter - support for the seed_node_ip_addresses
property (#24076 )
azurerm_firewall - support for the dns_proxy_enabled property (#20519 )
azurerm_kubernetes_cluster - support for the support_plan property and the
sku_tier Premium (#23970 )
azurerm_mssql_database - support for enclave_type field (#24054 )
azurerm_mssql_elasticpool - support for enclave_type field (#24054 )
azurerm_mssql_managed_instance - support for more vcores : 6 , 10 , 12 , 20 , 48 , 56 ,
96 , 128 (#24085 )
azurerm_redis_linked_server - support for the property
geo_replicated_primary_host_name (#23984 )
azurerm_storage_account - expose the primary and secondary internet and
microsoft hostnames for blobs, dfs, files, queues, tables and web (#23517 )
azurerm_synapse_role_assignment - support for the principal_type property
(#24089 )
azurerm_spring_cloud_build_deployment - support for the
application_performance_monitoring_ids property (#23969 )
azurerm_virtual_network_gateway - support for the
bgp_route_translation_for_nat_enabled , dns_forwarding_enabled ,
ip_sec_replay_protection_enabled , remote_vnet_traffic_enabled ,
virtual_wan_traffic_enabled , radius_server ,
virtual_network_gateway_client_connection , policy_group , and ipsec_policy
property (#23220 )
BUG FIXES:
deprecated (#24140 )
azurerm_hdinsight_hadoop_cluster - set
value provided in the user config since this property isn't returned by the API
(#23971 )
azurerm_kubernetes_cluster - prevent a bug where maintenance window start
Key Vaults are now loaded using the ListBySubscription API within the Key Vault
Resource Provider rather than the Resources API. This change means that the
Provider now caches the list of Key Vaults available within a Subscription, rather
than loading these piecemeal to workaround stale data returned from the
Resources API (#24019 )
FEATURES:
ENHANCEMENTS:
the KeyVault Resource Provider rather than via the Resources API (#24019 ).
keyvault : updating the cache to populate all Key Vaults available within the
video_analyzer_preset (#24002 )
azurerm_postgresql_database - update the validation of collation to include
Norwegian_Norway.1252 (#24070 )
azurerm_postgresql_flexible_server - updating to API Version 2023-06-01-
preview (#24016 )
azurerm_redis_cache - support for the active_directory_authentication_enabled
property (#23976 )
azurerm_windows_web_app - add support for dotnet 8 (#23893 )
azurerm_windows_web_app_slot - add support for dotnet 8 (#23893 )
azurerm_storage_account - add name validation in custom diff (#23799 )
BUG FIXES:
authentication: fix a bug where auxiliary tenants were not correctly authorized
(#24063 )
azurerm_app_configuration - normalize location in replica block (#24074 )
azurerm_cosmosdb_account - cosmosdb version and capabilities can now be
optional (#23987 )
azurerm_datadog_monitor_tag_rule - correctly handle default rule (#22806 )
azurerm_ip_group : fixing a crash when firewall_ids and firewall_policy_ids
ENHANCEMENTS:
(#23888 )
azurerm_hdinsight_hbase_cluster - script_actions is no longer Force New
(#23888 )
azurerm_hdinsight_interactive_query_cluster - script_actions is no longer Force
New (#23888 )
azurerm_hdinsight_kafka_cluster - script_actions is no longer Force New
(#23888 )
azurerm_hdinsight_spark_cluster - script_actions is no longer Force New
(#23888 )
azurerm_kubernetes_cluster - add support for the gpu_instance property
(#23887 )
azurerm_kubernetes_cluster_node_pool - add support for the gpu_instance
property (#23887 )
azurerm_log_analytics_workspace - add support for the identity property
(#23864 )
azurerm_linux_function_app - add support for dotnet 8 (#23638 )
azurerm_linux_function_app_slot - add support for dotnet 8 (#23638 )
azurerm_managed_lustre_file_system - export attribute mgs_address (#23942 )
azurerm_mssql_database - support for Hyperscale SKUs (#23974 )
azurerm_mssql_database - refactoring to use hashicorp/go-azure-sdk (#23721 )
azurerm_mssql_server - refactoring to use hashicorp/go-azure-sdk (#23721 )
azurerm_shared_image - add support for trusted_launch_supported (#23781 )
azurerm_spring_cloud_container_deployment - add support for the
blocks (#23936 )
azurerm_private_dns_cname_record - ttl can now be set to 0 (#23918 )
azurerm_windows_function_app - add support for dotnet 8 (#23638 )
azurerm_windows_function_app_slot - add support for dotnet 8 (#23638 )
BUG FIXES:
azurerm_api_management - correct a bug with more location zones within the
additional_location block (#23943 )
azurerm_dev_test_linux_virtual_machine - storage_type is now ForceNew to
webdeploy_publish_basic_authentication_enabled (#23900 )
azurerm_linux_web_app - add support for disabling Basic Auth for default
underscores (#23866 )
azurerm_logic_app_integration_account_partner - business_identity.value now
as kind (#23873 )
azurerm_network_ddos_protection_plan : refactoring to use hashicorp/go-azure-sdk
(#23849 )
azurerm_windows_function_app - add support for disabling Basic Auth for default
webdeploy_publish_basic_authentication_enabled (#23900 )
azurerm_windows_web_app - add support for disabling Basic Auth for default
(#22520 )
azurerm_firewall_policy_rule_collection_group - add support for the property
http_headers (#23641 )
azurerm_kubernetes_cluster - fips_enabled can be updated in the
BUG FIXES:
(#23836 )
azurerm_windows_web_app - prevent a panic with the auto_heal.triggers property
(#23812 )
provider: log instead of error when RPs are unavailable when validating RP
registrations (#23380 )
azurerm_arc_kuberenetes_cluster_extension_resource - the version and
release_train properties can now be set simultaneously (#23692 )
azurerm_container_apps - support for the ingress.exposed_port property
(#23752 )
azurerm_cosmosdb_postgresql_cluster - read replica clusters can be created
property (#23754 )
azurerm_storage_management_policy - support for properties
rule.*.actions.*.base_blob.0.tier_to_cold_after_days_since_{modification|last_
(#23574 )
BUG FIXES:
ENHANCEMENTS:
(#23659 )
azurerm_redis_enterprise_cluster - support for new location Japan East
(#23696 )
azurerm_search_service - support for semantic_search_sku field (#23698 )
BUG FIXES:
azurerm_palo_alto_next_generation_firewall_virtual_network_local_rulestack -
(#23697 )
3.77.0 (October 19, 2023)
FEATURES:
ENHANCEMENTS:
(#23596 )
BUG FIXES:
in the routing block, and fix a bug where these attributes could not be set
(#23491 )
azurerm_cdn_frontdoor_rule - the url_filename_condition properties
match_values is now optional if operator is set to Any (#23541 )
azurerm_shared_image_gallery - added the Private and Groups options for the
sharing.permission property (#23570 )
azurerm_redis_cache - fixed incorrect ssl values for
(#23107 )
ENHANCEMENTS:
(#23483 )
azurerm_static_site - add support for app_settings (#23421 )
BUG FIXES:
(#23499 )
azurerm_managed_lustre_file_system - update validation for
storage_capacity_in_tb according to sku_name in use (#23428 )
azurerm_virtual_machine - fix a crash when the API response for the os_profile
ENHANCEMENTS:
(#23114 )
azurerm_cognitive_deployment - capacity property is now updateable (#23251 )
azurerm_container_group - added support for key_vault_user_identity_id
(#23332 )
azurerm_data_factory - added support for the publish_enabled property
(#2334 )
azurerm_firewall_policy_rule_collection_group - add support for the
description property (#23354 )
azurerm_kubernetes_cluster - network_profile.network_policy can be migrated to
cilium (#23342 )
azurerm_log_analytics_workspace - add support for the data_collection_rule_id
property (#23347 )
azurerm_mysql_flexible_server - add support for the io_scaling_enabled property
(#23329 )
BUG FIXES:
(#23348 )
azurerm_cdn_frontdoor_rule - allow a cache_duration of 00:00:00 (#23384 )
azurerm_cosmosdb_cassandra_datacenter - sku_name is now updatable (#23419 )
azurerm_key_vault_certificate - fix a bug that prevented soft-deleted certificates
propagation (#23345 )
azurerm_monitor_diagnostic_setting - added validation to ensure at least one of
on delete (#23362 )
security_center_subscription_pricing_resource - disabled extensions logic now
resources that were created outside of Terraform using an LRS storage account
type will need to use ignore_changes to avoid the resource from being destroyed
and recreated.
FEATURES:
ENHANCEMENTS:
block (#23261 )
azurerm_monitor_diagnostic_setting - validation to ensure either category or
category_group are supplied in enabled_log and log blocks (#23308 )
azurerm_network_interface - support for the auxiliary_mode and auxiliary_sku
properties (#22979 )
azurerm_postgresql_flexible_server - increased the maximum supported value
replicated_region_deletion_enabled and
AADKERB (#22833 )
azurerm_storage_account_customer_managed_key - support for cross-tenant
BUG FIXES:
resource (#23011 )
azurerm_app_configuration - prevent crash by nil checking the encryption
configuration (#23302 )
azurerm_app_configuration_feature - update percentage_filter_value to accept
anymore (#23204 )
azurerm_key_vault_key - the ForceNew when expiration_date is removed from
DEPRECATIONS:
(#23161 )
azurerm_monitor_diagnostic_setting - deprecate retention_policy in favour of
azurerm_storage_management_policy (#23260 )
3.73.0 (September 14, 2023)
FEATURES:
ENHANCEMENTS:
(#23241 )
azurerm_managed_disk - support for performance_plus_enabled (#23241 )
azurerm_maps_account - support for local_authentication_enabled (#23216 )
azurerm_mssql_elasticpool - support for configuring license_type when using the
azure-sdk (#23158 )
BUG FIXES:
block (#23219 )
azurerm_key_vault_certificate - fixing a regression where certificates from a
Provider Feature: subscription cancellation on destroy can now be disabled via the
provider features block (#19936 )
New Data Source: netapp_volume_quota_rule (#23042 )
New Resource: azurerm_automation_python3_package (#23087 )
New Resource: netapp_volume_quota_rule (#23042 )
ENHANCEMENTS:
(#23160 )
azurerm_batch_pool - support for accelerated_networking_enabled (#23021 )
azurerm_batch_pool - support for automatic_upgrade_enabled (#23021 )
azurerm_bot_channel_direct_line_speech - support for the cognitive_account_id
property (#23106 )
azurerm_bot_service_azure_bot - support for the local_authentication_enabled
property (#23096 )
azurerm_container_app_environment - support for the
dapr_application_insights_connection_string (#23080 )
azurerm_cosmosdb_cassandra_datacenter - refactoring to use hashicorp/go-azure-
sdk (#23110 )
azurerm_cosmosdb_cassandra_datacenter - updating to API Version 2023-04-15
(#23110 )
azurerm_kubernetes_cluster - Azure CNI can be updated to use overlay
(#22709 )
azurerm_monitor_diagnostic_setting - deprecating retention_policy within
enabled_log (#23029 )
azurerm_mssql_database - split create and update methods (#23209 )
azurerm_postgresql_database - collation can now be set to English_United
Kingdom.1252 (#23171 )
azurerm_postgresql_flexible_database - collation can now be set to
English_United Kingdom.1252 (#23171 )
azurerm_postgresql_flexible_server - support for the auto_grow_enabled property
(#23069 )
azurerm_redis_enterprise_cluster - support for Flash clusters in Brazil South
(#23200 )
azurerm_resource_provider_registration - refactoring to use hashicorp/go-azure-
sdk (#23072 )
azurerm_virtual_machine_extension - support for provision_after_extensions
(#23124 )
azurerm_virtual_network_gateway - increasing the default timeout for create to
90m (#23003 )
azurerm_virtual_hub_connection - support for inbound_route_map_id ,
BUG FIXES:
in policies/policy (#23128 )
azurerm_api_management_api_operation_policy - added state migration to mutate
(#23082 )
azurerm_key_vault_managed_storage_account - check id can be parsed correctly
(#23093 )
azurerm_pim_active_role_assignment : polling for the duration of the timeout,
configured (#23155 )
azurerm_synapse_workspace - fixes index out-of-range panic when parsing
storage_data_lake_gen2_filesystem_id (#23019 )
machine_learning_datastore_* - fixes container ids (#23140 )
azurerm_key_vault_certificate - id now points to new version when certificate is
updated (#23135 )
azurerm_site_recovery_replicated_vm - update network_interface diff so
DEPRECATION:
App Service win32_status property - Due to a change made in the service to the
underlying type of the Auto Heal property win32_status combined with a prior
bug (in v3.62.1 and earlier) causing the value of this property to be stored
incorrectly in state as an empty string, the value of this property could not be
updated or state migrated to accommodate the necessary type change in the
state. This results in the resources named above returning an error of a number is
needed when decoding the state for this value. Unfortunately, this is a breaking
change and will require users of this field to change their Terraform Configuration.
The field win32_status is replaced by win32_status_code (this remains an int, as in
3.63.0 onwards) for azurerm_linux_web_app , azurerm_linux_web_app_slot ,
azurerm_windows_web_app , azurerm_windows_web_app_slot resources . (#23075 )
FEATURES:
ENHANCEMENTS:
dependencies: updating to v0.20230824.1130652 of github.com/hashicorp/go-
azure-sdk (#23076 )
trafficmanager : updating to use the transport layer from hashicorp/go-azure-sdk
properties (#23034 )
azurerm_kubernetes_cluster - extend allowed ranges for various sysctl_config
property (#23040 )
BUG FIXES:
Azure/go-autorest (#22874 )
devtestlabs : updating to use the base layer from hashicorp/go-azure-sdk rather
Azure/go-autorest (#22874 )
postgresql : updating to use the base layer from hashicorp/go-azure-sdk rather
property (#22857 )
Data Source: azurerm_disk_encryption_set - now exports key_vault_key_url
(#22893 )
azurerm_disk_encryption_set - now exports key_vault_key_url (#22893 )
BUG FIXES:
(#22930 )
azurerm_disk_encryption_set - now correctly supports key rotation by specifying a
(#22891 )
azurerm_postgresql_database - reworking the validation for database collation
(#22928 )
azurerm_postgresql_flexible_database - reworking the validation for database
collation (#22928 )
azurerm_storage_management_policy - check for an existing resource to prevent
(#22982 )
(#22700 )
New Resource:
azurerm_palo_alto_local_rulestack_outbound_untrust_certificate_association
(#22700 )
New Resource: azurerm_palo_alto_local_rulestack_prefix_list (#22700 )
New Resource: azurerm_palo_alto_local_rulestack_rule (#22700 )
New Resource: azurerm_palo_alto_virtual_network_appliance (#22700 )
New Resource:
azurerm_palo_alto_next_generation_firewall_virtual_hub_local_rulestack
(#22700 )
New Resource:
azurerm_palo_alto_next_generation_firewall_virtual_hub_panorama (#22700 )
New Resource:
azurerm_palo_alto_next_generation_firewall_virtual_network_local_rulestack
(#22700 )
New Resource:
azurerm_palo_alto_next_generation_firewall_virtual_network_panorama
(#22700 )
ENHANCEMENTS:
parameter_values (#21541 )
azurerm_monitor_action_group - the value https is now supported for aad_auth
(#22888 )
azurerm_mssql_server - SystemAssigned, UserAssigned identity is now supported
(#22828 )
azurerm_network_packet_capture - updating to use hashicorp/go-azure-sdk
(#22873 )
azurerm_network_profile - refactoring to use hashicorp/go-azure-sdk (#22850 )
azurerm_network_watcher_flow_log - updating to use hashicorp/go-azure-sdk
(#22873 )
azurerm_network_watcher - updating to use hashicorp/go-azure-sdk (#22873 )
azurerm_postgresql_database - updating the validation for collation (#22689 )
azurerm_postgresql_flexible_server_database - updating the validation for
collation (#22689 )
azurerm_security_center_subscription_pricing - support for extensions block
(#22643 )
azurerm_security_center_subscription_pricing - support for the resource_type
Api (#22844 )
azurerm_spring_cloud_configuration_service - support for the ca_certificate_id
property (#22814 )
azurerm_virtual_desktop_workspace - added support for the
(#22873 )
azurerm_vpn_server_configuration - refactoring to use hashicorp/go-azure-sdk
(#22850 )
azurerm_vpn_server_configuration_policy_group - refactoring to use
hashicorp/go-azure-sdk (#22850 )
azurerm_vpn_site - refactoring to use hashicorp/go-azure-sdk (#22850 )
BUG FIXES:
(#22812 )
azurerm_databricks_workspace - update parse function for
an empty value by setting it into state when creating the resource (#22848 )
ENHANCEMENTS
Azure/go-autorest (#22750 )
apimanagement : updating to use the base layer from hashicorp/go-azure-sdk rather
Azure/go-autorest (#22750 )
domainservices : updating the base layer to use hashicorp/go-azure-sdk rather
sdk (#22778 )
azurerm_web_application_firewall_policy - updating to use API Version 2023-02-
01 (#22455 )
azurerm_web_application_firewall_policy - support for log_scrubbing property
(#22522 )
azurerm_shared_image_gallery - support for the sharing block (#22221 )
azurerm_virtual_network - support for the encryption block (#22745 )
BUG FIXES
(#22711 )
azurerm_pim_eligible_role_assignment - fixing a bug where the context deadline
(#22687 )
ENHANCEMENTS:
Azure/go-autorest (#22681 )
powerbi : updating to use the base layer from hashicorp/go-azure-sdk rather than
Azure/go-autorest (#22681 )
privatedns : updating to use the base layer from hashicorp/go-azure-sdk rather
Azure/go-autorest (#22681 )
relay : updating to use the base layer from hashicorp/go-azure-sdk rather than
Azure/go-autorest (#22681 )
azurerm_cdn_endpoint_custom_domain - pass nil as version when Certificate/Secret
block (#22642 )
azurerm_linux_virtual_machine - add support for the
bypass_platform_safety_checks_on_user_schedule_enabled and reboot_setting
properties (#22349 )
azurerm_network_interface - updating to use hashicorp/go-azure-sdk and API
replication (#22627 )
azurerm_windows_virtual_machine - add support for the
BUG FIXES:
ENHANCEMENTS:
property (#21940 )
data.azurerm_servicebus_* - add deprecation messages for the
(#22610 )
azurerm_eventhub_namespace - updates properly when encryption is enabled
(#22625 )
azurerm_logic_app_standard - now exports the auto_swap_slot_name attribute
(#22525 )
azurerm_mysql_flexible_server_configuration - the value property can now be
properties (#22612 )
azurerm_spring_cloud_service - support for the marketplace block (#22553 )
azurerm_spring_cloud_service - support for the outbound_type property
(#22596 )
BUG FIXES:
(#22580 )
data.automation_account_variables - correctly populate missing variable attributes
(#22611 )
data.azurerm_virtual_machine_scale_set - fix an issue where computer_name ,
functional as the service team intends to remove it from the API (#22497 )
azurerm_maintenance_configuration - tge package_names_mask_to_exclude and
property (#22571 )
(#22409 )
elastic - updating to API Version 2023-06-01 (#22451 )
kusto - updating to API Version 2023-05-02 [GH-22410
hashicorp/go-azure-sdk (#22396 )
voiceservices : updating to use API Version 2023-04-03 (#22469 )
Data Source: azurerm_kubernetes_cluster - add support for the
internal_ingress_gateway_enabled and external_ingress_gateway_enabled
properties (#22393 )
azurerm_batch_account - support for the network_profile block (#22356 )
azurerm_container_app - the min_replicas and max_replicas propertiesnow
properties (#22393 )
azurerm_site_recovery_vmware_replication_policy_association - update validation
ENHANCEMENTS:
property (#22352 )
azurerm_linux_web_app_slot - added support for the
property (#22352 )
azurerm_windows_web_app_slot - added support for the
property (#22317 )
BUG FIXES:
(#22347 )
azurerm_linux_web_app_slot - the allowed_origins property in the cors block
DEPRECATION:
media - all resources and data sources are deprecated ahead of service being
retired (#22350 )
BREAKING CHANGES:
ENHANCEMENTS:
Required to match the API specification. The API rejects requests that do not
now a Required property of the schedule block. This is to match the minimum
requirements of the API. (#22204 )
azurerm_automation_software_update_configuration - the pre_task blocks are now
block (#21760 )
azurerm_kubernetes_cluster - support for the maintenance_window_node_os block
(#21760 )
azurerm_monitor_aad_diagnostic_setting - deprecate log in favour of enabled_log
(#21390 )
azurerm_resource_group - support for the managed_by property (#22012 )
BUG FIXES:
update (#21975 )
azurerm_image - changing the os_disk.size_gb propety now creates a new
resource (#22272 )
azurerm_kubernetes_cluster - fix the validation for node_os_channel_upgrade block
(#22284 )
azurerm_linux_virtual_machine - raise an error if the resource cannot be found
update (#21975 )
azurerm_storage_share - revert the resource ID format back to what it was
usgovernment (#22273 )
azurerm_windows_virtual_machine - reaise an error if the resource cannot be found
ENHANCEMENTS:
property (#22179 )
azurerm_kubernetes_cluster - support for the value AzureLinux for the field
(#22187 )
azurerm_kubernetes_cluster_node_pool - support for the value AzureLinux for the
(#22197 )
azurerm_virtual_hub - support for virtual_router_auto_scale_min_capacity
(#21614 )
BUG FIXES:
updated (#22148 )
azurerm_bastion_host - now creates a new resource when the sku property is
downgraded (#22147 )
azurerm_container_app - the EmptyDir property now functions (#22196 )
azurerm_kubernetes_cluster - fix the validation preventing cluster's with
network_plugin_mode set to Overlay due to a case change in the upstream API
(#22153 )
azurerm_resource_deployment_script_* - fix issue where identity wasn't specified
ENHANCEMENTS:
(#20608 )
azurerm_batch_account - the public_network_access_enabled property can now be
updated (#22095 )
azurerm_batch_pool - support for the target_node_communication_mode property
(#22094 )
azurerm_automanage_configuration - support for the log_analytics_enabled
property (#22121 )
azurerm_nginx_certificate - the key_virtual_path , certificate_virtual_path ,
(#22016 )
BUG FIXES:
attribute (#22021 )
ENHANCEMENTS:
(#21956 )
azurerm_linux_function_app_slot - support for Python 3.11 for Linux function app
(#21956 )
azurerm_monitor_autoscale_setting - support for the predictive block (#22038 )
azurerm_machine_learning_compute_instance - support for the
node_public_ip_enabled property (#22063 )
azurerm_spring_cloud_service - support for the container_registry block
(#22017 )
azurerm_site_recovery_replication_recovery_plan - the order of the pre_action
BUG FIXES:
(#21935 )
azurerm_mssql_server - fix issue where the minimum_tls_version property is being
ENHANCEMENTS:
(#21945 )
data.azurerm_linux_function_app - now exports the availability and usage
attributes (#21945 )
data.azurerm_cdn_frontdoor_secret - now exports the expiration_date attribute
(#21945 )
data.azurerm_virtual_machine - now exports the power_state (#21945 )
data.azurerm_virtual_machine_scale_set - now exports the power_state attribute
(#21945 )
data.azurerm_azurerm_resources - now exports the resource_group_name attribute
for each resource (#21676 )
security.watchitems - updating to use hashicorp/go-azure-sdk (#21944 )
azurerm_cosmosdb_account - support new capabilities for MongoDB (#21974 )
azurerm_kubernetes_cluster - the properties enable_host_encryption ,
enable_node_public_ip , kubelet_config , linux_os_config , max_pods , node_taints ,
(#21934 )
azurerm_shared_image_version - now exports the id property (#22006 )
azurerm_spring_cloud_certificate - support for the exclude_private_key property
(#21942 )
azurerm_spring_cloud_customized_accelerator - support for the ca_certificate_id
property (#21943 )
BUG FIXES:
ENHANCEMENTS:
04-15 (#21813 )
cosmosdb.sql_container : updating to use hashicorp/go-azure-sdk and api version
2023-04-15 (#21813 )
nginx : updating to use hashicorp/go-azure-sdk as a base layer rather than
Azure/go-autorest (#21810 )
portal : updating to use hashicorp/go-azure-sdk as a base layer rather than
Azure/go-autorest (#21810 )
redis : updating to use hashicorp/go-azure-sdk as a base layer rather than
Azure/go-autorest (#21810 )
appplatform : updating to API Version 2023-03-01-preview (#21404 )
redisenterprise : updating to use hashicorp/go-azure-sdk as a base layer rather
(#21873 )
azurerm_backup_policy_vm - support for the days and include_last_days
properties (#21434 )
azurerm_subnet - the name property within the subnet_delegation block can now
(#21865 )
azurerm_signalr_service - support for the user_assigned_identity_id property
(#21055 )
azurerm_site_recovery_replication_recovery_plan - support for the
azure_to_azure_settings block (#21666 )
azurerm_cosmosdb_postgresql_cluster - the citus_version property now supports
11.3 (#21916 )
BUG FIXES:
Data Source: azurerm_kubernetes_cluster - prevent a panic when some values
returned are nil (#21867 )
azurerm_application_insights_web_test - normalizing the value for the
application_insights_id property (#21837 )
azurerm_api_management - correctly configure the triple_des_ciphers_enabled
value (#21789 )
azurerm_key_vault - during creation the createMode now is set to default instead
of nil (#21668 )
azurerm_spring_cloud_gateway_route_config - the filters and predicates
ENHANCEMENTS:
BUG FIXES:
ENHANCEMENTS:
BUG FIXES:
provider: fixing a bug where we would invoke but not poll for the Registration
State during automatic Resource Provider Registration (#21695 )
azurerm_app_configuration : handling an API bug where when polling for
PurgeDeleted returns a 404 rather the payload for a long-running operation
(#21665 )
azurerm_api_management_api - fixing a bug where an empty contact bug would
functions (#21656 )
azurerm_machine_learning_workspace - parse key_vault_id insensitively (#21684 )
azurerm_monitor_action_group - further expand ExactlyOneOf logic for
event_hub_receiver attributes (#21735 )
azurerm_monitor_metric_alert - fix regression by using
SingleResourceMultiMetricCriteria for new metric alerts (#21658 )
azurerm_service_fabric_managed_cluster - fixing a bug where certificates within
(#21645 )
azurerm_virtual_machine_scale_set , - - support specifying
ENHANCEMENTS:
(#21511 )
BUG FIXES:
checks (#21631 )
azurerm_log_analytics_cluster_customer_managed_key - Add locks and remove
due to a design issue with the original resource (where this wasn't retrieved from
the Azure API and thus wasn't exposed correctly) - this is superseded by the fields
open_enclave_policy_base64 , sgx_enclave_policy_base64 and tpm_policy_base64 .
(#21524 )
FEATURES:
ENHANCEMENTS:
to 30 characters (#21555 )
azurerm_attestation_provider - adding support for the field
(#21524 )
azurerm_attestation_provider - adding support for the field
sgx_enclave_policy_base64 (#21524 )
azurerm_attestation_provider - adding support for the field tpm_policy_base64
(#21524 )
azurerm_billing_account_cost_management_export - the field time_frame can now
(#21516 )
azurerm_resource_group_cost_management_export - the field time_frame can now be
(#21323 )
azurerm_search_service - adding support for
customer_managed_key_enforcement_enabled (#21323 )
azurerm_search_service - adding support for hosting_mode (#21323 )
azurerm_search_service - adding support for local_authentication_enabled
(#21323 )
azurerm_search_service - support for setting sku to StorageOptimizedL2
(#21323 )
azurerm_subscription_cost_management_export - the field time_frame can now be
BUG FIXES:
(#21323 )
ENHANCEMENTS:
(#20471 )
azurerm_linux_function_app_slot - support for the hosting_environment_id
property (#20471 )
azurerm_linux_web_app - support for the hosting_environment_id property
(#20471 )
azurerm_linux_web_app - support PHP 8.2 for the application_stack property
(#21420 )
azurerm_linux_web_app_slot - support for the hosting_environment_id property
(#20471 )
azurerm_linux_web_app_slot support PHP 8.2 for the application_stack property
(#21420 )
azurerm_signalr_service - add addtional valid values for sku.0.capacity
(#21494 )
azurerm_windows_function_app - support for the hosting_environment_id property
(#20471 )
azurerm_windows_function_app_slot - support for the hosting_environment_id
property (#20471 )
azurerm_windows_web_app - support for the hosting_environment_id property
(#20471 )
azurerm_windows_web_app_slot - support for the hosting_environment_id property
(#20471 )
BUG FIXES:
azurerm_cdn_endpoint - remove the length limit for the query_string property
(#21474 )
azurerm_cognitive_account - mark the
custom_question_answering_search_service_key property as sensitive (#21469 )
azurerm_monitor_metric_alert - fix crash when the
sensitive (#21469 )
(#21393 )
azurerm_linux_function_app_slot - mark the site_credential block as Sensitive
(#21393 )
azurerm_linux_web_app - mark the site_credential block as Sensitive (#21393 )
azurerm_linux_web_app_slot - mark the site_credential block as Sensitive
(#21393 )
azurerm_windows_function_app - mark the site_credential block as Sensitive
(#21393 )
azurerm_windows_function_app_slot - mark the site_credential block as
Sensitive (#21393 )
azurerm_windows_web_app - mark the site_credential block as Sensitive
(#21393 )
azurerm_windows_web_app_slot - mark the site_credential block as Sensitive
(#21393 )
BUG FIXES:
(#21381 )
azurerm_linux_function_app_slot - fix a crash in auth_v2 in active_directory_v2
(#21381 )
azurerm_linux_web_app - fix a crash in auth_v2 in active_directory_v2 (#21381 )
azurerm_linux_web_app_slot - fix a crash in auth_v2 in active_directory_v2
(#21381 )
azurerm_service_plan - support for new Premium V3 and Memory Optimised SKUs
(#21371 )
azurerm_storage_account_local_user - the ssh_authorized_key property can now
be updated (#21362 )
azurerm_storage_mover - remove Microsoft.StorageMover from required list of
(#21381 )
azurerm_windows_function_app_slot - fix a crash in auth_v2 in
active_directory_v2 (#21381 )
azurerm_windows_web_app - fix a crash in auth_v2 in active_directory_v2
(#21381 )
azurerm_windows_web_app_slot - fix a crash in auth_v2 in active_directory_v2
(#21381 )
FEATURES:
ENHANCEMENTS:
github.com/tombuildsstuff/kermit ) (#21234 )
Data Source: azurerm_monitor_data_collection_rule - support for the
data_collection_endpoint_id property (#21159 )
Data Source: azurerm_monitor_data_collection_rule - support for the identity
and stream_declaration blocks (#21159 )
Data Source: azurerm_monitor_data_collection_rule - support for more
destinations , data_sources and data_flow transformations (#21159 )
azurerm_app_configuration_feature - support for the key property (#21252 )
azurerm_container_app - the app_port property is now optional (#20567 )
azurerm_healthcare_fhir_service - support for PATCH as an available value for
cors (#21222 )
azurerm_healthcare_service - upport for PATCH as an available value for cors
(#21222 )
azurerm_kubernetes_cluster - support KataMshvVmIsolation as a option for the
(#21032 )
azurerm_snapshot - support for the incremental_enabled property (#21263 )
azurerm_web_pubsub_hub - support for the event_listener block (#21145 )
BUG FIXES:
(#21238 )
azurerm_automation_software_update_configuration - time_zone correctly defaults
to Etc/UTC (#21254 )
azurerm_digital_twins_time_series_database_connection - insensitively parse
kusto_cluster_uri (#21243 )
azurerm_express_route_circuit - can now set authorization_key during creation
(#21132 )
azurerm_kusto_eventhub_data_connection - insensitively parse identity_id if it
(#21219 )
azurerm_linux_function_app_slot - fix a crash in auth_v2 in active_directory_v2
(#21219 )
azurerm_linux_web_app - fix a crash in auth_v2 in active_directory_v2 (#21219 )
azurerm_linux_web_app_slot - fix a crash in auth_v2 in active_directory_v2
(#21219 )
azurerm_monitor_diagnostic_setting - insensitively parse the resource's ID if it is
creation (#21268 )
azurerm_windows_function_app - fix a crash in auth_v2 in active_directory_v2
(#21219 )
azurerm_windows_function_app_slot - fix a crash in auth_v2 in
active_directory_v2 (#21219 )
azurerm_windows_web_app - fix a crash in auth_v2 in active_directory_v2
(#21219 )
azurerm_windows_web_app_slot - fix a crash in auth_v2 in active_directory_v2
(#21219 )
ENHANCEMENTS:
(#21059 )
azurerm_linux_function_app - add support for zip_deploy_file (#20544 )
azurerm_monitor_scheduled_query_rules_alert - trigger.x.metric_column is now
optional (#21203 )
azurerm_mssql_database - HyperScale Skus now support
BUG FIXES:
(#21129 )
azurerm_api_management_custom_domain - validating api_management_id (#21129 )
azurerm_api_management_policy - validating api_management_id (#21129 )
azurerm_api_management_gateway_api - validating api_id (#21129 )
azurerm_application_gateway - validating firewall_policy_id and subnet_id
(#21129 )
azurerm_application_gateway - validating that data within the ssl_certificate
application_insights_id (#21129 )
azurerm_application_insights_api_key - validating application_insights_id
(#21129 )
azurerm_application_insights_smart_detection_rule - validating
application_insights_id (#21129 )
azurerm_application_insights_standard_webtests - validating
application_insights_id (#21129 )
azurerm_application_insights_webtests - validating application_insights_id
(#21129 )
azurerm_app_service_virtual_network_swift_connection - validating
(#21129 )
azurerm_data_factory_integration_runtime_managed - validating vnet_id
(#21129 )
azurerm_data_share_dataset_kusto_cluster - validating kusto_cluster_id
(#21129 )
azurerm_data_share_dataset_kusto_database - validating kusto_database_id
(#21129 )
azurerm_eventhub_namespace - validating the subnet_id (#21129 )
azurerm_eventhub_namespace_disaster_recovery_config - fixing a bug where
partner_namespace_id would validate with an empty string when the field should
(#21129 )
azurerm_hdinsight_hadoop_cluster - validating storage_resource_id , subnet_id
virtual_network_id (#21129 )
azurerm_hdinsight_interactive_query_cluster - validating storage_resource_id ,
subnet_id and virtual_network_id (#21129 )
azurerm_hdinsight_kafka_cluster - validating storage_resource_id , subnet_id and
virtual_network_id (#21129 )
azurerm_hdinsight_spark_cluster - validating storage_resource_id , subnet_id and
virtual_network_id (#21129 )
azurerm_healthcare_medtech_service - support for Azure Environments other then
(#21129 )
azurerm_iothub_certificate - certificate content now updates correctly (#21163 )
azurerm_iothub_dps_certificate - certificate content now updates correctly
(#21163 )
azurerm_key_vault_access_policy - validating key_vault_id (#21129 )
azurerm_key_vault_certificate_issuer - validating key_vault_id (#21129 )
azurerm_kubernetes_cluster - validating vnet_subnet_id (#21129 )
azurerm_kubernetes_cluster_node_pool - validating vnet_subnet_id (#21129 )
azurerm_kusto_attached_database_configuration - validating the cluster_id
(#21129 )
azurerm_kusto_cluster - validating subnet_id , engine_public_ip_id and
data_management_public_ip_id (#21129 )
azurerm_kusto_eventgrid_data_connection - validating eventgrid_resource_id
(#21129 )
azurerm_lb - validating public_ip_address_id , public_ip_prefix_id and
subnet_id (#21129 )
azurerm_lb_nat_rule - validating the backend_address_pool_id (#21129 )
azurerm_linux_function_app - fix crash in auth_v2 in active_directory_v2
(#21113 )
azurerm_linux_function_app_slot - fix crash in auth_v2 in active_directory_v2
(#21113 )
azurerm_linux_web_app - fix crash in auth_v2 in active_directory_v2 (#21113 )
azurerm_linux_web_app_slot - fix crash in auth_v2 in active_directory_v2
(#21113 )
azurerm_linux_virtual_machine - validating application_security_group_ids and
key_vault_id (#21129 )
azurerm_linux_virtual_machine_scale_set - validating key_vault_id ,
(#21138 )
azurerm_managed_disk - validating disk_access_id and storage_account_id
(#21129 )
azurerm_mariadb_virtual_network_rule - validating subnet_id (#21129 )
azurerm_monitor_action_group - validating automation_account_id and
function_app_resource_id (#21129 )
azurerm_monitor_log_profile - validating storage_account_id (#21129 )
azurerm_mssql_database - fixing an int64 overflow for max_size_gb on 32-bit
platforms (#21155 )
azurerm_mssql_database - validating subnet_id (#21129 )
azurerm_mysql_virtual_network_rule - validating subnet_id (#21129 )
azurerm_netapp_volume - validating subnet_id (#21129 )
azurerm_network_interface - validating public_ip_address_id and subnet_id
(#21129 )
azurerm_network_interface_application_gateway_association - validating
backend_address_pool_id and network_interface_id (#21129 )
azurerm_network_interface_application_security_group_association - validate
(#21129 )
azurerm_private_dns_zone_virtual_network_link - validating virtual_network_id
(#21129 )
azurerm_role_definition - polling for longer during deletion (#21151 )
azurerm_sentinel_automation_rule - validating logic_app_id (#21129 )
azurerm_security_center_workspace - validating log_analytics_workspace_id
(#21129 )
azurerm_security_center_automation - validating that a Scope is specified
(#21129 )
azurerm_sql_managed_database - validating managed_instance_id (#21129 )
azurerm_sql_managed_instance - validating subnet_id (#21129 )
azurerm_static_site_custom_domain - validating static_site_id (#21129 )
azurerm_storage_account - updating the validation for ip_rules to highlight the IP
virtual_machine_id (#21129 )
azurerm_virtual_network - validating ddos_protection_plan_id (#21129 )
azurerm_virtual_network_gateway - validating default_local_network_gateway_id
optional (#21125 )
azurerm_windows_function_app - fix crash in auth_v2 in active_directory_v2
(#21113 )
azurerm_windows_function_app_slot - fix crash in auth_v2 in active_directory_v2
(#21113 )
azurerm_windows_virtual_machine_scale_set - validating
application_security_group_ids , network_security_group_id ,
(#21113 )
supplied it must contain at least one item. Omitting this property will set the array
empty
FEATURES:
ENHANCEMENTS:
Azure/go-autorest (#21004 )
azurerm_app_configuration_key - the resource's ID is changed to match the Data
Plane URL format to work around several bugs in the previous parsing logic
(#20082 )
azurerm_app_configuration_feature - the resource's ID is changed to match the
Data Plane URL format to work around several bugs in the previous parsing logic
(#20082 )
azurerm_express_route_circuit - add support for authorization_key (#21104 )
azurerm_media_job - updating to use API Version 2022-07-01 (#20956 )
azurerm_media_transform - updating to use API Version 2022-07-01 (#20956 )
azurerm_virtual_network_gateway - support for conditional/patch updates
(#21009 )
azurerm_web_application_firewall_policy - the field operator within the
match_conditions block can now be set to Any (#20971 )
azurerm_kubernetes_cluster - add missing property to oms_agent
schema(#21046 )
azurerm_kubernetes_cluster - deprecate docker_bridge_cidr which is no longer
(#21009 )
azurerm_virtual_hub - support for the hub_routing_preference property
(#21028 )
BUG FIXES:
(#20951 )
azurerm_linux_function_app - fixan update bug with the
(#21091 )
azurerm_linux_function_app - fixread for token_store_enabled to correctly set
data (#21091 )
azurerm_linux_function_app_slot - fixread for token_store_enabled to correctly set
(#21091 )
azurerm_linux_web_app - fixread for token_store_enabled to correctly set returned
(#21091 )
azurerm_linux_web_app_slot - fixread for token_store_enabled to correctly set
returned value in state (#21091 )
azurerm_linux_web_app_slot - fixed processing of cors block (#20987 )
azurerm_linux_web_app_slot - the ip_restriction block can is now successfully
data (#21091 )
azurerm_windows_function_app - fixread for token_store_enabled to correctly set
(#21091 )
azurerm_windows_web_app - fixread for token_store_enabled to correctly set
returned value in state (#21091 )
azurerm_windows_web_app_slot - the ip_restriction block can is now successfully
data (#21091 )
azurerm_windows_web_app_slot - fixread for token_store_enabled to correctly set
ENHANCEMENTS:
property (#20667 )
azurerm_ssh_public_key - allow . for name validation (#20955 )
BUG FIXES:
WEBSITE_CONTENTOVERVNET (#18258 )
azurerm_windows_function_app - Fixed apply time validation when using
WEBSITE_CONTENTOVERVNET (#18258 )
ENHANCEMENTS
Azure/go-autorest (#20810 )
Data Source: azurerm_function_app_host_keys - exporting blobs_extension_key
(#20837 )
Data Source: azurerm_servicebus_namespace - exporting endpoint (#20790 )
Data Source: azurerm_kubernetes_cluster - generate and export
node_resource_group_id (#20830 )
azurerm_kubernetes_cluster - generate and export node_resource_group_id
(#20830 )
azurerm_kubernetes_cluster - support for the vertical_pod_autoscaler_enabled
property (#20751 )
azurerm_kubernetes_cluster - support for the msi_auth_for_monitoring_enabled
property (#20757 )
azurerm_kubernetes_cluster - the vm_size property of the default_node_pool is
property (#20782 )
azurerm_monitor_action_group - support for the location property (#20603 )
azurerm_mssql_database - support for ServerlessGen5 Hyperscale (#20875 )
azurerm_mssql_managed_database - support for retention policies (#20845 )
azurerm_servicebus_namespace - exports the endpoint attribute (#20790 )
azurerm_virtual_network_peering - support for the triggers property to allow
BUG FIXES:
registry_credential (#20841 )
azurerm_digital_twins_time_series_database_connection - marking the resource
specified (#20854 )
azurerm_iothub_endpoint_servicebus_queue - marking the resource as gone when
(#20816 )
azurerm_logic_app_integration_account - marking the resource as gone when it's
now obtained by name rather than using the first in the list (#20766 )
azurerm_nginx_certificate - marking the resource as gone when it's been deleted
(#20816 )
ENHANCEMENTS
Azure/go-autorest (#20688 )
maps : refactoring to use hashicorp/go-azure-sdk as a base layer rather than
Azure/go-autorest (#20688 )
signalr : refactoring to use hashicorp/go-azure-sdk as a base layer rather than
Azure/go-autorest (#20688 )
compute/shared_image_gallery - switching to use github.com/hashicorp/go-azure-
sdk (#20599 )
compute/gallery_application - switching to use github.com/hashicorp/go-azure-
sdk (#20599 )
compute/gallery_application_version - switching to use github.com/hashicorp/go-
azure-sdk (#20599 )
iottimeseriesinsights - switching to use github.com/hashicorp/go-azure-sdk
(#20416 )
policy/assignment - switching to use github.com/hashicorp/go-azure-sdk
(#20638 )
sentinel/alert_rule - switching to use github.com/hashicorp/go-azure-sdk
(#20680 )
sentinel/automation_rule - switching to use github.com/hashicorp/go-azure-sdk
(#20726 )
Data Source: azurerm_linux_function_app - support for AuthV2 (EasyAuthV2)
auth_settings_v2 (#20722 )
Data Source: azurerm_windows_function_app -support for AuthV2 (EasyAuthV2)
auth_settings_v2 (#20722 )
azurerm_app_service_connection - support for the secret_store block (#20613 )
express_route_circuit_peering_resource - support for the advertised_communities
property (#20708 )
azurerm_healthcare_service - extend range of the cosmosdb_throughput to a
(#20722 )
azurerm_linux_function_app_slot - support for AuthV2 (EasyAuthV2)
auth_settings_v2 (#20722 )
azurerm_media_streaming_policy - support for the
common_encryption_cbcs.clear_key_encryption ,
common_encryption_cenc.clear_key_encryption ,
common_encryption_cenc.clear_track ,
properties (#20524 )
azurerm_orchestrated_virtual_machine_scale_set - support for the priority_mix
property (#20618 )
azurerm_storage_management_policy - support for
auto_tier_to_hot_from_cool_enabled (#20641 )
azurerm_spring_cloud_connection - support for the secret_store block (#20613 )
azurerm_windows_function_app - support for AuthV2 (EasyAuthV2)
auth_settings_v2 (#20722 )
azurerm_windows_function_app_slot - support for AuthV2 (EasyAuthV2)
auth_settings_v2 (#20722 )
BUG FIXES
(#20670 )
azurerm_cdn_frontdoor_origin - origin_host_header can now be cleared once it is
set (#20679 )
azurerm_container_app - fixing a crash when the connection dropped (#20670 )
azurerm_communication_service - changing the data_location property now
(#20670 )
azurerm_eventhub_namespace - fixing a crash when the connection dropped
(#20670 )
azurerm_eventhub_namespace_disaster_recovery_config - fixing a crash when the
dropped (#20670 )
azurerm_iothub_dps - fixing a crash when the connection dropped (#20670 )
azurerm_media_services_account : fix crash around key_delivery_access_control
(#20685 )
azurerm_netapp_account - fixing a crash when the connection dropped (#20670 )
azurerm_netapp_pool - fixing a crash when the connection dropped (#20670 )
azurerm_netapp_snapshot - fixing a crash when the connection dropped (#20670 )
azurerm_netapp_snapshot_policy - fixing a crash when the connection dropped
(#20670 )
azurerm_netapp_volume - fixing a crash when the connection dropped (#20670 )
azurerm_netapp_volume - fixpotential nil panic in resource read (#20662 )
azurerm_notification_hub - fixing a crash when the connection dropped
(#20670 )
azurerm_notification_hub_namespace - fixing a crash when the connection dropped
(#20670 )
azurerm_proximity_placement_group - now correctly updates when a vm is attached
(#20131 )
azurerm_sentinel_log_analytics_workspace_onboard - fixing a crash when the
is disabled (#20132 )
(#20562 )
azurerm_express_route_connection - support for the inbound_route_map_id ,
outbound_route_map_id , and enabled_private_link_fast_path properties
(#20619 )
azurerm_kusto_cluster_customer_managed_key - key_version is now Optional to
(#20558 )
azurerm_linux_web_app - add support for AuthV2 (EasyAuthV2) auth_settings_v2
(#20449 )
azurerm_linux_web_app_slot - add support for AuthV2 (EasyAuthV2)
auth_settings_v2 (#20449 )
azurerm_postgresql_flexible_server - a server can now be created without
(#20558 )
azurerm_windows_web_app - add support for AuthV2 (EasyAuthV2)
auth_settings_v2 (#20449 )
azurerm_windows_web_app_slot - add support for AuthV2 (EasyAuthV2)
auth_settings_v2 (#20449 )
Data Source: azurerm_linux_web_app - add support for AuthV2 (EasyAuthV2)
auth_settings_v2 (#20449 )
Data Source: azurerm_windows_web_app - add support for AuthV2 (EasyAuthV2)
auth_settings_v2 (#20449 )
BUG FIXES
(#20560 )
azurerm_iot_dps - allow older resources to update without having set
data_residency_enabled (#20632 )
azurerm_kubernetes_cluster - prevent crash when SecurityProfile is nil
(#20584 )
azurerm_log_analytics_workspace - prevent ForceNew when sku is LACluster
(#19608 )
azurerm_media_streaming_endpoint - set and update tags properly (#20585 )
azurerm_mobile_network_sim_group - update identity to only support User
BUG FIXES
authentication: fixing an issue when obtaining the auth token for Resource
Manager in Azure Government (#20523 )
authentication: fixing an issue where the default subscription ID was not detected
when authenticating using Azure CLI (#20526 )
authentication: fixing an issue where Managed Identity authentication would fail
(#20523 )
Data Source: azurerm_app_configuration_key - fixing an issue where the App
Configuration was misleadingly marked as gone when the data plane client
couldn't be build (#20533 )
Data Source: azurerm_app_configuration_key - surfacing the error when a data
plane client can't be built (#20533 )
Data Source: azurerm_app_configuration_keys - fixing an issue where the App
Configuration was misleadingly marked as gone when the data plane client
couldn't be build (#20533 )
Data Source: azurerm_app_configuration_keys - surfacing the error when a data
plane client can't be built (#20533 )
azurerm_app_configuration_feature - fixing an issue where the App Configuration
was misleadingly marked as gone when the data plane client couldn't be build
(#20533 )
azurerm_app_configuration_feature - surfacing the error when a data plane client
misleadingly marked as gone when the data plane client couldn't be build
(#20533 )
azurerm_app_configuration_key - surfacing the error when a data plane client can't
be built (#20533 )
azurerm_kubernetes_cluster - fixa crash when securityProfile is nil in the API
Response (#20517 )
azurerm_logic_app_standard - fixing an issue where the storage endpoint suffix
ENHANCEMENTS:
BUG FIXES:
characters (#20407 )
azurerm_kubernetes_cluster - parsing the API response for the
false recreates the resource since this operation isn't supported by the API
(#20406 )
azurerm_storage_management_policy - the rule.filters property is now Required
ENHANCEMENTS:
(#20274 )
azurerm_media_live_event_output - support for the rewind_window_duration
property (#20271 )
azurerm_media_streaming_live_event - support for the stream_options property
(#20254 )
azurerm_storage_blob_inventory_policy - support for the exclude_prefixes
property (#20281 )
azurerm_sentinel_alert_rule_nrt - support for the dynamic_property block
(#20212 )
azurerm_sentinel_alert_rule_nrt - support for the sentinel_entity_mapping block
(#20230 )
azurerm_sentinel_alert_rule_nrt - support for the event_grouping block
(#20231 )
azurerm_sentinel_alert_rule_scheduled - support for the dynamic_property block
(#20212 )
azurerm_sentinel_alert_rule_scheduled - support for the sentinel_entity_mapping
block (#20230 )
azurerm_shared_image - support for the confidential_vm_supported and
BUG FIXES:
azurerm_custom_provider - switching a spurious usage of Azure/azure-sdk-for-go
to hashicorp/go-azure-sdk (#20315 )
azurerm_function_app_function - prevent a bug with multiple file blocks resulting
node_type (#20345 )
azurerm_web_application_firewall_policy - prevent a failure caused by changing
length (#20353 )
ENHANCEMENTS:
(#20214 )
servicefabric : refactoring to use github.com/hashicorp/go-azure-sdk (#20202 )
azurerm_kubernetes_cluster - add support for the confidential_computing add-on
(#20194 )
azurerm_kubernetes_cluster - export the identity for the aci_connector_linux
add-on (#20194 )
azurerm_lb_backend_address_pool - support for the virtual_network_id property
(#20205 )
azurerm_postgresql_flexible_server : add default value for
authentication.active_directory_auth_enabled and
authentication.password_auth_enabled (#20054 )
azurerm_site_recovery_protection_container_mapping - support for the
automatic_update block (#19710 )
azurerm_site_recovery_replicated_vm - support for the unmanaged_disk ,
target_proximity_placement_group_id , target_boot_diag_storage_account_id ,
target_capacity_reservation_group_id , target_virtual_machine_scale_set_id ,
(#19939 )
BUG FIXES:
processing (#18194 )
azurerm_monitor_aad_diagnostic_setting - the field log_analytics_workspace_id is
ENHANCEMENTS:
(#20184 )
azurerm_databricks_workspace - support for customer managed keys for managed
(#19731 )
azurerm_log_analytics_workspace - support for the local_authentication_disabled
property (#20092 )
azurerm_postgresql_flexible_server - support for customer managed keys
(#20086 )
azurerm_storage_account - support for AADKERB to
azure_files_authentication.0.directory_type (#20168 )
BUG FIXES:
ENHANCEMENTS:
(#19893 )
azurerm_linux_web_app - support for Python 3.11 (#20001 )
azurerm_linux_web_app_slot - support for Python 3.11 (#20001 )
azurerm_ip_group - support for the firewall_ids and firewall_policy_ids
properties (#19845 )
azurerm_recovery_services_vault - support for the immutability , user assigned
recovery_database_id [(#20010 )
BUG FIXES:
resource (#20003 )
azurerm_linux_web_app_slot - fixa bug where use_32_bit_worker would not be set
correctly (#20051 )
azurerm_postgresql_flexible_server_configuration - restart server when required
(#20044 )
azurerm_kubernetes_cluster - prevent a possible panic while importing (#20107 )
azurerm_service_fabric_managed_cluster - the password field is now correctly
value (#20061 )
azurerm_storage_account - no longer silently ignores 404 error while reading
issue (#19998 )
azurerm_log_analytics - fixing crash during read (#20011 )
App Service App Stack Re-alignment - due to several changes in how the Service
manages App and Stack settings, the Terraform resource schema and validation
needs to be updated to re-align with the service. Whist we ordinarily avoid
breaking changes outside a major release, the drift has made several aspects of
these resources in an unworkable position resulting in a poor experience for many
users (#19685 )
azurerm_windows_web_app
node_version Valid values are now ~12 , ~14 , ~16 , and ~18 . This is due to an
underlying change to where the Service reads the Node value from in the API
request.
dotnet_version valid values are now v2.0 , v3.0 , v4.0 , v5.0 , v6.0 , and v7.0
New setting dotnet_core_version - Valid values are v4.0 . This setting replaces
the hybrid setting of core3.1 in dotnet_version since the removal of core3.1
from the supported versions.
tomcat_version - Configured the Web App to use Tomcat as the JWS at the
specified version. See the official docs for supported versions. Examples include
10.0 , and 10.0.20
java_embedded_server_enabled - configures the JWS to be the Embedded server
java_version is set.
azurerm_windows_web_app_slot
node_version Valid values are now ~12 , ~14 , ~16 , and ~18 . This is due to an
underlying change to where the Service reads the Node value from in the API
request.
dotnet_version valid values are now v2.0 , v3.0 , v4.0 , v5.0 , v6.0 , and v7.0
New setting dotnet_core_version - Valid values are v4.0 . This setting replaces
the hybrid setting of core3.1 in dotnet_version since the removal of core3.1
from the supported versions.
tomcat_version - Configured the Web App to use Tomcat as the JWS at the
specified version. See the official docs for supported versions. Examples include
10.0 , and 10.0.20
java_embedded_server_enabled - configures the JWS to be the Embedded server
java_version is set.
azurerm_windows_function_app
dotnet_version - Valid values are now v3.0 , v4.0 , v6.0 , and v7.0 , defaulting
to v4.0
java_version - Valid values are now 1.8 , 11 , and 17
azurerm_windows_function_app_slot
dotnet_version - Valid values are now v3.0 , v4.0 , v6.0 , and v7.0 , defaulting
to v4.0
java_version - Valid values are now 1.8 , 11 , and 17
azurerm_linux_web_app
FEATURES:
ENHANCEMENTS:
(#19685 )
azurerm_linux_web_app_slot -support for the application_stack.go_version
property (#19685 )
azurerm_logic_app_action_http - add support for @ in the body property
(#19754 )
azurerm_maintenance_configuration - support for the in_guest_user_patch_mode
(#19504 )
azurerm_media_services_account - support for the encryption and
public_network_access_enabled properties (#19891 )
azurerm_mysql_flexible_server - support for the customer_managed_key properties
(#19905 )
azurerm_sentinel_automation_rule - support for the triggers_on , triggers_when ,
(#19906 )
azurerm_storage_queue - exporting resource_manager_id (#19969 )
azurerm_synapse_spark_pool - add support for Spark 3.3 (#19866 )
azurerm_windows_web_app - the php_version property supported values now
include: 7.1 , 7.4 , and Off . Note: 7.1 is currently deprecated. Off will configure
the system to use the latest available to the App service image (#19685 )
azurerm_windows_web_app - the python_version property is deprecated and is no
Defaults to false . When true uses the latest Python version supported by the
Windows App image (#19685 )
azurerm_windows_web_app - the java_container property is deprecated in favour of
one stack is configured on the Windows Web App. This change ensures the portal
displays the appropriate metadata and configuration for this stack (#19685 )
azurerm_windows_web_app - Added input validation for interval values in the
auto_heal block. These properties now enforce HH:MM:SS values up to 99:59:59
(#19685 )
azurerm_windows_web_app_slot - the php_version property supported values now
include: 7.1 , 7.4 , and Off . Note: 7.1 is currently deprecated. Off will configure
the system to use the latest available to the App service image (#19685 )
azurerm_windows_web_app_slot - the python_version property is deprecated and is
Defaults to false . When true uses the latest Python version supported by the
Windows App image (#19685 )
azurerm_windows_web_app_slot - the java_container property is deprecated in
only one stack is configured on the Windows Web App. This change ensures the
portal displays the appropriate metadata and configuration for this stack
(#19685 )
azurerm_windows_web_app_slot - Added input validation for interval values in the
auto_heal block. These properties now enforce HH:MM:SS values up to 99:59:59
(#19685 )
BUG FIXES:
is omitted (#19900 )
azurerm_cdn_frontdoor_rule - handle empty string value for query_string
(#19927 )
azurerm_cosmosdb_account - default_identity_type is now computed to allow for
restores (#19956 )
azurerm_linux_web_app - prevent a bug where backup_config could silently fail to
service (#19685 )
azurerm_policy_set_definition - fixupdate of for empty group names in
policy_definition_reference.policy_group_names (#19890 )
azurerm_storage_account - 403 is now a valid status code for when permissions to
(#19685 )
azurerm_windows_web_app_slot - prevent a bug where backup_config could silently
(#19685 )
ENHANCEMENTS:
properties (#19675 )
BUG FIXES:
terraform (#19780 )
azurerm_billing_account_cost_management_export - marking the resource as gone
deleted (#19792 )
azurerm_stack_hci_cluster - polling until the resource is fully deleted (#19792 )
azurerm_stream_analytics_cluster - polling until the resource is fully deleted
(#19792 )
azurerm_stream_analytics_reference_input_blob - the storage_account_key
checks the bypass field to workaround an issue within the Azure API (#19719 )
azurerm_subscription_cost_management_export - marking the resource as gone
ENHANCEMENTS:
BUG FIXES:
(#19722 )
azurerm_virtual_network_gateway_connection - can now be created with a
ENHANCEMENTS:
(#19634 )
azurerm_kubernetes_cluster_node_pool - support for the outbound_nat_enabled
property (#19663 )
azurerm_lighthouse_definition - support for the eligible_authorization property
(#19569 )
azurerm_log_analytics_workspace - support for the
(#19389 )
azurerm_storage_account - support for the blob_properties.restore_policy
property (#19644 )
azurerm_vpn_gateway_connection - support for the inbound_route_map_id and
BUG FIXES:
recreation (#19659 )
azurerm_monitor_scheduled_query_rules_alert_v2 - use the correct alue Equals for
operator (#19594 )
azurerm_mssql_database - the threat_detection_policy.storage_* properties can
integer rather than a float due to a breaking change in the API Specifications -
we believe this was only previously valid as an integer, as such while this is a
breaking change we believe this shouldn't cause an issue for most users (since the
API required that this was an integer) (#19602 )
FEATURES:
ENHANCEMENTS:
(#19546 )
azurerm_kubernetes_cluster - support for the storage_profile block (#19396 )
azurerm_kubernetes_cluster - support for the image_cleaner block (#19368 )
azurerm_kubernetes_cluster - support for the network_plugin_mode and
ebpf_data_plane properties (#19527 )
azurerm_kubernetes_cluster_node_pool - support for the custom_ca_trust_enabled
property (#19546 )
azurerm_lb_probe - support for the probe_threshold property (#19573 )
azurerm_mssql_virtual_machine - support for the days_of_week property
(#19553 )
azurerm_spring_cloud_gateway_route_config - support for the filters ,
predicates , and sso_validation_enabled properties (#19493 )
BUG FIXES:
(#19519 )
azurerm_automation_software_update_configuration - fixissue where omitting
deletion if the parent key vault has purge protection enabled (#19528 )
azurerm_key_vault_secret - skip purging during deletion if the parent key vault
id casing (#19525 )
azurerm_media_services_account - fixing an issue in the state upgrade where the
integer rather than a float due to a breaking change in the API Specifications -
we believe this was only previously valid as an integer, as such while this is a
breaking change we believe this shouldn't cause an issue for most users (since the
API required that this was an integer) (#19602 )
azurerm_virtual_desktop_workspace_application_group_association - set tags
properly (#19574 )
(#19395 )
synapse : refactoring to use github.com/tombuildstuff/kermit rather than the
set (#19425 )
azurerm_spring_cloud_gateway_route_config - support for protocol property
(#19382 )
azurerm_storage_account - support for sftp_enabled (#19428 )
azurerm_storage_management_policy -
tier_to_cool_after_days_since_creation_greater_than ,
tier_to_archive_after_days_since_creation_greater_than ,
BUG FIXES:
(#19464 )
azurerm_data_factory_linked_service_azure_file_storage - send host and and
(#19494 )
azurerm_iot_security_solution - a state migration to work around the previously
ENHANCEMENTS:
datasource (#19336 )
azurerm_mssql_managed_instance - support for user-assigned identity (#18918 )
azurerm_postgresql_flexible_server - support for authentication (#19269 )
azurerm_spring_cloud_app - support for the ingress_settings block (#19386 )
BUG FIXES:
Workspace ID (#19325 )
azurerm_cdn_frontdoor_rule - allow cache_duration to be null if cache_behavior
property (#19419 )
azurerm_servicebus_subscription_rule - correlation_filter with empty attributes
ENHANCEMENTS:
(#19273 )
azurerm_storage_account - support for the sas_policy block (#19222 )
azurerm_windows_web_app , azurerm_windows_web_app_slot - aupport for 17 value
(#19286 )
BUG FIXES:
(#19263 )
azurerm_synapse_firewall_rule - wait for the firewall to be ready (#19227 )
azurerm_service_fabric_managed_cluster - correctly define active_directory as a
List (#19163 )
azurerm_orchestrated_virtual_machine_scale_set - instance parameter is now set
on update (#19337 )
ENHANCEMENTS
(#19184 )
azurerm_linux_web_app - support for .NET 7 (#19232 )
azurerm_linux_function_app - support for .NET 7 (#19232 )
azurerm_managed_disk - support for expanding data disks without downtime
(#17245 )
azurerm_mssql_virtual_machine - support for the sql_instance block (#19123 )
azurerm_public_ip - support for the ddos_protection_mode and
(#19142 )
azurerm_sentinel_alert_rule_fusion - support for the source block (#19093 )
azurerm_windows_web_app - support for .NET 7 (#19232 )
azurerm_windows_function_app - support for .NET 7 (#19232 )
BUG FIXES:
ENHANCEMENTS
fallback_route.source (#19070 )
azurerm_iothub_fallback_route - support for DigitalTwinChangeEvents as source
(#19070 )
azurerm_iothub_route - support for DigitalTwinChangeEvents as source
(#19070 )
azurerm_kubernetes_cluster - support for the web_app_routing block (#18667 )
azurerm_linux_virtual_machine_scale_set - support for the
property (#19115 )
azurerm_monitor_diagnostic_setting - support for the partner_solution_id
property (#19114 )
azurerm_policy_definition - reverse the order of policies lookup to favour builtin
(#18338 )
azurerm_policy_set_definition - reverse the order of policies lookup to favour
builtin (#18338 )
azurerm_security_center_contact - support for the name property (#18999 )
azurerm_stream_analytics_job - support for the job_storage_account block
(#19120 )
azurerm_virtual_machine_extension - support for the
protected_settings_from_key_vault blovk (#19098 )
azurerm_virtual_machine_scale_set_extension - support for the
protected_settings_from_key_vault blovk (#19098 )
azurerm_windows_virtual_machine_scale_set - support for the
BUG FIXES:
(#18988 )
azurerm_cdn_frontdoor_firewall_policy - expose AnomalyScoring in override rule
public_network_access_enabled (#19048 )
ENHANCEMENTS:
SystemAssigned,UserAssgined (#18525 )
azurerm_hdinsight_kafka_cluster - support for the compute_isolation block
(#17449 )
azurerm_hdinsight_spark_cluster - support for the compute_isolation block
(#17449 )
azurerm_hdinsight_interactive_query_cluster - support for the compute_isolation
block (#17449 )
azurerm_hdinsight_hbase_cluster - support for the compute_isolation block
(#17449 )
azurerm_hdinsight_hadoop_cluster - support for the compute_isolation block
(#17449 )
azurerm_container_group - support for the dns_name_label_reuse_policy block
(#17785 )
azurerm_kubernetes_cluster - support for the workload_autoscaler_profile block
(#18967 )
azurerm_linux_function_app - support for using storage_account external Azure
Storage Account configurations (#18760 )
azurerm_linux_function_app - support for Java 17 (#18689 )
azurerm_linux_function_app_slot - support for using storage_account external
(#18853 )
azurerm_postgresql_server - can now set public_network_access_enabled during
BUG FIXES:
of Azure Disk Pools, and it's not made generally available (#18905 )
azurerm_disk_pool_iscsi_target_lun - is deprecated as Azure has halted the
preview of Azure Disk Pools, and it's not generally available (#18905 )
azurerm_disk_pool_managed_disk_attachment - is deprecated as Azure has halted
the preview of Azure Disk Pools, and it's not generally available (#18905 )
azurerm_linux_virtual_machine_scale_set - the gallery_applications block is
imported (#18848 )
azurerm_postgresql_server - correctly create replicas when CMK is enabled
(#18805 )
azurerm_stream_analytics_stream_input_eventhub - shared_access_policy_key and
shared_access_policy_name are no longer required (#18959 )
azurerm_windows_virtual_machine_scale_set - the gallery_applications block is
ENHANCEMENTS:
(#18763 )
azurerm_fluid_relay_server - support for the primary_key and secondary_key
properties (#18765 )
azurerm_linux_function_app - correctly set use_32_bit_worker during Create
(#18680 )
azurerm_linux_function_app - add support for the
values (#18684 )
azurerm_linux_function_app_slot - add support for the
property(#16603 )
azurerm_linux_web_app_slot - add support for the
client_certificate_exclusion_paths property (#16603 )
azurerm_storage_account - support for the immutability_policy block (#18774 )
azurerm_storage_account - customer managed keys can be now enabled when
account_tier is set to Premium (#18872 )
azurerm_storage_management_policy - support for the
tier_to_archive_after_days_since_last_tier_change_greater_than property
(#18792 )
azurerm_subnet - add support for Microsoft.LabServices/labplans (#18822 )
azurerm_windows_virtual_machine_scale_set - allow disabling secure boot when
creating a virtual machine scale set with disk encryption type VMGuestStateOnly
(#18749 )
azurerm_windows_function_app - correctly set use_32_bit_worker during Create
(#18680 )
azurerm_windows_function_app - add support for the
values (#18684 )
azurerm_windows_function_app_slot - add support for the
BUG FIXES:
azurerm_automation_software_update_configuration - parse subscription IDs
network_rulesets.x.virtual_network_rule.x.subnet_id (#18818 )
azurerm_firewall_policy_rule_collection_group - limit the number of destination
creating a virtual machine scale set with disk encryption type VMGuestStateOnly
(#18749 )
azurerm_network_security_group - correct the casing of the protocol property
(#18799 )
azurerm_network_security_rule - correct the casing of the protocol property
(#18799 )
azurerm_recovery_services_vault - fixissue where soft_delete_enabled is reset to
FEATURES:
ENHANCEMENTS:
(#18670 )
azurerm_hdinsight_hbase_cluster , - support for the script_actions block
(#18670 )
azurerm_hdinsight_interactive_query_cluster , - support for the script_actions
block (#18670 )
azurerm_spark_cluster - support for the script_actions block (#18670 )
azurerm_kubernetes_cluster - support the workload_identity_enabled property
(#18742 )
azurerm_firewall_policy_rule_collection_group - add Mssql as an option for type
validation (#18746 )
azurerm_log_analytics_cluster - ensuring that the identity block is always set
(#18700 )
azurerm_linux_web_app - support for python 3.10 (#18744 )
azurerm_linux_web_app_slot - support for python 3.10 (#18744 )
azurerm_mssql_database - support for the import block (#18588 )
azurerm_stream_analytics_output_servicebus_queue - support for the
BUG FIXES:
integration_service_environment_id (#18660 )
azurerm_spring_cloud_connection - correctly parse storage blob resource id
(#18699 )
azurerm_app_service_connection - correctly parse storage blob resource id
(#18699 )
FEATURES:
ENHANCEMENTS:
dependencies: updating to v0.43.0 of github.com/hashicorp/go-azure-helpers
(#18630 )
dependencies: updating to v0.20221004.1155444 of github.com/hashicorp/go-
azure-sdk (#18628 )
provider: support for auto-registering SDK Clients and Services (#18629 )
azurerm_batch_pool - support for the node_deallocation_method ,
dynamic_vnet_assignment_scope , and source_port_ranges properties (#18436 )
azurerm_kubernetes_cluster - support for pod_cidrs and service_cidrs
properties (#16657 )
azurerm_kubernetes_cluster - support for message_of_the_day ,
(#16741 )
azurerm_kubernetes_cluster_node_pool - support for message_of_the_day ,
scale_down_mode and workload_runtime properties (#16741 )
azurerm_load_test - switching to an auto-generated resource (#18654 )
azurerm_load_test - the computed attribute dataplane_uri is renamed to
data_plane_uri for consistency (#18654 )
azurerm_load_test - support for the description field (#18654 )
azurerm_user_assigned_identity - switching to an auto-generated resource
(#18654 )
BUG FIXES:
(#18396 )
azurerm_load_test - changing the name field now forces a new resource to be
created (#18654 )
azurerm_windows_function_app_slot - read app settings from the correct endpoint
(#18396 )
ENHANCEMENTS:
dependencies: machinelearning - updating to use 2022-05-01 (#17671 )
dependencies: updating to version v0.20220921.1082044 of
github.com/hashicorp/go-azure-sdk (#18557 )
provider: support for the oidc_token_file_path property and
ARM_OIDC_TOKEN_FILE_PATH environment variable (#18335 )
Data Source: azurerm_databricks_workspace - exports the location propertuy
(#18521 )
azurerm_api_management - support for the additional_location.gateway_disabled ,
certificate_source , and certificate_status properties (#18508 )
azurerm_automation_software_update_configuration - the classification property
property (#18566 )
azurerm_iotcentral_application - support for the identity and
public_network_access_enabled properties (#18564 )
azurerm_linux_virtual_machine - support for the gallery_application property
(#18406 )
azurerm_machine_learning_workspace - support for the
(#17999 )
azurerm_virtual_hub_bgp_connection - support for the
(#18406 )
BUG FIXES:
handling (#18116 )
ENHANCEMENTS:
(#18516 )
azurerm_data_factory_flowlet_data_flow - support for the
rejected_linked_service property (#18056 )
azurerm_data_factory_data_flow - support for the rejected_linked_service
property (#18056 )
azurerm_sentinel_alert_rule_scheduled - support for the techniques property
(#18430 )
azurerm_linux_virtual_machine - support for the patch_assessment_mode property
(#18437 )
azurerm_managed_disk - support for the PremiumV2_LRS type (#17671 )
azurerm_orchestrated_virtual_machine_scale_set - support for the
user_data_base64 property (#18486 )
azurerm_private_endpoint - support for the custom_network_interface_name
property (#18025 )
azurerm_virtual_machine_extension - support for the failure_suppression_enabled
property (#18441 )
azurerm_virtual_machine_scale_set_extension - support for the
property (#18437 )
BUG FIXES:
azurerm_monitor_metric_alert - pass multi criteria to the API in the correct order
(#18438 )
azurerm_monitor_diagnostic_settings - correctly parsing the case for the
workspace_id property (#18467 )
azurerm_security_center_workspace - correctly parsing the case for the
ENHANCEMENTS:
properties (#18394 )
azurerm_automation_account - support for the hybrid_service_url property
(#18320 )
azurerm_batch_pool - support for the user_assigned_identity_id property
(#17104 )
azurerm_batch_pool - support for the data_disks , disk_encryption , extensions ,
node_placement , task_scheduling_policy , user_accounts , and windows blocks
(#18226 )
azurerm_cosmosdb_account - support for User Assigned identities (#18378 )
azurerm_eventhub_namespace - support for the public_network_access_enabled
property (#18314 )
azurerm_logic_app_standard - support for the virtual_network_subnet_id property
BUG FIXES:
ENHANCEMENTS:
(#16437 )
azurerm_mssql_database - support for the maintenance_configuration_name
property (#18247 )
azurerm_virtual_desktop_host_pool - support for the scheduled_agent_updates
block (#17489 )
azurerm_hdinsight_kafka_cluster - support for the extension property (#17846 )
azurerm_hdinsight_spark_cluster - support for the extension property (#17846 )
azurerm_hdinsight_interactive_query_cluster - support for the extension
property (#17846 )
azurerm_hdinsight_hbase_cluster - support for the extension property (#17846 )
azurerm_hdinsight_hadoop_cluster - support for the extension property
(#17846 )
BUG FIXES:
(#18230 )
azurerm_log_analytics_solution - a state migration to work around the previously
NOTES:
properties had to be removed as they were not supported by the API version that
supported virtual network rules. (#18239 )
BUG FIXES:
ENHANCEMENTS:
properties (#17926 )
azurerm_cosmosdb_cassandra_cluster - support for the HoursBetweenBackups
property (#18154 )
azurerm_hdinsight_kafka_cluster - add support for the disk_encryption property
(#17351 )
azurerm_hdinsight_spark_cluster - add support for the disk_encryption property
(#17351 )
azurerm_hdinsight_interactive_query_cluster - add support for the
(#17351 )
azurerm_hdinsight_hadoop_cluster - add support for the disk_encryption property
(#17351 )
azurerm_iothub_dps - support for the resource_count , parallel_deployments , and
failure_percentage properties (#18151 )
azurerm_kubernetes_node_pool - spot node pools can now be upgraded
(#18124 )
azurerm_linux_virtual_machine - the source_image_id property now supports both
Community Gallery Images , and Shared Gallery Images resource IDs (#17571 )
azurerm_linux_virtual_machine_scale_set - support for the following properties
prioritize_unhealthy_instances_enabled (#17571 )
azurerm_linux_virtual_machine_scale_set - added support for the spot_restore
block (#17571 )
azurerm_linux_virtual_machine_scale_set - support for the spot_restore block
supports both Community Gallery Images , and Shared Gallery Images resource IDs
(#17571 )
azurerm_linux_virtual_machine_scale_set - support for the gallery_applications
property in favour of the scale_in block due to more fields being added
(#17571 )
azurerm_linux_virtual_machine_scale_set - support for the scale_in block
(#16367 )
azurerm_orchestrated_virtual_machine_scale_set - support for the following
now supports both Community Gallery Images , and Shared Gallery Images
resource IDs (#17571 )
azurerm_policy_definition - export the role_definition_ids` attribute (#18043 )
azurerm_resource_group_policy_remediation - support for the resource_count ,
property (#18005 )
azurerm_stream_analytics_output_eventhub - support for the authentication_mode
property (#18096 )
azurerm_stream_analytics_output_mssql - support for the authentication_mode
property (#18096 )
azurerm_stream_analytics_output_servicebus_topic - support for the
property (#18120 )
azurerm_stream_analytics_reference_input_blob - support for the
(#18211 )
azurerm_subscription_policy_remediation - support for the resource_count ,
parallel_deployments , and failure_percentage properties (#17313 )
azurerm_windows_virtual_machine - the source_image_id property now supports
both Community Gallery Images , and Shared Gallery Images resource IDs
(#17571 )
azurerm_windows_virtual_machine_scale_set - support for the following properties
host_group_id , and extension_operations_enabled (#17571 )
azurerm_windows_virtual_machine_scale_set - support for the data_disk block
prioritize_unhealthy_instances_enabled (#17571 )
azurerm_windows_virtual_machine_scale_set - added support for the spot_restore
block (#17571 )
azurerm_windows_virtual_machine_scale_set - support for the spot_restore block
supports both Community Gallery Images , and Shared Gallery Images resource IDs
(#17571 )
azurerm_windows_virtual_machine_scale_set - support for the
property in favour of the scale_in block due to more fields being added
(#17571 )
azurerm_windows_virtual_machine_scale_set - support for the scale_in block
BUG FIXES:
azurerm_kubernetes_cluster - kube_config is now set when Microsoft Entra ID is
(#17767 )
azurerm_spring_cloud_service - ignore the default zero value for
read_timeout_seconds (#18161 )
ENHANCEMENTS:
BUG FIXES:
(#18074 )
azurerm_mssql_elastic_pool - list of values for maintenance_configuration_name is
ENHANCEMENTS:
(#17853 )
azurerm_application_gateway - support for the global block (#17651 )
azurerm_application_gateway - support for components in
rewrite_rule_set.rewrite_rule.url (#13899 )
azurerm_automation_account - support for the private_endpoint_connection
property (#17934 )
azurerm_automation_account - support for the encryption block and
(#16758 )
azurerm_batch_pool - support for identity referencees in container registries
(#17416 )
azurerm_data_factory_data_flow - support for the flowlet block (#16987 )
azurerm_data_factory_integration_runtime_azure_ssis - support for the
(#17552 )
azurerm_linux_virtual_machine - now supports delete Eviction policies (#17226 )
azurerm_linux_virtual_machine_scale_set - now supports delete Eviction policies
(#17226 )
azurerm_mssql_elastic_pool - support for the maintenance_configuration_name
property (#17790 )
azurerm_mssql_server - support Disabled for the minimum_tls_version property
(#16595 )
azurerm_spring_cloud_app - support the public_endpoint_enabled property
(#17630 )
azurerm_spring_cloud_gateway_route_config - support for the
open_api;azurerm_spring_cloud_service and
log_stream_public_endpoint_enabledread_timeout_seconds properties (#17630 )
azurerm_shared_image - support for the architecture property (#17250 )
azurerm_storage_account - support for the default_to_oauth_authentication
property (#17116 )
azurerm_storage_table_entity - support for specifying data types on entity
properties (#15782 )
azurerm_shared_image_version - support for blob_uri and storage_account_id
(#17768 )
azurerm_windows_virtual_machine - now supports delete Eviction policies
(#17226 )
azurerm_windows_virtual_machine_scale_set - now supports delete Eviction
policies (#17226 )
azurerm_web_application_firewall_policy - support for the excluded_rule_set
property (#17757 )
azurerm_log_analytics_workspace - support for the cmk_for_query_forced property
(#17365 )
azurerm_lb_backend_address_pool_address - support for the
backend_address_ip_configuration_id property (#17770 )
BUG FIXES:
(#18014 )
azurerm_windows_function_app_slot - fixa bug with setting values for
WindowsFxString (#18014 )
azurerm_linux_function_app - correctly send WEBSITE_CONTENTSHARE and
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING (#18035 )
azurerm_linux_function_app - fixcontent settings when
storage_uses_managed_identity is set to true (#18035 )
azurerm_linux_function_app_slot - correctly send WEBSITE_CONTENTSHARE and
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING (#18035 )
azurerm_linux_function_app_slot - fixcontent settings when
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING (#18035 )
azurerm_windows_function_app - fixcontent settings when
ENHANCEMENTS:
block (#15783 )
azurerm_subnet - deprecate enforce_private_link_endpoint_network_policies
BUG FIXES:
(#17780 )
azurerm_proximity_placement_group - refactoring to use hashicorp/go-azure-sdk
(#17776 )
azurerm_shared_image - improved validation for the publisher , offer and sku
Microsoft.Orbital/orbitalGateway (#17854 )
azurerm_eventhub_namespace - support for the local_authentication_enabled ,
public_network_access_enabled , and minimum_tls_version properties (#17194 )
BUG FIXES:
ENHANCEMENTS:
(#17719 )
azurerm_bot_service_azure_bot - support for the streaming_endpoint_enabled
property (#17423 )
azurerm_cognitive_account - support for the
custom_question_answering_search_service_key property (#17683 )
asurerm_iothub_dps_certificate - support for the is_verified property
(#17106 )
azurerm_linux_web_app - the virtual_network_subnet_id property is no longer
ForceNew (#17584 )
azurerm_linux_web_app_slot - the virtual_network_subnet_id property is no
BUG FIXES:
Resource Provider defined in different casings would cause the API Version to not
be identified (#17707 )
ENHANCEMENTS:
(#17581 )
azurerm_storage_account - supports for the change_feed_retention_in_days
property (#17130 )
ENHANCEMENTS:
property (#17526 )
azurerm_kusto_eventhub_data_connection - support for the database_routing_type
property (#17525 )
azurerm_kusto_eventgrid_data_connection - support for the
database_routing_type , eventgrid_resource_id , and
(#17496 )
azurerm_linux_virtual_machine_scale_set - support for
os disks (#17013 )
azurerm_orchestrated_virtual_machine_scale_set - support for the placement
property (#16652 )
azurerm_windows_virtual_machine_scale_set - support for
capacity_reservation_group_id property (#17530 )
azurerm_windows_virtual_machine_scale_set - support for the placement property
TLS_RSA_WITH_3DES_EDE_CBC_SHA (#17554 )
azurerm_dev_test_lab_schedule - deleting the schedule during deletion (#17614 )
azurerm_linux_function_app - set the default_hostname properly on read
(#17498 )
azurerm_linux_function_app_slot - set the default_hostname properly on read
(#17498 )
azurerm_windows_function_app - set the default_hostname properly on read
(#17498 )
azurerm_windows_function_app - correctly create function apps when custom
(#17498 )
azurerm_windows_function_app_slot - correctly create function apps when custom
ENHANCEMENTS:
(#17415 )
azurerm_kubernetes_clusterl - support for the capacity_reservation_group_id
property (#17395 )
azurerm_kubernetes_node_pool - support for the capacity_reservation_group_id
property (#17395 )
azurerm_linux_virtual_machine - support for the capacity_reservation_group_id
property (#17236 )
azurerm_spring_cloud_deployment - support for the addon_json property
(#16984 )
azurerm_synapse_integration_runtime_azure - the location property now supports
property (#17236 )
BUG FIXES:
ENHANCEMENTS:
properties (#17077 )
azurerm_bot_channels_registration - support for the streaming_endpoint_enabled
property (#17369 )
azurerm_data_factory - support for the purview_id property (#17001 )
azurerm_digital_twins_instance - support for the identity block (#17076 )
azurerm_key_vault_key - exporting the resource_id and resource_versionless_id
attributes (#17424 )
azurerm_key_vault_secret - exporting the resource_id and
(#17354 )
azurerm_linux_web_app_slot - support for the virtual_network_subnet_id property
(#17354 )
azurerm_private_link_service - support for the fqdns property (#17366 )
azurerm_shared_image_version - support Premium_LRS for the
storage_account_type property (#17390 )
azurerm_shared_image_version - support for the disk_encryption_set_id ,
(#15849 )
azurerm_vpn_site - support for the o365_policy block (#16820 )
BUG FIXES:
Data Source: azurerm_key_vault - caching the Key Vault URI when the Key Vault is
retrieved (#17407 )
azurerm_application_gateway - prevent a crash when the waf_configuration block
is removed (#17241 )
azurerm_data_factory_dataset_snowflake - ensuring schema is sent to the API to fix
user_id (#17398 )
azurerm_key_vault - ensuring that soft_delete_enabled is explicitly set when
(#17296 )
azurerm_linux_web_app - correctly validate the app_setting_names and
contain / (#16484 )
azurerm_policy_assignment - the name property can no longer contain /
(#16484 )
azurerm_resource_group_policy_assignment - the name property can no longer
contain / (#16484 )
azurerm_subscription_policy_assignment - the name property can no longer
contain / (#16484 )
azurerm_windows_function_app - correctly validate the app_setting_names and
connection_string_names properties within the sticky_settings block (#17209 )
azurerm_windows_web_app - correctly configure auto_heal and slow_request
(#17296 )
azurerm_windows_web_app - correctly validate the app_setting_names and
ENHANCEMENTS:
BUG FIXES:
ENHANCEMENTS:
BUG FIXES:
ignored (#16524 )
azurerm_application_gateway - add default value for
backend_http_settings.0.request_timeout (#17162 )
azurerm_applicaton_gateway - priority is now required (#16849 )
azurerm_container_group - Double the delete check timeout for nic (#17115 )
azurerm_windows_function_app_x - custom_domain_verification_id is now written
ENHANCEMENTS:
(#16922 )
azurerm_backup_policy_vm - support for V2 policies viu the policy_type property,
(#17138 )
azurerm_synapse_role_assignment - the role_name property now supports Synapse
BUG FIXES:
(#17057 )
azurerm_kubernetes_cluster - prevent a potential crash during import of a cluster
ENHANCEMENTS:
backup (#16939 )
azurerm_backup_protected_vm - the backup is now removed from state when it is
(#16918 )
azurerm_linux_virtual_machine - add support for Confidential VMs (#16905 )
azurerm_linux_virtual_machine_scale_set - add support for Confidential VMs
(#16916 )
azurerm_linux_web_app - add support for zip_deploy_file property (#16779 )
azurerm_linux_web_app_slot - add support for zip_deploy_file property
(#16779 )
azurerm_managed_disk - add support for Confidential VM (#16908 )
azurerm_spring_cloud_service - suppport the build_agent_pool_size property
(#16841 )
azurerm_spring_cloud_service - support the zone_redundant property (#16872 )
azurerm_synapse_spark_pool - the spark_version property now supports 3.2
(#16906 )
azurerm_virtual_network_gateway_connection - support for the
egress_nat_rule_ids and ingress_nat_rule_ids properties (#16862 )
azurerm_vpn_gateway - support for the bgp_route_translation_for_nat_enabled
property (#16817 )
azurerm_vpn_gateway_connection - support for the custom_bgp_address block
(#16960 )
azurerm_windows_virtual_machine - add support for Confidential VMs (#16905 )
azurerm_windows_virtual_machine_scale_set - add support for Confidential VM
(#16916 )
azurerm_windows_web_app - add support for zip_deploy_file property (#16779 )
azurerm_windows_web_app_slot - add support for zip_deploy_file property
(#16779 )
BUG FIXES:
replicas (#16506 )
azurerm_linux_function_app_slot - correctly check for name availability during
creation (#16410 )
azurerm_windows_function_app_slot - correctly check for name availability during
creation (#16410 )
azurerm_windows_virtual_machine - changing the timezone property now creates a
ENHANCEMENTS:
property (#16832 )
BUG FIXES:
(#16804 )
azurerm_shared_image - changing the eula property now creates a new resource
(#16868 )
DEPRECATIONS:
and will be Retired on 2022-11-30 - as such this resource is deprecated and will be
removed in v4.0 of the AzureRM Provider (#16847 )
ENHANCEMENTS:
updated (#16360 )
azurerm_kubernetes_cluster - the property default_node_pool.node_labels can
network_profile.network_plugin (#16250 )
azurerm_kusto_script - lock kusto cluster so multiple scripts can be applied
(#16690 )
azurerm_storage_share - support the access_tier attribute (#16462 )
azurerm_snapshot - support for the trusted_launch_enabled propertyu (#16679 )
azurerm_stream_analytics_function_javascript_uda - support for the
input.configuration_parameter property (#16575 )
azurerm_stream_analytics_function_javascript_udf - support for the
BUG FIXES:
ENHANCEMENTS:
property (#16351 )
azurerm_windows_virtual_machine_scale_set - improve validation on the
termination_notification.timeout property (#16594 )
azurerm_virtual_network_gateway_connection - the traffic_selector_policy
BUG FIXES:
null_value (#16543 )
azurerm_linux_function_app - correctly deduplicate user app_settings (#15740 )
azurerm_linux_function_app - fix app_settings.WEBSITE_RUN_FROM_PACKAGE handling
(#15740 )
azurerm_linux_function_app_slot - fix app_settings.WEBSITE_RUN_FROM_PACKAGE
(#15740 )
azurerm_windows_function_app_slot - correctly deduplicate user app_settings
(#15740 )
ENHANCEMENTS:
dependencies: updating to v63.1.0 of github.com/Azure/azure-sdk-for-go
(#16283 )
dependencies: updating to v0.11.26 of github.com/Azure/go-autorest (#16458 )
dependencies: upgrading to v0.30.0 of github.com/hashicorp/go-azure-helpers
(#16504 )
dependencies: upgrade sqlvirtualmachine to 2021-11-01-preview (#15835 )
Data Source: azurerm_linux_function_app - add support for sticky_settings
(#16546 )
Data Source: azurerm_linux_web_app - add support for sticky_settings
(#16546 )
Data Source: azurerm_windows_function_app - add support for sticky_settings
(#16546 )
Data Source: azurerm_windows_web_app - add support for sticky_settings
(#16546 )
azurerm_kubernetes_cluster - support for the run_command_enabled property
(#15029 )
azurerm_linux_function_app - add support for sticky_settings (#16546 )
azurerm_linux_web_app - add support for sticky_settings (#16546 )
azurerm_monitor_aad_diagnostic_setting - remove validation on log.category to
allow for new log categories that are available in Azure (#16534 )
azurerm_mssql_database - Support for
short_term_retention_policy.0.backup_interval_in_hours (#16528 )
azurerm_postgresql_server - add validation for public_network_access_enabled
(#16516 )
azurerm_stream_analytics_job - support for the type property (#16548 )
azurerm_windows_function_app - add support for sticky_settings (#16546 )
azurerm_windows_web_app - add support for sticky_settings (#16546 )
azurerm_linux_virtual_machine_scale_set - the terminate_notification property
BUG FIXES:
ENHANCEMENTS:
property (#16118 )
azurerm_kubernetes_cluster - support for the microsoft_defender block
(#16218 )
azurerm_redis_enterprise_cluster - support for the linked_database_id and
property (#16277 )
azurerm_stream_analytics_output_mssql - support for the system_property_columns
property (#16425 )
azurerm_stream_analytics_output_servicebus_topic - support for the
property (#16389 )
azurerm_virtual_hub_connection - the internet_security_enabled property can
BUG FIXES:
azurerm_cdn_endpoint - the origin.http and origin.https_ports properties now
is used (#16446 )
azurerm_sentinel_alert_rule_fusion - no longer sends the etag property during
(#16402 )
azurerm_windows_function_app - the ip_address property is now correctly set into
ENHANCEMENTS:
does (#16288 )
azurerm_media_streaming_endpoint support Standard Streaming Endpoints
(#16304 )
azurerm_cdn_endpoint - the url_path_condition property now allows the RegEx
BUG FIXES:
(#16369 )
azurerm_mysql_flexible_server - backup_retention_days can now be set any value
from 1 - 35 (#16312 )
azurerm_sentinel_watchlist - support for the required property item_search_key
(#15861 )
azurerm_vpn_server_configuration - the server_root_certificate property is now
optional (#16366 )
azurerm_storage_data_lake_gen2_path - support $superuser as an option for owner
ENHANCEMENTS:
sensitive (#16152 )
azurerm_cosmosdb_sql_container - the property indexing_mode is now case-
sensitive (#16152 )
azurerm_dedicated_host - support for the the DSv3-Type4 and ESv3-Type4 SKUs
(#16253 )
azurerm_kubernetes_cluster - support for the oidc_issuer_enabled and
(#16156 )
azurerm_servicebus_namespace - support for the customer_managed_key block
(#15601 )
azurerm_web_application_firewall_policy - add KNOWN-CVES to accepted values for
rule_group_name (#16080 )
azurerm_servicebus_namespace - add support for the local_auth_enabled property
(#16268 )
BUG FIXES:
API (#16006 )
azurerm_api_management_api_operation - prevent a potential panic when parsing
representation (#14848 )
azurerm_application_gateway - a frontend_ip_configuration blocks can now be
updated (#16132 )
azurerm_application_insights - remove the disable logic for the created Action
Groups (#16170 )
azurerm_cosmosdb_sql_container - disabling the analytical_storage_ttl property
(#16134 )
azurerm_linux_function_app_slot - only one of application_insights_key or
(#16134 )
azurerm_windows_function_app - fixthe import check for Service Plan OS type
(#16164 )
azurerm_linux_web_app_slot - fix container_registry_managed_identity_client_id
current_stack (#16129 )
azurerm_windows_web_app - fixdocker windowsFXVersion when
docker_container_registry is specified (#16192 )
azurerm_windows_web_app_slot - add support for dotnetcore in site metadata
property (#16066 )
azurerm_key_vault - fixthe authorizer was not an auth.CachedAuthorizer error
(#16078 )
azurerm_linux_function_app - correctly update storage settings when using MSI
(#16046 )
azurerm_managed_disk - changing the zone property now correctly creates a new
resource (#16070 )
azurerm_resource_group - now during deletion if there are still resources found in
the group it will wait a little bit and check again to handle eventually consistancy
bugs (#16073 )
azurerm_windows_function_app - correctly update the storage settings when using
Major Version: Version 3.0 of the Azure Provider is a major version - some
behaviours have changed and some deprecated fields/resources have been
removed - refer to the 3.0 upgrade guide for more information .
When upgrading to v3.0 of the AzureRM Provider, we recommend upgrading to
the latest version of Terraform Core (which can be found here ) - the next major
release of the AzureRM Provider (v4.0) will require Terraform 1.0 or later.
FEATURES:
(#15747 )
ENHANCEMENTS:
dependencies: updating to v62.3.0 of github.com/Azure/azure-sdk-for-go
(#15927 )
dependencies: updating to v0.26.0 of github.com/hashicorp/go-azure-helpers
(#15889 )
dependencies: updating appplatform to API Version 2022-01-01-preview
(#15597 )
provider: MSAL (and Microsoft Graph) is now used for authentication instead of
ADAL (and Azure Active Directory Graph) (#12443 )
provider: all (non-deprecated) resources now validate the Resource ID during
import (#15989 )
provider: added a new feature flag within the api_management block for
recover_soft_deleted , for configuring whether a soft-deleted
should prevent the deletion of a Resource Group which still contains items
(#13777 )
provider: the feature flag permanently_delete_on_destroy within the
log_analytics_workspace block now defaults to true (#15948 )
Resources supporting Availability Zones: Zones are now treated consistently across
the Provider and the field within Terraform is renamed to either zone (for a single
Zone) or zones (where multiple can be defined) - the complete list of resources
can be found in the 3.0 Upgrade Guide (#14588 )
Resources supporting Managed Identity: Identity blocks are now treated
consistently across the Provider - the complete list of resources can be found in
the 3.0 Upgrade Guide (#15187 )
provider: removing the network and relaxed_locking feature flags, since this is
now enabled by default (#15719 )
Data Source: azurerm_linux_function_app - support for the
storage_key_vault_secret_id property (#15793 )
Data Source: azurerm_storage_account_sas - now exports the tag and filter
attributes (#15863 )
Data Source: azurerm_windows_function_app - support for
storage_key_vault_secret_id property (#15793 )
azurerm_application_insights - can now disable Rule and Action Groups that are
property (#15793 )
azurerm_linux_function_app - updating the read timeout to be 5m (#15867 )
azurerm_linux_function_app - support for node version 16 preview (#15884 )
azurerm_linux_function_app - add support for use_dotnet_isolated_runtime
(#15969 )
azurerm_linux_function_app_slot - add support for use_dotnet_isolated_runtime
(#15969 )
azurerm_linux_function_app_slot - add support for storage_key_vault_secret_id
(#15793 )
azurerm_linux_function_app_slot - updating the read timeout to be 5m
(#15867 )
azurerm_linux_virtual_machine - support for the termination_notification
property (#14933 )
azurerm_linux_virtual_machine - support for the edge_zone property (#15890 )
azurerm_linux_virtual_machine_scale_set - support for the edge_zone property
(#15890 )
azurerm_linux_web_app - support for PHP version 8.0 (#15933 )
azurerm_loadbalancer - support for the edge_zone property (#15890 )
azurerm_managed_disk - support for the edge_zone property (#15890 )
azurerm_management_group_policy_assignment - support for User Assigned
Identities (#15376 )
azurerm_mssql_server - the minimum_tls_version property now defaults to 1.2
(#10276 )
azurerm_mysql_server - the ssl_minimal_tls_version_enforced property now
name (#15719 )
azurerm_postgresql_server - the ssl_minimal_tls_version_enforced property now
Group if there's any items remaining and will raise an error if so by default (to
avoid deleting items unintentionally). This behaviour can be controlled using the
prevent_deletion_if_contains_resources feature-flag within the resource_group
(#15376 )
azurerm_resource_policy_assignment - support for User Assigned Identities
(#15376 )
azurerm_sentinel_alert_rule_scheduled - support for alert_details_override
(#15901 )
azurerm_sentinel_alert_rule_scheduled - support for entity_mapping [#15901 ]
azurerm_sentinel_alert_rule_scheduled - support for custom_details (#15901 )
azurerm_sentinel_alert_rule_scheduled - support for group_by_alert_details
(#15901 )
azurerm_sentinel_alert_rule_scheduled - support for group_by_custom_details
(#15901 )
azurerm_site_recovery_replicated_vm - support for the target_availability_zone
property (#15617 )
azurerm_shared_image - support for the support_accelerated_network property
(#15562 )
azurerm_static_site - the identity property now supports SystemAssigned and
UserAssigned (#15834 )
azurerm_storage_account - the allow_blob_public_access property is renamed to
(#12689 )
azurerm_storage_account - support for the edge_zone property (#15890 )
azurerm_storage_account - ZRS is no longer supported when using StorageV1
(#16004 )
azurerm_storage_account - the min_tls_version property now defaults to 1.2
(#10276 )
azurerm_storage_share - quota is now required (#15982 )
azurerm_subscription_policy_assignment - support for User Assigned Identities
(#15376 )
azurerm_virtual_network - support for the edge_zone property (#15890 )
azurerm_virtual_network_gateway - support for the edge_zone property (#15890 )
azurerm_virtual_hub - support for the virtual_router_asn and
property (#15793 )
azurerm_windows_function_app - updating the read timeout to be 5m (#15867 )
azurerm_windows_function_app node version validation string can not be prefixed
with ~ (#15884 )
azurerm_windows_function_app support for node version 16 preview support
(#15884 )
azurerm_windows_function_app - add support for use_dotnet_isolated_runtime
(#15969 )
azurerm_windows_function_app_slot - add support for
use_dotnet_isolated_runtime (#15969 )
azurerm_windows_function_app_slot - add support for the
storage_key_vault_secret_id property (#15793 )
azurerm_windows_function_app_slot - updating the read timeout to be 5m
(#15867 )
azurerm_windows_virtual_machine - support for the termination_notification
property (#14933 )
azurerm_windows_virtual_machine - support for the edge_zone property (#15890 )
azurerm_windows_virtual_machine_scale_set - support for the edge_zone property
(#15890 )
BUG FIXES:
List (#6896 )
azurerm_application_gateway - the field host_names within the frontend_port
List (#6896 )
azurerm_application_gateway - the private_endpoint_connection block is now a
(#6896 )
azurerm_application_gateway - the redirect_configuration block is now a Set
a List (#6896 )
azurerm_container_registry - validate the georepliactions property does not
be set to -1 (#15736 )
azurerm_eventhub - prevent panic when the capture_description block is removed
(#15930 )
azurerm_key_vault_access_policy - validating the Resource ID during import
(#15989 )
azurerm_linux_function_app - fixed update handling of app_settings for
WEBSITE_CONTENTSHARE and WEBSITE_CONTENTAZUREFILECONNECTIONSTRING (#15907 )
azurerm_linux_function_app_slot - fixed update handling of app_settings for
WEBSITE_CONTENTSHARE and WEBSITE_CONTENTAZUREFILECONNECTIONSTRING (#15907 )
azurerm_local_network_gateway - fixfor address_space cannot be updated
(#15159 )
azurerm_log_analytics_cluster_customer_managed_key - detecting when the
For information on changes between the v2.99.0 and v2.0.0 releases, see the previous
v2.x changelog entries .
For information on changes between the v1.44.0 and v1.0.0 releases, see the previous
v1.x changelog entries .
For information on changes prior to the v1.0.0 release, see the v0.x changelog .
Versions 2.0.0 - 2.99.0
Preparation for 3.0: We intend for v2.99.0 to be the last release in the 2.x line -
we’ll be turning our focus to 3.0 with the next release. We recommend consulting
the list of changes coming in 3.0 to be aware and trialling the Beta available in
the latest 2.x releases if you’re interested.
FEATURES:
ENHANCEMENTS:
(#15584 )
Data Source: azurerm_kubernetes_cluster - deprecated the
role_based_access_control block in favour of
azure_active_directory_role_based_access_control and
(#15036 )
azurerm_kubernetes_cluster - deprecate the role_based_access_control block in
support 0 (#15694 )
azurerm_machine_learning_compute_instance - updating the validation on the name
property (#14839 )
azurerm_mssql_database_extended_auditing_policy - support for the enabled
property (#15624 )
azurerm_mssql_server_extended_auditing_policy - support for the enabled
property (#15624 )
azurerm_management_group_policy_assignment - the parameters property can now
be updated (#15623 )
azurerm_mssql_server - the administrator_login and
administrator_login_password properties are now optional when Microsoft Entra
updated (#15623 )
azurerm_resource_group_policy_assignment - the parameters property can now be
updated (#15623 )
azurerm_recovery_service_vault - support for the cross_region_restore_enabled
property (#15757 )
azurerm_subscription_policy_assignment - the parameters property can now be
updated (#15623 )
azurerm_storage_object_replication - support for replicating containers across
subscriptions (#15603 )
BUG FIXES:
(#15656 )
azurerm_batch_job - will not longer fail during creation if multiple
common_environment_properties are set (#15686 )
azurerm_container_group - correctly parse empty or omitted dns_config.options
ENHANCEMENTS:
(#15553 )
azurerm_linux_function_app_slot - adds key_vault_reference_identity_id
support (#15553 )
azurerm_windows_function_app - adds key_vault_reference_identity_id support
(#15553 )
azurerm_windows_function_app_slot - adds key_vault_reference_identity_id
support (#15553 )
BUG FIXES:
creation (#15561 )
3.0 Beta: This release includes a new feature-flag to opt-into the 3.0 Beta - which
(when enabled) introduces a number of new data sources/resources, behavioural
changes, field renames and removes some older deprecated resources. The 3.0
Beta is still a work-in-progress at this time and as such the changes listed in the 3.0
Upgrade Guide may change, however we're interested to hear your feedback
and instructions on how to opt-into the 3.0 Beta can be found here .
FEATURES:
ENHANCEMENTS:
property (#15429 )
azurerm_kubernetes_cluster - deprecate the addon_profile block, moving all
properties to the top level as well as removing the enabled field for all add-ons
(#15108 )
azurerm_kusto_cluster - supports for the public_network_access_enabled property
(#15428 )
azurerm_machine_learning_workspace - support for both SystemAssigned,
UserAssigned and UserAssigned Identities (#14181 )
azurerm_machine_learning_workspace - support for encryption using a User
(#14917 )
azurerm_iothub_dps - support for the ip_filter_rule block and the
(#15400 )
azurerm_servicebus_namespace - support for the identity block (#15371 )
azurerm_storage_account - add support for creating a customer managed key
tier_to_archive_after_days_since_last_access_time_greater_than, and
delete_after_days_since_last_access_time_greater_than (#15423 )
azurerm_web_pubsub - support for the identity block (#15288 )
BUG FIXES:
(#15386 )
ENHANCEMENTS:
resources (#15344 )
azurerm_kusto_cluster - support for the enable_auto_stop (#15332 )
azurerm_linux_virtual_machine - support the StandardSSD_ZRS and Premium_ZRS
(#14906 )
azurerm_network_watcher_flow_log - the name property can now be set for new
resources (#15016 )
azurerm_orchestrated_virtual_machine_scale_set - full support for Automatic VM
BUG FIXES:
resource (#15291 )
azurerm_firewall - working around an Azure API issue when deleting the Firewall
(#15330 )
azurerm_kubernetes_cluster - unsetting outbound_ip_prefix_ids or
ENHANCEMENTS:
property (#14936 )
azurerm_recovery_services_vault - support Zone Redundant storage (#14980 )
azurerm_web_pubsub_hub - the managed_identity_id property within the auth block
property (#14936 )
BUG FIXES:
provider: support for the Azure German cloud has been removed in this release as
this environment is no longer operational (#14403 )
azurerm_api_management_policy - resources that were created with v2.92.0 will be
marked as tainted due to a bug . This version addresses the underlying issue, but
the actual resource needs to either be untainted (via terraform untaint ) or allow
Terraform to delete the resource and create it again.
azurerm_hdinsight_kafka_cluster - the security_group_name property in the
enabled (#14403 )
FEATURES:
ENHANCEMENTS:
property (#15019 )
BUG FIXES:
(#15123 )
azurerm_api_management_policy - fixing the Resource ID for the
api_management_policy block when this was provisioned using version 2.92.0 of
property (#15074 )
azurerm_dev_test_lab - fix an unexpected diff on with the key_vault_id property
(#15054 )
azurerm_subscription_cost_management_export - now sents the ETag when
ENHANCEMENTS:
(#14987 )
azurerm_bastion_host - support for the scale_units property (#14968 )
azurerm_security_center_automation - the event_source property can now be set
to AssessmentsSnapshot , RegulatoryComplianceAssessment ,
RegulatoryComplianceAssessmentSnapshot , SecureScoreControlsSnapshot ,
BUG FIXES:
recreation and the content_length property of share file will now be set when
updating properties. (#15007 )
ENHANCEMENTS:
(#14771 )
azurerm_mssql_server_extended_auditing_policy - support storing audit data in
property (#14864 )
BUG FIXES:
(#14924 )
azurerm_cosmosdb_mongo_collection - now validates that "_id" is included as an
default (#14943 )
azurerm_iothub - now exports event_hub_events_namespace and has a fallback
ENHANCEMENTS:
(#13888 )
azurerm_managed_disk - support for the gallery_image_reference_id property
(#14121 )
azurerm_mysql_server - support capacities up to 16TB for the storage_mb property
(#14838 )
azurerm_postgresql_flexible_server - support for the
geo_redundant_backup_enabled property (#14661 )
azurerm_recovery_services_vault - support for the storage_mode_type property
(#14659 )
azurerm_spring_cloud_certificate - support for the certificate_content property
(#14689 )
azurerm_servicebus_namespace_authorization_rule - the resource_group_name and
property (#14784 )
azurerm_servicebus_namespace_network_rule_set - the resource_group_name and
namespace_name properties have been deprecated in favour of the namespace_id
property (#14784 )
azurerm_servicebus_namespace_authorization_rule - the resource_group_name and
namespace_name properties have been deprecated in favour of the namespace_id
property (#14784 )
azurerm_servicebus_queue - the resource_group_name and namespace_name
property (#14738 )
azurerm_web_application_firewall_policy - the file_upload_limit_in_mb property
(#13888 )
BUG FIXES:
fix the bug introduced by the first one and to parse the subscription_id from the
resource's ID (#14803 )
azurerm_network_interface_security_group_association - checking the ID matches
ENHANCEMENTS:
(#14648 )
azurerm_container_group - support for ip_address_type = None (#14460 )
azurerm_cosmosdb_account - support for the create_mode property and restore
block (#14362 )
azurerm_data_factory_dataset_* - deprecate data_factory_name in favour of
data_factory_id for consistency across all data factory dataset resources
(#14610 )
azurerm_data_factory_integration_runtime_* - deprecate data_factory_name in
(#14610 )
azurerm_data_factory_pipeline - deprecate data_factory_name in favour of
(#14007 )
azurerm_signalr - support for the live_trace_enabled property (#14646 )
azurerm_xyz_policy_assignment add support for non_compliance_message
(#14518 )
BUG FIXES:
updates (#14638 )
azurerm_marketplace_agreement - fix crash when the import check triggers
(#14614 )
azurerm_postgresql_configuration - now locks during write operations to prevent
conflicts (#14619 )
azurerm_postgresql_flexible_server_configuration - now locks during write
ENHANCEMENTS:
of data_factory_id for consistency across all data factory linked service resources
(#14492 )
azurerm_shared_image - support for the trusted_launch_enabled property
(#14528 )
azurerm_key_vault_certificate - support for the versionless_id and
addon (#14308 )
azurerm_managed_disk - support for the hyper_v_generation property (#13825 )
azurerm_netapp_pool - support for qos_type property (#14372 )
azurerm_netapp_volume - support for throughput_in_mibps property (#14372 )
azurerm_sql_managed_instance : Support for storage_account_type (#14123 )
azurerm_signalr_service - deprecate features block in favour of
connectivity_logs_enabled , messaging_logs_enabled and service_mode (#14360 )
azurerm_vpn_gateway_connection - support for the propagated_route_table.labels ,
BUG FIXES:
azurerm_data_fatory_trigger_schedule - correctly set schedule when frequency is
Month/Week (#14391 )
azurerm_iothub_endpoint_storage_container - remove the default value false
from the file_name_format property and add the correct validation function for it
(#14458 )
azurerm_postgresql_server - will now change the password after being promoted
BETA NOTES:
A number of properties in the App Service Beta resources have been renamed for
consistency with the rest of the provider. As these are beta resources, this breaking
change is not compensated for with deprecations or state migrations. Please update any
configurations using these resources with the following details:
ENHANCEMENTS:
(#14355 )
azurerm_linux_virtual_machine - support the secure_boot_enabled and
property (#14345 )
azurerm_subscription - the tags property can now be set and updated (#14445 )
BUG FIXES:
dns_config block to be optional since they are not required by the API (#14419 )
azurerm_monitor_aad_diagnostic_setting - fixing the id validator to use the
ENHANCEMENTS:
(#14318 )
azurerm_firewall_policy - allow cidr ranges for the
(#14199 )
azurerm_mssql_elasticpool - support for the DC family (#14270 )
azurerm_mssql_server - groundwork for the (currently disabled) 3.0 feature to set
(#14236 )
azurerm_postgresql_server - groundwork for the (currently disabled) 3.0 feature to
BUG FIXES:
EventHub (#14277 )
azurerm_stream_analytics_stream_input_eventhub - correctly support creation with
configured (#14275 )
azurerm_linux_virtual_machine - the patch_mode property is now properly
supported [GH0-14042]
ENHANCEMENTS:
property (#14235 )
azurerm_cost_management_export_resource_group - has been deprecated in favour
(#14218 )
azurerm_elastic_pool - support for the Fsv2 family SKUs (#14250 )
azurerm_key_vault_certificate - groundwork for the (currently disabled) 3.0
(#14137 )
azurerm_mssql_server - support for the azuread_authentication_only property on
creation (#14169 )
azurerm_machine_learning_workspace - support for the encryption block
(#14120 )
azurerm_orchestrated_virtual_machine_scale_set - added support for VMSS Flex
(#14217 )
azurerm_resource_provider_registration - support for managing features
(#12385 )
azurerm_windows_virtual_machine - support for the vtpm_enabled and
secure_boot_enabled properties (#13713 )
azurerm_windows_virtual_machine_scale_set - support for the vtpm_enabled and
secure_boot_enabled properties (#13713 )
azurerm_windows_web_app - (Beta) add support for the
(#14202 )
azurerm_stream_analytics_output_servicebus_topic - support for the
property_columns property (#14252 )
azurerm_storage_account - support for table_encryption_key_type and
(#14200 )
azurerm_virtual_desktop_application_group - support for the
BUG FIXES:
an existing storage account not returned by the Backup Protectable Items API
(#14238 )
azurerm_frontdoor - validation for probe_method allows the default value
(#14204 )
azurerm_key_vault_managed_hardware_security_module - extend context timeouts
IMPROVEMENTS:
dependencies: upgrading to v0.17.1 of github.com/hashicorp/go-azure-helpers
(#14141 )
dependencies: upgrading to v2.8.0 of github.com/hashicorp/terraform-plugin-
sdk (#14060 )
azurerm_application_insights - support for the internet_ingestion_enabled and
(#14085 )
azurerm_sql_managed_instance - support for the identity block (#14052 )
azurerm_virtual_network_gateway - enable configuration of an active-active zone
BUG FIXES:
(#14026 )
azurerm_app_service_virtual_network_swift_connection - fixing a panic when
(#14093 )
azurerm_redis_cache - parsing the subnet_id response value case-insensitively
(#14108 )
azurerm_redis_cache - ensuring that shard_count always has a value set
(#14108 )
azurerm_storage_blob - ensuring that cache_control is sent during updates
(#14100 )
IMPROVEMENTS:
property (#13988 )
azurerm_cosmosdb_account - the backup backup type can now be changed from
property (#13976 )
azurerm_firewall_policy - support for the insights block (#14004 )
azurerm_logic_app_integration_account - support the
(#13962 )
azurerm_key_vault_key - support for the public_key_pem and public_key_openssh
attributes (#13934 )
azurerm_linux_virtual_machine - support for the patch_mode property (#13866 )
azurerm_machine_learning_compute_cluster - support for the local_auth_enabled
property (#13820 )
azurerm_machine_learning_compute_cluster - support for the local_auth_enabled
property (#13820 )
azurerm_machine_learning_synapse_spark - support for the local_auth_enabled
property (#13820 )
azurerm_monitor_smart_detector_alert_rule - support additional detector types
(#13998 )
azurerm_mssql_elasticpool - support GP_FSv2 for the sku property (#13973 )
azurerm_synapse_workspace - supports for the sql_aad_admin block (#13659 )
azurerm_sql_managed_instance - support for the dns_zone_partner_id property
(#13951 )
azurerm_storage_blob - support for the cache_control property (#13946 )
azurerm_storage_share - support for the enabled_protocol property (#13938 )
BUG FIXES:
property (#13971 )
azurerm_logic_app_standard - will no longer error when working on private
networks (#13964 )
azurerm_managed_disk_resource - the validation for the disk_iops_read_write and
IMPROVEMENTS:
scale_to_zero_before_deletion (#13635 )
azurerm_managed_disk - support for the trusted_launch_enabled property
(#13849 )
azurerm_postgres_flexible_server - enhanced validation for the
administrator_login property (#13942 )
azurerm_servicebus_queue - support for the max_message_size_in_kilobytes
property (#13762 )
azurerm_servicebus_topic - support for the max_message_size_in_kilobytes
property (#13762 )
azurerm_servicebus_namespace_network_rule_set - support for the
(#13840 )
azurerm_virtual_machine_scale_set_extension - support for
automatic_upgrade_enabled (#13394 )
azurerm_windows_virtual_machine_scale_set - support for
automatic_upgrade_enabled in extensions (#13394 )
BUG FIXES:
(#13906 )
azurerm_app_configuration_key - now supports forward slashes in the key
(#13859 )
azurerm_application_gateway - prevent multiple ssl_policy blocks (#13929 )
azurerm_cosmosdb_account - the capabilities property is now computed
(#13936 )
azurerm_cognitive_account - will now handle the unexpected state Accepted when
resource (#13904 )
IMPROVEMENTS:
property (#13767 )
azurerm_data_factory_integration_runtime_azure - support AutoResolve for the
location property (#13731 )
azurerm_disk_encryption_set - support for the auto_key_rotation_enabled
property (#13747 )
azurerm_iot_security_solution - support for the additional_workspace and
property (#13559 )
azurerm_lb_backend_address_pool - support for the tunnel_interface block
(#13559 )
azurerm_lb_rule - the backend_address_pool_ids property has been deprecated in
(#13754 )
azurerm_network_interface - support for the
BUG FIXES:
MongoDBv3.4 . (#13757 )
azurerm_mssql_server - will now configure the azuread_administrator during
underscore (#13797 )
IMPROVEMENTS:
upgrading batch to API Version 2021-06-01 (#13718 )
upgrading mssql to API Version v5.0 (#13622 )
Data Source: azurerm_key_vault - exports the enable_rbac_authorization attribute
(#13717 )
azurerm_app_service - support for the key_vault_reference_identity_id property
(#13720 )
azurerm_lb - support for the sku_tier property (#13680 )
azurerm_eventgrid_event_subscription - support the delivery_property block
(#13595 )
azurerm_mssql_server - support for the user_assigned_identity_ids and
(#13710 )
azurerm_kusto_attached_database_configuration - support for the sharing
property (#13487 )
BUG FIXES:
properties (#13689 )
azurerm_management_group - will not nil check child management groups when
updates (#13726 )
azurerm_app_configuration_key - can now mix labeled and unlabeled keys
(#13736 )
property (#13488 )
azurerm_managed_disk - support for the logical_sector_size property (#13637 )
azurerm_service_fabric_cluster - support for the
properties (#13399 )
azurerm_stream_analytics_output_eventhub - support for the partition_key
property (#13562 )
azurerm_linux_virtual_machine_scale_set - correctly update the overprovision
property (#13653 )
BUG FIXES:
(#13580 )
azurerm_managed_application - fixed typecasting bug (#13641 )
IMPROVEMENTS:
(#13549 )
azurerm_consumption_budget_subscription support for the Forecasted threshold
type (#13567 )
azurerm_consumption_budget_resource_group support for the Forecasted`
(#13478 )
azurerm_virtual_hub_connection - optimized state change refresh function
(#13548 )
BUG FIXES:
(#13517 )
azurerm_kubernetes_cluster - explicitly setting upgrade_channel to None when it's
FEATURES:
ENHANCEMENTS:
(#13310 )
azurerm_bot_channel_slack - support for the signing_secret property (#13454 )
azurerm_data_factory - support for identity being SystemAssiged and
UserAssigned (#13473 )
azurerm_function_app - support for the vnet_route_all_enabled property
(#13310 )
azurerm_machine_learning_workspace - support for public_network_access_enabled ,
(#13269 )
azurerm_synapse_workspace - the tenant_id property is now computed (#13464 )
BUG FIXES:
ENHANCEMENTS:
(#13390 )
azurerm_logic_app_workflow - support for the enabled and access_control
properties (#13265 )
azurerm_monitor_scheduled_query_rules_alert - support auto_mitigation_enabled
property (#13213 )
azurerm_machine_learning_inference_cluster - support for the identity block
(#12833 )
azurerm_machine_learning_compute_cluster - support for the
blocks (#12833 )
azurerm_spring_cloud_service - support for the connection_string property
(#13262 )
BUG FIXES:
(#13349 )
azurerm_kubernetes_cluster_node_pool - os_sku is now computed (#13321 )
azurerm_linux_virtual_machine_scale_set - fixed crash when automatic_os_policy
Opt-In Beta: Version 2.76 of the Azure Provider introduces an opt-in Beta for some
of the new functionality coming in 3.0 - more information can be found in the 3.0
Notes and 3.0 Upgrade Guide (#12132 )
FEATURES:
ENHANCEMENTS:
property (#13237 )
azurerm_data_factory_integration_runtime_azure - support for the
cleanup_enabled and subnet_id properties (#13222 )
azurerm_data_factory_trigger_schedule - support for the schedule and
description properties (#13243 )
azurerm_firewall_policy_rule_collection_group - support for the description ,
properties (#13190 )
azurerm_eventgrid_event_subscription - support for the delivery_identity and
dead_letter_identity blocks (#12945 )
azurerm_eventgrid_system_topic_event_subscription - support for the
(#13277 )
azurerm_stream_analytics_output_blob - support for the Parquet type and the
BUG FIXES:
(#13203 )
azurerm_app_configuration_key - fix KV import with no label (#13253 )
azurerm_synapse_sql_pool - properly support UTF-8 characters for the name
property (#13289 )
ENHANCEMENTS:
property (#13174 )
azurerm_data_factory_linked_service_azure_blob_storage - support for the
(#12866 )
azurerm_hdinsight_hbase_cluster - support for the security_profile block
(#12866 )
azurerm_hdinsight_interactive_query_cluster - support for the security_profile
block (#12866 )
azurerm_hdinsight_kafka_cluster - support for the security_profile block
(#12866 )
azurerm_hdinsight_spark_cluster - support for the security_profile block
(#12866 )
azurerm_mssql_server - refactoring to use an ID Formatter/Parser (#13151 )
azurerm_policy_virtual_machine_configuration_assignment - support for the
properties (#12997 )
Data Source: azurerm_servicebus_queue_authorization_rule - support for the
primary_connection_string_alias and secondary_connection_string_alias
properties (#12997 )
Data Source: azurerm_network_service_tags - new properties ipv4_cidrs and
ipv6_cidrs (#13058 )
azurerm_api_management - now exports certificate expiry , thumbprint and subject
attributes (#12262 )
azurerm_app_configuration - support for user assigned identities (#13080 )
azurerm_app_service - add support for vnet_route_all_enabled property
(#13073 )
azurerm_app_service_plan - support for the zone_redundant property (#13145 )
azurerm_data_factory_dataset_binary - support for dynamic_path_enabled and
dynamic_path_enabled properties (#13117 )
azurerm_data_factory_dataset_delimited_text - support for dynamic_path_enabled
(#12313 )
azurerm_monitor_autoscale_setting - support for the field
(#13084 )
azurerm_storage_account - add support for shared_key_access_enabled property
(#13014 )
azurerm_servicebus_namespace_authorization_rule - support for the
properties (#12997 )
azurerm_dev_test_global_vm_shutdown_schedule - support for the mail property
(#13074 )
BUG FIXES:
ENHANCEMENTS:
(#13011 )
azurerm_app_service_environment_v3 - updated for GA changes, including support
(#13028 )
azurerm_data_lake_store - support for the identity block (#13050 )
azurerm_kubernetes_cluster - support for the ultra_ssd_enabled and
property (#12780 )
azurerm_logic_app_trigger_http_request - support for the callback_url attribute
(#13057 )
azurerm_netapp_volume - support for the snapshot_directory_visible property
(#12961 )
azurerm_sql_server - support for configuring threat_detection_policy (#13048 )
azurerm_stream_analytics_output_eventhub - support for the property_columns
property (#12947 )
BUG FIXES:
end in a - (#12984 )
azurerm_databricks_workspace - corrent logic for the
public_network_access_enabled property (#13034 )
azurerm_databricks_workspace - fix potential crash in Read (#13025 )
azurerm_private_dns_zone_id - correctly handle inconsistant case (#13000 )
azurerm_private_dns_a_record_resource - currently validate the name property by
allowing @ s (#13042 )
azurerm_eventhub_namespace - support upto 40 for the maximum_throughput_units
property (#13065 )
azurerm_kubernetes_cluster - fix crash in update when previously configured
(#13010 )
azurerm_servicebus_topic - correctyl validate the name property (#13026 )
azurerm_virtual_hub_connection - will not correctly lock it's cirtual network during
updates (#12999 )
azurerm_linux_virtual_machine_scale_set - fix potential crash in updates to the
which (when enabled) means that Terraform will check for Resources nested within
the Resource Group during the deletion of the Resource Group and require that
these Resources are deleted first. This avoids the unintentional deletion of
unmanaged Resources within a Resource Group - and is defaulted off in 2.x
versions of the Azure Provider but will be enabled by default in version 3.0 of the
Azure Provider, see the features block documentation for more information.
(#12657 )
FEATURES:
ENHANCEMENTS:
(#12938 )
azurerm_application_insights_smart_detection_rule - support all currenly availible
BUG FIXES:
deletion (#12879 )
azurerm_cdn_profile - removing an unnecessary check during deletion (#12879 )
azurerm_container_registry_scope_map - removing an unnecessary check during
deletion (#12879 )
azurerm_container_registry_token - removing an unnecessary check during
deletion (#12879 )
azurerm_container_registry_webhook - removing an unnecessary check during
deletion (#12879 )
azurerm_container_registry - removing an unnecessary check during deletion
(#12879 )
azurerm_data_factory_dataset_delimited_text - correctly send optional optional
(#12879 )
azurerm_data_protection_backup_instance_disk - removing an unnecessary check
deletion (#12879 )
azurerm_dns_zone - removing an unnecessary check during deletion (#12879 )
azurerm_eventgrid_domain_topic - removing an unnecessary check during deletion
(#12879 )
azurerm_eventgrid_domain - removing an unnecessary check during deletion
(#12879 )
azurerm_eventgrid_event_subscription - removing an unnecessary check during
deletion (#12879 )
azurerm_eventgrid_system_topic_event_subscription - removing an unnecessary
(#12879 )
azurerm_eventgrid_topic - removing an unnecessary check during deletion
(#12879 )
azurerm_express_route_circuit_authorization - removing an unnecessary check
deletion (#12879 )
azurerm_express_route_gateway - removing an unnecessary check during deletion
(#12879 )
azurerm_express_route_port - removing an unnecessary check during deletion
(#12879 )
azurerm_frontdoor_firewall_policy - removing an unnecessary check during
deletion (#12879 )
azurerm_hpc_cache_blob_nfs_target - removing an unnecessary check during
deletion (#12879 )
azurerm_iothub - removing an unnecessary check during deletion (#12879 )
azurerm_key_vault_managed_hardware_security_module - removing an unnecessary
(#12881 )
azurerm_iot_dps - fixing a crash during creation (#12919 )
azurerm_local_network_gateway - removing an unnecessary check during deletion
(#12879 )
azurerm_logic_app_trigger_recurrence - update time zone strings to match API
behaviour, and use the timezone even when start_time is not specified
(#12453 )
azurerm_mariadb_database - removing an unnecessary check during deletion
(#12879 )
azurerm_mariadb_server - removing an unnecessary check during deletion
(#12879 )
azurerm_mariadb_virtual_network_rule - removing an unnecessary check during
deletion (#12879 )
azurerm_mssql_database - removing an unnecessary check during deletion
(#12879 )
azurerm_mssql_virtual_network_rule - removing an unnecessary check during
deletion (#12879 )
azurerm_mysql_server - removing an unnecessary check during deletion
(#12879 )
azurerm_nat_gateway - removing an unnecessary check during deletion (#12879 )
azurerm_network_packet_capture - removing an unnecessary check during deletion
(#12879 )
azurerm_packet_capture - removing an unnecessary check during deletion
(#12879 )
azurerm_postgresql_configuration - removing an unnecessary check during
deletion (#12879 )
azurerm_postgresql_firewall_rule - removing an unnecessary check during
deletion (#12879 )
azurerm_postgresql_server - removing an unnecessary check during deletion
(#12879 )
azurerm_postgresql_virtual_network_rule - removing an unnecessary check
(#12879 )
azurerm_private_link_service - removing an unnecessary check during deletion
(#12879 )
azurerm_shared_image_gallery - removing an unnecessary check during deletion
(#12879 )
azurerm_sql_virtual_network_rule - removing an unnecessary check during
deletion (#12879 )
azurerm_virtual_machine_scale_set_extension - removing an unnecessary check
(#12879 )
azurerm_web_application_firewall_policy - removing an unnecessary check
ENHANCEMENTS:
property (#12782 )
azurerm_app_service - support for the acr_use_managed_identity_credentials and
(#12788 )
azurerm_application_insights - support for the workspace_id property (#12818 )
azurerm_databricks_workspace - support for private link endpoint (#12543 )
azurerm_databricks_workspace - add support for Customer Managed Keys for
(#12386 )
azurerm_kubernetes_cluster - support for the maintenance_window block
(#12762 )
azurerm_kubernetes_cluster - the field automatic_channel_upgrade can now be set
to node-image (#12667 )
azurerm_logic_app_workflow - support for the workflow_parameters (#12314 )
azurerm_mssql_database - support for the Free and FSV2 SKU's (#12835 )
azurerm_network_security_group - the protocol property now supports Ah and
Esp values (#12865 )
azurerm_public_ip_resource - support for sku_tier property (#12775 )
azurerm_redis_cache - support for the replicas_per_primary , redis_version , and
BUG FIXES:
(#12808 )
azurerm_kubernetes_cluster - corrently valudate the
net_ipv4_ip_local_port_range_max property (#12859 )
azurerm_local_network_gateway - fixing a crash where the
LocalNetworkAddressSpace block was nil (#12822 )
azurerm_notification_hub_authorization_rule - switching to use an ID Formatter
(#12845 )
azurerm_notification_hub - switching to use an ID Formatter (#12845 )
azurerm_notification_hub_namespace - switching to use an ID Formatter
(#12845 )
azurerm_postgresql_database - fixing a crash in the Azure SDK (#12823 )
azurerm_private_dns_zone - fixing a crash during deletion (#12824 )
azurerm_resource_group_template_deployment - fixing deletion of nested items
ENHANCEMENTS:
operation_name_format (#12736 )
azurerm_automation_certificate - the exportable property can now be set
(#12738 )
azurerm_data_factory_dataset_binary - the blob path and filename propeties are
now optional (#12676 )
azurerm_data_factory_trigger_blob_event - support for the activation property
(#12644 )
azurerm_data_factory_pipeline - support for the concurrency and
moniter_metrics_after_duration properties (#12685 )
azurerm_hdinsight_interactive_query_cluster - support for the
property (#12767 )
azurerm_firewall_polcy - support for property private_ip_ranges (#12696 )
BUG FIXES:
(#12761 )
2.69.0 (July 23, 2021)
FEATURES:
ENHANCEMENTS:
tier (#12695 )
azurerm_kubernetes_cluster - support for downgrading sku_tier from Paid to
(#12587 )
BUG FIXES:
data.azurerm_redis_cache - fix a bug that caused the data source to raise an error
(#12666 )
azurerm_application_gateway - return an error when ssl policy is not properly
configured (#12647 )
azurerm_data_factory_linked_custom_service - fix a bug causing
additional_properties to be read incorrectly into state (#12664 )
azurerm_eventhub_authorization_rule - fixing the error "empty non-retryable error
received" (#12642 )
azurerm_machine_learning_compute_cluster - fix a crash when creating a cluster
ENHANCEMENTS:
(#12309 )
azurerm_api_management_api_diagnostic - support for the data_masking 1 property
(#12419 )
azurerm_cognitive_account - support for the identity , storage ,
(#12343 )
azurerm_linux_virtual_machine_scale_set - Fix un-necessary VMSS instance rolling
request (#12590 )
azurerm_maintenance_configuration - support for the window , visibility , and
BUG FIXES:
(#12288 )
machine_learning_compute_cluster - make the subnet_resource_id property
databases (#12555 )
azurerm_subnet_network_security_group_association - prevent potential deadlocks
ENHANCEMENTS:
storage_account_identity (#12331 )
azurerm_security_center_assessment_policy - support for the categories propety
(#12383 )
BUG FIXES:
(#12479 )
azurerm_storage_management_policy - fix crash in read of properties (#12487 )
azurerm_storage_share_directory now allows underscore in property name
[#12454 ]
azurerm_security_center_subscription_pricing - removed Owner permission note
DEPRECATIONS:
ENHANCEMENTS:
(#12402 )
azurerm_api_management_api - support for the revision_description ,
(#12401 )
azurerm_eventgrid_event_subscription - support for additional advanced filters
string_not_begins_with , string_not_ends_with , string_not_contains ,
(#12167 )
azurerm_eventgrid_system_topic_event_subscription - support for additional
minimum_required_child_endpoints_ipv4 and
minimum_required_child_endpoints_ipv6 (#12400 )
BUG FIXES:
ENHANCEMENTS:
property (#12278 )
azurerm_windows_virtual_machine - updating proximity_placement_group_id will no
BUG FIXES:
azurerm_data_factory - fix a bug where the name property was stored with the
ENHANCEMENTS:
definitions (#12039 )
azurerm_application_gateway - correctly poopulat the identity block (#12226 )
azurerm_container_registry - support for the zone_redundancy_enabled field
(#11706 )
azurerm_cosmosdb_sql_container - support for the spatial_index block (#11625 )
azurerm_cosmos_gremlin_graph - support for the spatial_index property
(#12176 )
azurerm_data_factory - support for global_parameter (#12178 )
azurerm_kubernetes_cluster - support for the kubelet_config and
(#12181 )
azurerm_private_link_service - changing
resource (#12250 )
azurerm_stream_analytics_job - supports for the identity block (#12171 )
azurerm_storage_account - support for the share_properties block (#12103 )
azurerm_synapse_workspace - support for the
BUG FIXES:
ENHANCEMENTS:
identity (#12049 )
azurerm_kubernetes_cluster -support for BYO kubelet_identity (#12037 )
azurerm_kusto_cluster_customer_managed_key - supports for the user_identity
property (#12135 )
azurerm_network_watcher_flow_log - support for the location and tags properties
(#11670 )
azurerm_storage_account - support for user assigned identities (#11752 )
azurerm_storage_account_customer_managed_key - support the use of keys from key
property (#12160 )
azurerm_vpn_server_configuration - now supports multiple auth blocks
(#12085 )
BUG FIXES:
Service: App Configuration - Fixed a bug in tags on resources all being set to the
same value (#12062 )
Service: Event Hubs - Fixed a bug in tags on resources all being set to the same
value (#12062 )
azurerm_subscription - fix ability to specify DevTest as workload (#12066 )
azurerm_sentinel_alert_rule_scheduled - the query frequency duration can noe be
up to 14 days (#12164 )
2.62.1 (June 08, 2021)
BUG FIXES:
(#12076 )
ENHANCEMENTS:
(#12025 )
azurerm_container_registry - support for versionless encryption keys for ACR
(#11856 )
azurerm_kubernetes_cluster - support for gateway_name for Application Gateway
add-on (#11984 )
azurerm_kubernetes_cluster - support update of azure_rbac_enabled (#12029 )
azurerm_kubernetes_cluster - support for node_public_ip_prefix_id (#11635 )
azurerm_kubernetes_cluster_node_pool - support for node_public_ip_prefix_id
(#11635 )
azurerm_machine_learning_inference_cluster - support for the
property (#11848 )
BUG FIXES:
ENHANCEMENTS:
properties (#11825 )
azurerm_spatial_anchors_account - support for account_domain and account_id
(#11824 )
azurerm_static_site - Add support for tags attribute (#11849 )
azurerm_storage_account - private_link_access supports more values (#11957 )
azurerm_storage_account_network_rules : private_link_access supports more
values (#11957 )
azurerm_synapse_spark_pool - spark_version now supports 3.0 (#11972 )
BUG FIXES:
(#11852 )
azurerm_linux_virtual_machine_scale_set : changing the
ENHANCEMENTS:
property (#11735 )
azurerm_cosmosdb_cassandra_table - support for the analytical_storage_ttl
property (#11755 )
azurerm_healthcare_service - support for the public_network_access_enabled
property (#11736 )
azurerm_hdinsight_kafka_cluster - support for the encryption_in_transit_enabled
property (#11737 )
azurerm_media_services_account - support for the key_delivery_access_control
block (#11726 )
azurerm_monitor_activity_log_alert - support for Security event type for Azure
block (#11633 )
azurerm_storage_account_management_policy - the name property can now contain
- (#11792 )
BUG FIXES:
(#11425 )
azurerm_virtual_network_gateway_connection - fix a bug where shared_key was
(#11425 )
azurerm_windows_virtual_machine_scale_set - changing the license_type will no
ENHANCEMENTS:
(#11653 )
azurerm_cosmosdb_account - support for the backup property (#11597 )
azurerm_cosmosdb_sql_container - support for the analytical_storage_ttl
property (#11655 )
azurerm_container_registry - support for the identity and encryption blocks
(#11661 )
azurerm_frontdoor_custom_https_configuration - Add support for resource import.
(#11642 )
azurerm_kubernetes_cluster - export the ingress_application_gateway_identity
(#11485 )
azurerm_storage_account - support for the private_link_access property
(#11629 )
azurerm_storage_account - support for the change_feed_enabled property
(#11695 )
BUG FIXES
(#11607 )
azurerm_mssql_database - wil now correctly import the
creation_source_database_id property for Secondary databases (#11703 )
azurerm_storage_account - allow empty/blank values for the allowed_headers and
FEATURES:
ENHANCEMENTS:
(#10502 )
azurerm_data_factory_pipeline - support for the folder property (#11575 )
azurerm_frontdoor - Fix for Frontdoor resource elements being returned out of
order. (#11456 )
azurerm_hdinsight_*_cluster - support for autoscale #8104 (#11547 )
azurerm_network_security_rule - support for the protocols Ah and Esp (#11581 )
azurerm_network_connection_monitor - support for the coverage_level ,
MongoDB defaults new MongoDB accounts to v3.6 rather then v3.2 (#10926 )
azurerm_cosmosdb_mongo_collection - the _id index is now required by the new
FEATURES:
(#10669 )
New Resource: azurerm_virtual_machine_configuration_policy_assignment
(#11334 )
New Resource: azurerm_vmware_cluster (#10848 )
ENHANCEMENTS:
block (#11517 )
azurerm_container_group - support for the exposed_port block (#10491 )
azurerm_container_registry - deprecating the georeplication_locations property
(#11378 )
azurerm_databricks_workspace - switching to using an ID Formatter (#11378 )
azurerm_databricks_workspace - fixes propagation of tags to connected resources
(#11405 )
azurerm_data_factory_linked_service_azure_file_storage - support for the
property (#11428 )
azurerm_frontdoor - sync MaxItems on various attributes to match azure docs
(#11421 )
azurerm_frontdoor_custom_https_configuration - removing secret version
validation when using azure key vault as the certificate source (#11310 )
azurerm_function_app - support for the site_config.ip_restrictions.headers and
endpoint (#11300 )
azurerm_hdinsight_hadoop_cluster - add support for private link endpoint
(#11300 )
azurerm_hdinsight_spark_cluster - add support for private link endpoint
(#11300 )
azurerm_healthcare_service - support for the
(#11376 )
azurerm_kubernetes_cluster - support for the azure_rbac_enabled property
(#10441 )
azurerm_hpc_cache - support for the directory_active_directory ,
directory_flat_file , and directory_ldap blocks (#11332 )
azurerm_key_vault_certificate - support additional values for the key_size
property (#11321 )
azurerm_kubernetes_cluster - support for the max_node_provisioning_time ,
property (#11269 )
azurerm_managed_application - support for the parameter_values property
(#8632 )
azurerm_managed_disk - support for the network_access_policy and
property (#11328 )
BUG FIXES:
(#11352 )
azurerm_iothub - change filter_rule from TypeSet to TypeList to resolve an
block (#11383 )
azurerm_mssql_database - return an error when secondary database uses
max_size_gb (#11401 )
azurerm_mssql_database - correctly import the create_mode property (#11026 )
azurerm_netap_volume - correctly set the replication_frequency attribute in the
data_protection_replication block (#11530 )
azurerm_postgresql_server - ensure public_network_access_enabled is correctly
ENHANCEMENTS:
(#11170 )
azurerm_application_gateway - support for configuring firewall_policy_id within
(#11170 )
azurerm_data_factory_linked_service_sql_database - support managed identity
and service principal auth and add the keyvault_password property (#10735 )
azurerm_hpc_cache - support for tags (#11268 )
azurerm_linux_virtual_machine_scale_set - Support health extension for rolling
BUG FIXES:
ENHANCEMENTS:
(#11186 )
azurerm_hpc_cache_nfs_target - usage_model can now be set to
block (#11105 )
azurerm_private_endpoint - allows for an alias to specified (#10779 )
azurerm_user_assigned_identity - exporting tenant_id (#11253 )
azurerm_web_application_firewall_policy - version within the managed_rule_set
BUG FIXES:
ENHANCEMENTS:
(#10950 )
azurerm_cognitive_account - Add support for network_acls (#11164 )
azurerm_container_registry - support for the quarantine_policy_enabled property
(#11011 )
azurerm_firewall - support for the private_ip_ranges property [p#10627 ]
azurerm_log_analytics_workspace - Fix issue where -1 couldn't be specified for
daily_quota_gb (#11182 )
azurerm_spring_cloud_service - supports for the sample_rate property (#11106 )
azurerm_storage_account - support for the container_delete_retention_policy
property (#11131 )
azurerm_virtual_desktop_host_pool - support for the custom_rdp_properties
property (#11160 )
azurerm_web_application_firewall_policy - support for the http_listener_ids
BUG FIXES:
(#11139 )
azurerm_data_factory_linked_service_azure_blob_storage - correct managed
subscriptions (#11065 )
azurerm_site_recovery_fabric - Fixes error in checking for existing resource
(#11130 )
azurerm_spring_cloud_custom_domain - thumbprint is required when specifying
certificate_name (#11145 )
azurerm_subscription - fixes broken timeout on destroy (#11124 )
ENHANCEMENTS:
property (#10969 )
azurerm_kusto_eventhub_data_connection - support for the
BUG FIXES:
(#11046 )
azurerm_resource_group_template_deployment - always sending parameters_content
ENHANCEMENTS:
[#10638 }
BUG FIXES:
(#10942 )
azurerm_eventhub_namespace_disaster_recovery_config - deprecating the
(#10983 )
azurerm_management_group - validation for subscription_id list property entries
(#10948 )
2.51.0 (March 12, 2021)
FEATURES:
ENHANCEMENTS:
(#10774 )
azurerm_kubernetes_cluster - support for expander in the auto_scaler_profile
block (#10777 )
azurerm_linux_virtual_machine - support for configuring platform_fault_domain
(#10803 )
azurerm_linux_virtual_machine_scale_set - will no longer recreate the resource
(#10803 )
azurerm_windows_virtual_machine_scale_set - will no longer recreate the resource
BUG FIXES:
Data Source: azurerm_function_app_host_keys - retrying reading the keys to work
around a broken API (#10894 )
Data Source: azurerm_log_analytics_workspace - ensure the id is returned with
the correct casing (#10892 )
Data Source: azurerm_monitor_action_group - add support for aad_auth attribute
(#10876 )
azurerm_api_management_custom_domain - prevent a perpetual diff (#10636 )
azurerm_eventhub_consumer_group - detecting as removed when deleted in Azure
(#10900 )
azurerm_key_vault_access_policy - Fix destroy where permissions casing on
(#10920 )
azurerm_kusto_eventhub_data_connection - make table_name and data_format
optional (#10913 )
azurerm_mssql_virtual_machine - workaround for inconsistent API value for
log_backup_frequency_in_minutes in the manual_schedule block (#10899 )
azurerm_postgres_server - support for replicaset scaling (#10754 )
azurerm_postgresql_aad_administrator - prevent invalid usernames for the login
property (#10757 )
ENHANCEMENTS:
(#10823 )
azurerm_keyvault_secret - support for the versionless_id property (#10738 )
azurerm_kubernetes_cluster - support private_dns_zone_id when using a
service_principal (#10737 )
azurerm_kusto_cluster - supports for the double_encryption_enabled property
(#10264 )
azurerm_linux_virtual_machine - support for configuring license_type (#10776 )
azurerm_log_analytics_workspace_resource - support permanent deletion of
block (#10509 )
azurerm_mssql_database - support for the log_monitoring_enabled property within
BUG FIXES:
(#10828 )
azurerm_kubernetes_cluster_resource - allow windows passwords as short as 8
(#10795 )
azurerm_virtual_machine - parsing the User Assigned Identity ID case-insensitively
ENHANCEMENTS:
(#10652 )
azurerm_data_factory_linked_service_azure_blob_storage - now supports the
(#10646 )
azurerm_netapp_volume - support for the data_protection_replication block
(#10610 )
azurerm_sentinel_alert_rule_ms_security_incident - support Microsoft Defender
Advanced Threat Protection and Office 365 Advanced Threat Protection values
for the product_filter property (#10725 )
azurerm_service_fabric_cluster - Add support for the upgrade policy block
(#10713 )
BUG FIXES:
(#10734 )
azurerm_key_vault_certificate - waiting for deletion to complete before purging
(#10577 )
azurerm_key_vault_key - now waits for deletion to complete before purging
(#10577 )
azurerm_key_vault_secret - now waits for deletion to complete before purging
(#10577 )
azurerm_kusto_cluster - changing the virtual_network_configuration property
ENHANCEMENTS:
(#10376 )
azurerm_kubernetes_cluster - support for automatic_channel_upgrade (#10530 )
azurerm_kubernetes_cluster - support for skip_nodes_with_local_storage within
property (#10613 )
azurerm_log_analytics_workspace - Support for capacity_reservation_level
(#10570 )
azurerm_point_to_site_vpn_gateway - support for enhanced import validation
(#10570 )
azurerm_route - updating to use a Resource ID Formatter (#10570 )
azurerm_route - support for enhanced import validation (#10570 )
azurerm_subnet - updating to use a Resource ID Formatter (#10570 )
azurerm_subnet - support for enhanced import validation (#10570 )
synapse_workspace_resource - support for the azure_devops_repo and github_repo
blocks (#10157 )
azurerm_virtual_network - updating to use a Resource ID Formatter (#10570 )
azurerm_virtual_network - support for enhanced import validation (#10570 )
BUG FIXES:
on update (#10606 )
azurerm_private_endpoint - only updating the associated Private DNS Zone Group
routing_rule from a List to a Set to work around an ordering issue within the
Azure API - as such you should update your Terraform Configuration to reference
these new Maps, rather than the Lists directly, due to the upcoming breaking
change. For example, changing
azurerm_frontdoor.example.frontend_endpoint[1].id to
azurerm_frontdoor.example.frontend_endpoints["exampleFrontendEndpoint2"]
(#9357 )
azurerm_lb_backend_address_pool - the field backend_addresses has been
(#10488 )
azurerm_linux_virtual_machine_scale_set &
renamed/deprecated in favour of
azurerm_data_factory_integration_runtime_azure_ssis (#10236 )
The provider-block field skip_credentials_validation is now deprecated since this
was non-functional and will be removed in 3.0 of the Azure Provider (#10464 )
FEATURES:
ENHANCEMENTS:
only_critical_addons_enabled (#10307 )
azurerm_kubernetes_cluster - support for configuring private_dns_zone_id
(#10201 )
azurerm_linux_virtual_machine_scale_set - the extension block is now GA and
BUG FIXES:
(#10420 )
azurerm_cosmosdb_account - will no longer panic if the response is nil (#10525 )
azurerm_eventhub_namespace - correctly downgrade to the Basic sku (#10536 )
azurerm_key_vault_key - export the versionless_id attribute (#10420 )
azurerm_lb_backend_address_pool - the backend_addresses block is now
deprecated and non-functional - use the
azurerm_lb_backend_address_pool_address resource instead (#10488 )
azurerm_linux_virtual_machine_scale_set - fixing a bug when protected_settings
(#10481 )
ENHANCEMENTS:
properties (#10325 )
azurerm_api_management_diagnostic - support for the frontend_request ,
(#10398 )
azurerm_lb_backend_address_pool - support for the backend_address block
(#10291 )
azurerm_redis_cache - support for the public_network_access_enabled property
(#10410 )
azurerm_role_assignment - adding validation for that the scope is either a
(#10422 )
BUG FIXES:
(#10447 )
azurerm_key_vault_key - fixing a race condition when setting the cache (#10447 )
azurerm_key_vault_secret - fixing a race condition when setting the cache
(#10447 )
azurerm_mssql_virtual_machine - fixing a crash where the KeyVault was nil in the
IMPROVEMENTS:
dependencies: updating to v0.11.17 of github.com/Azure/go-autorest/autorest
(#10259 )
dependencies: updating the firewall resources to use the Networking API 2020-
07-01 (#10252 )
dependencies: updating the load balancer resources to use the Networking API
version 2020-05-01 (#10263 )
Data Source: azurerm_app_service_environment - export the cluster_setting block
(#10303 )
Data Source: azurerm_key_vault_certificate - support for the
certificate_data_base64 attribute (#10275 )
azurerm_app_service - support for the propety number_of_workers (#10143 )
azurerm_app_service_environment - support for the cluster_setting block
(#10303 )
azurerm_data_factory_dataset_delimited_text - support for the compression_codec
property (#10182 )
azurerm_firewall_policy - support for the sku property (#10186 )
azurerm_iothub - support for the enrichment property (#9239 )
azurerm_key_vault - optimised loading of and added caching when retrieving the
attribute (#10275 )
azurerm_linux_virtual_machine - skipping shutdown for a machine in a failed state
(#10189 )
azurerm_media_services_account - support for setting the
SKU (#10337 )
azurerm_windows_virtual_machine - skipping shutdown for a machine in a failed
state (#10189 )
azurerm_linux_virtual_machine_scale_set - support for the
extensions_time_budget property (#10298 )
azurerm_windows_virtual_machine_scale_set - support for the
BUG FIXES:
specified (#8624 )
azurerm_windows_virtual_machine_scale_set - fixing an issue where
IMPROVEMENTS:
(#9276 )
azurerm_api_management_api_diagnostic - support the sampling_percentage
property (#9321 )
azurerm_container_group - support for updating tags (#10210 )
azurerm_kubernetes_cluster - the field type within the identity block can now be
(#9795 )
azurerm_sentinel_alert_rule_scheduled - now supports the
event_grouping_setting property (#10078 )
BUG FIXES:
change (#9015 )
azurerm_key_vault_certificate - fixing a crash when subject within the
certificate_policy block was nil (#10200 )
azurerm_user_assigned_identity - adding a state migration to update the ID
format (#10196 )
IMPROVEMENTS:
(#10055 )
azurerm_cosmosdb_gremlin_graph - support the default_ttl property (#10159 )
azurerm_data_factory - support for public_network_enabled (#9605 )
azurerm_data_factory_dataset_delimited_text - support for the compression_type
property (#10070 )
azurerm_data_factory_linked_service_sql_server : support for the
property (#10169 )
azurerm_function_app - adding validation on the identity_ids field within the
property (#10033 )
azurerm_virtual_machine - adding validation on the identity_ids field within the
identity block (#10105 )
azurerm_virtual_machine_scale_set - adding validation on the identity_ids field
BUG FIXES:
(#10190 )
azurerm_api_management - ensuring the casing of the identity_ids field within the
identity block (#10105 )
azurerm_app_service - ensuring the casing of the identity_ids field within the
identity block (#10105 )
azurerm_app_service_slot - ensuring the casing of the identity_ids field within
delete (#10170 )
azurerm_virtual_machine - ensuring the casing of the identity_ids field within the
match the breaking change in the Azure API where Key Vaults now have Soft
Delete enabled by default, which cannot be disabled. This property is now non-
functional, defaults to true and will be removed in version 3.0 of the Azure
Provider. (#10088 )
azurerm_key_vault - the field soft_delete_retention_days is now defaulted to 90
days to match the Azure API behaviour, as the Azure API does not return a value
for this field when not explicitly configured, so defaulting this removes a diff with
0 . (#10088 )
FEATURES:
IMPROVEMENTS:
(#9609 )
azurerm_app_service_slot - now supports detailed_error_mesage_enabled and
(#6868 )
azurerm_cdn_endpoint - only send content_types_to_compress and geo_filter to
no longer be provisioned, this will be removed in version 3.0 of the Azure Provider
(#10049 )
azurerm_function_app - make pre_warmed_instance_count computed to use azure's
default (#9069 )
azurerm_function_app - now supports service_tag in ip_restriction blocks
(#9609 )
azurerm_hdinsight_hadoop_cluster - allow the value Standard_D4a_V4 for the
vm_type property (#10000 )
azurerm_hdinsight_kafka_cluster - support for the rest_proxy and
match the Azure API behaviour where Soft Delete is force-enabled and can no
longer be disabled. This field is deprecated, can be safely removed from your
Terraform Configuration, and will be removed in version 3.0 of the Azure Provider.
(#10088 )
azurerm_kubernetes_cluster - add support for network_mode (#8828 )
azurerm_log_analytics_linked_service - add validation for resource ID type
(#9932 )
azurerm_log_analytics_linked_service - update validation to use generated
(#9914 )
azurerm_monitor_diagnostic_setting - validation that log_analytics_workspace_id
persistent_disk (#9957 )
azurerm_subscription - support for the tags property (#9047 )
azurerm_synapse_workspace - support for the managed_resource_group_name
property (#10017 )
azurerm_traffic_manager_profile - support for the traffic_view_enabled property
(#10005 )
BUG FIXES:
provider: will not correctly register the Microsoft.Blueprint and
Microsoft.HealthcareApis RPs (#10062 )
is WAF_v2 (#8753 )
azurerm_firewall_policy_rule_collection_group - correctly validate the
optional (#8850 )
azurerm_cosmosdb_account - always include key_vault_id in update requests for
(#9749 )
azurerm_key_vault - the field soft_delete_retention_days is now defaulted to 90
(#10035 )
31st, 2020 by force-enabling Soft Delete on all new and existing Key Vaults. To
workaround this, this release of the Azure Provider still allows you to configure Soft
Delete on before this date (but once this is enabled this cannot be disabled). Since
new Key Vaults will automatically be provisioned using Soft Delete in the future,
and existing Key Vaults will be upgraded - a future release will deprecate the
soft_delete_enabled field and default this to true early in 2021. (#9911 )
azurerm_key_vault_certificate - Terraform will now attempt to purge Certificates
during deletion due to the upcoming breaking change in the Azure API where Key
Vaults will have soft-delete force-enabled. This can be disabled by setting the
purge_soft_delete_on_destroy field within the features -> keyvault block to
false . (#9911 )
azurerm_key_vault_key - Terraform will now attempt to purge Keys during deletion
due to the upcoming breaking change in the Azure API where Key Vaults will have
soft-delete force-enabled. This can be disabled by setting the
purge_soft_delete_on_destroy field within the features -> keyvault block to
false . (#9911 )
azurerm_key_vault_secret - Terraform will now attempt to purge Secrets during
deletion due to the upcoming breaking change in the Azure API where Key Vaults
will have soft-delete force-enabled. This can be disabled by setting the
purge_soft_delete_on_destroy field within the features -> keyvault block to
false . (#9911 )
FEATURES:
IMPROVEMENTS:
(#9848 )
azurerm_key_vault_certificate - performing a "purge" of the Certificate during
deletion if the feature is opted-in within the features block, see the "Upgrade
Notes" for more information (#9911 )
azurerm_key_vault_key - performing a "purge" of the Key during deletion if the
feature is opted-in within the features block, see the "Upgrade Notes" for more
information (#9911 )
azurerm_key_vault_secret - performing a "purge" of the Secret during deletion if
the feature is opted-in within the features block, see the "Upgrade Notes" for
more information (#9911 )
azurerm_log_analytics_linked_service - Add new fields workspace_id ,
read_access_id , and write_access_id (#9410 )
azurerm_linux_virtual_machine - Normalise SSH keys to cover VM import cases
(#9897 )
azurerm_subnet - support for the service_endpoint_policy block (#8966 )
azurerm_traffic_manager_profile - support for new field max_return and support
subject_alternative_names block from the Certificate if not returned from the API
(#8631 )
azurerm_key_vault_certificate - polling until the Certificate is fully deleted during
deletion (#9911 )
azurerm_key_vault_key - polling until the Key is fully deleted during deletion
(#9911 )
azurerm_key_vault_secret - polling until the Secret is fully deleted during deletion
(#9911 )
azurerm_log_analytics_workspace - adding a state migration to correctly update
IMPROVEMENTS:
(#9690 )
azurerm_bot_channel_email - support for enhanced import validation (#9690 )
azurerm_bot_channel_ms_teams - support for enhanced import validation (#9690 )
azurerm_bot_channel_slack - support for enhanced import validation (#9690 )
azurerm_bot_channels_registration - support for enhanced import validation
(#9690 )
azurerm_bot_connection - support for enhanced import validation (#9690 )
azurerm_bot_web_app - support for enhanced import validation (#9690 )
azurerm_cosmosdb_sql_container - support for the partition_key_version property
(#9496 )
azurerm_kusto_cluster - support for the engine property (#9696 )
azurerm_kusto_eventhub_data_connection - support for compression (#9692 )
azurerm_iothub - support for the min_tls_version property (#9670 )
azurerm_recovery_services_vault - support for the identity block (#9689 )
azurerm_redis_cache - adding enhanced import validation (#9771 )
azurerm_redis_cache - adding validation that subnet_id is a valid Subnet ID
(#9771 )
azurerm_redis_firewall_rule - adding enhanced import validation (#9771 )
azurerm_redis_linked_server - adding enhanced import validation (#9771 )
azurerm_redis_linked_server - adding validation that linked_redis_cache_id is a
properties (#9676 )
azurerm_stream_analytics_reference_input_blob - support for enhanced import
validation (#9735 )
azurerm_stream_analytics_stream_input_blob - support for enhanced import
validation (#9735 )
azurerm_stream_analytics_stream_input_iothub - support for enhanced import
validation (#9735 )
azurerm_stream_analytics_stream_input_eventhub - support for enhanced import
validation (#9735 )
azurerm_storage_account - enable the allow_blob_public_access and
azurerm_storage_account properties in US Government Cloud (#9540 )
BUG FIXES:
attributes (#9739 )
azurerm_signar_service - having an empty allowed_origins in the cors block will
IMPROVEMENTS:
Dashboard (#9530 )
azurerm_keyvault_certificate - add 3072 to allowed values for key_size
(#9524 )
azurerm_media_services_account - support for the identity , tags , and
storage_authentication properties (#9457 )
azurerm_notification_hub_authorization_rule - adding validation at import time
(#9522 )
BUG FIXES:
(#9651 )
azurerm_eventhub_dedicated_cluster - the sku_name capacity can be greater then
1 (#9649 )
IMPROVEMENTS:
(#9446 )
azurerm_application_insights_web_test - validating the resource ID is correct
(#9378 )
azurerm_vpn_server_configuration - deprecate the radius_server block in favour
attribute (#9261 )
azurerm_virtual_network_gateway - support for the dpd_timeout_seconds and
BUG FIXES:
updates (#9485 )
azurerm_search_service - allowed_ips now supports specifying a CIDR Block in
addition to an IPv4 address (#9493 )
azurerm_virtual_desktop_application_group - adding a state migration to avoid a
state migration to avoid a breaking change when upgrading from v2.35.0 or later
(#9495 )
azurerm_windows_virtual_machine - no longer sets patch_mode on creation if it is
IMPROVEMENTS:
property (#9236 )
azurerm_cosmosdb_cassandra_keyspace - throughput can now be set to higher than
block can now be set to higher than 1000000 if enabled by Azure Support
(#9050 )
azurerm_cosmosdb_sql_database - throughput can now be set to higher than
virtual_hub (#8879 )
azurerm_kubernetes_cluster - support for configuring os_disk_type within the
default_node_pool block (#9166 )
azurerm_kubernetes_cluster - max_count within the default_node_pool block can
1000 (#9227 )
azurerm_kubernetes_node_pool - min_count can now be set to a maximum value of
1000 (#9227 )
azurerm_kubernetes_node_pool - node_count can now be set to a maximum value
of 1000 (#9227 )
azurerm_linux_virtual_machine - support for the extensions_time_budget property
(#9257 )
azurerm_linux_virtual_machine - updating the dedicated_host_id no longer forces
block) (#8470 )
azurerm_linux_virtual_machine_scale_set - support for the
properties (#9262 )
azurerm_mssql_database - sku_name supports more DWxxxc options (#9370 )
azurerm_policy_set_definition - support for the policy_definition_group block
(#9259 )
azurerm_postgresql_server - increase max storage to 16TiB (#9373 )
azurerm_private_dns_zone - support for the soa_record block (#9319 )
azurerm_storage_blob - support for content_md5 (#7786 )
azurerm_windows_virtual_machine - support for the extensions_time_budget
property (#9257 )
azurerm_windows_virtual_machine - updating the dedicated_host_id nolonger
properties (#9262 )
BUG FIXES:
(#9388 )
azurerm_resource_group_template_deployment - fixing an issue during deletion
FEATURES:
IMPROVEMENTS:
(#9281 )
azurerm_eventgrid_event_subscription - adding validation to the name field
(#9281 )
azurerm_eventgrid_topic - adding validation to the name field (#9281 )
azurerm_eventgrid_system_topic - adding validation to the name field (#9281 )
azurerm_function_app - support for the health_check_path property under
site_config (#9233 )
azurerm_linux_virtual_machine - support for managed boot diagnostics by leaving
(#9195 )
azurerm_policy_remediation - support for the resource_discovery_mode property
(#9210 )
azurerm_point_to_site_vpn_gateway - support for the route block (#9158 )
azurerm_virtual_network - support for the bgp_community and
vnet_protection_enabled (#8979 )
azurerm_vpn_gateway - support for the instance_0_bgp_peering_addresses and
instance_1_bgp_peering_addresses blocks (#9035 )
azurerm_windows_virtual_machine - support for managed boot diagnostics by
BUG FIXES:
now requires recreating the resource to match the behaviour of the Azure API
(#8814 )
azurerm_log_analytics_workspace - fix the Free tier from setting the
daily_quota_gb property (#9228 )
azurerm_linux_virtual_machine - the field disk_size_gb within the os_disk block
FEATURES:
IMPROVEMENTS:
BUG FIXES:
FEATURES:
IMPROVEMENTS:
instant_restore_retention_days (#8822 )
azurerm_container_group - support for the property git_repo within the volume
block (#7924 )
azurerm_iothub - support for the resource_group property within the endpoint
block (#8032 )
azurerm_key_vault - support for the contact block (#8937 )
azurerm_log_analytics_saved_search - support for tags (#9034 )
azurerm_log_analytics_solution - support for tags (#9048 )
azurerm_logic_app_trigger_recurrence - support for time_zone [#8829 ]
azurerm_policy_definition - can now look up builtin policy by name (#9078 )
BUG FIXES:
azurerm_automation_module - raising the full error from the Azure API during
creation (#8498 )
azurerm_api_management_api - fixing a regression introduced in v2.16 where the
(#8861 )
azurerm_local_network_gateway - support for the gateway_fqdn property (#8998 )
azurerm_key_vault - prevent unwanted diff due to inconsistent casing for the
(#8617 )
azurerm_private_endpoint - fix crash when deleting private endpoint (#9068 )
azurerm_signalr_service - switching the features block to a set so order is
irrelevant (#8815 )
azurerm_virtual_desktop_application_group - correctly validate the name property
(#9030 )
This release includes a workaround for a breaking change in Azure’s API related to
the Extended Auditing Policy of the SQL and MSSQL resources. The Service Team
have confirmed that this Regression will first roll out to all regions before the bug
fix is deployed - as such this workaround will be removed in a future release once
the fix for the Azure API has been rolled out to all regions.
FEATURES:
IMPROVEMENTS:
Addresses (#8948 )
azurerm_search_service - support for the identity block (#8907 )
azurerm_sql_firewall_rule - adding validation for the start_ip_address and
BUG FIXES:
API (#8975 )
azurerm_mssql_server_extended_auditing_policy - working around a breaking
API (#8975 )
azurerm_sql_server - working around a breaking change/regression in the Azure
API (#8975 )
azurerm_policy_set_definition - Fix updates for parameters and
parameter_values in policy_definition_reference blocks (#8882 )
IMPROVEMENTS:
blocks (#8698 )
azurerm_security_center_contact - override SDK creat function to handle 201
to Optional (#8811 )
BUG FIXES:
prevent existing storage shares from attempting to disable the default (#8807 )
FEATURES:
IMPROVEMENTS:
(#8699 )
azurerm_app_service - support for IPV6 addresses in the ip_restriction property
(#8599 )
azurerm_application_insights - support for the connection_string property
(#8699 )
azurerm_backup_policy_vm - validate daily backups is > 7 (#7898 )
azurerm_dedicated_host - add support for the DSv4-Type1 and sku_name properties
(#8718 )
azurerm_iothub - Support for the public_network_access_enabled property
(#8586 )
azurerm_key_vault_certificate_issuer - the org_id property is now optional
(#8687 )
azurerm_kubernetes_cluster_node_pool - the max_node , min_node , and node_count
(#8308 )
azurerm_mssql_database - support for long_term_retention_policy and
(#8623 )
azurerm_security_center_subscription_pricing - now supports per resource_type
pricing (#8549 )
azurerm_storage_account - support for the large_file_share_enabled property
(#8789 )
azurerm_storage_share - support for large quotas (up to 102400 GB) (#8666 )
BUG FIXES:
attribute (#8668 )
azurerm_policy_definition - mode property now enforces correct case (#8795 )
FEATURES:
IMPROVEMENTS:
(#8707 )
azurerm_cognitive_account - support for the S sku (#8639 )
azurerm_container_group - support for the dns_config block (#7912 )
azurerm_cosmosdb_account - support the zone_reduntant property (#8295 )
azurerm_cosmosdb_mongo_collection - will now respect the order of the keys
(#8078 )
azurerm_key_vault - add support for enable_rbac_authorization (#8670 )
azurerm_lighthouse_assignment - limit the scope property to subsriptions
(#8601 )
azurerm_logic_app_workflow - support for the integration_service_environment_id
property (#8504 )
azurerm_servicebus_topic - validate the max_size_in_megabytes property
(#8648 )
azurerm_servicebus_queue - validate the max_size_in_megabytes property
(#8648 )
azurerm_servicebus_subscription_rule - support the
(#8659 )
BUG FIXES:
azurerm_api_management - the value None has been removed from the identity
FEATURES:
IMPROVEMENTS:
property (#8533 )
azurerm_cosmosdb_sql_container - support for the indexing_policy property
(#8461 )
azurerm_mssql_server - support for the recover_database_id and
(#8568 )
azurerm_virtual_hub_connection - deprecating the field
vitual_network_to_hub_gateways_traffic_allowed since due to a breaking change
(#8542 )
BUG FIXES:
azurerm_api_management - the value None for the field type within the identity
block has been removed - to remove a managed identity remove the identity
block (#8411 )
azurerm_app_service - don't try to manage source_control when scm_type is
VSTSRM (#8531 )
azurerm_function_app - don't try to manage source_control when scm_type is
VSTSRM (#8531 )
azurerm_kubernetes_cluster - picking the first system node pool if the original
default_node_pool has been removed (#8503 )
FEATURES:
IMPROVEMENTS:
(#8370 )
azurerm_cosmosdb_cassandra_keyspace - support the autoscale_settings block
(#7773 )
azurerm_cosmosdb_gremlin_database - support the autoscale_settings block
(#7773 )
azurerm_cosmosdb_gremlin_graph - support the autoscale_settings block
(#7773 )
azurerm_cosmosdb_mongo_collection - support the autoscale_settings block
(#7773 )
azurerm_cosmosdb_mongo_database - support the autoscale_settings block
(#7773 )
azurerm_cosmosdb_sql_container - support the autoscale_settings block
(#7773 )
azurerm_cosmosdb_sql_database - support the autoscale_settings block (#7773 )
azurerm_cosmosdb_table - support the autoscale_settings block (#7773 )
azurerm_firewall - support the management_ip_configuration block (#8235 )
azurerm_storage_account_customer_managed_key - support for key rotation
(#7836 )
BUG FIXES:
(#8388 )
azurerm_kubernetes_cluster - ensure the OMS Agent Log Analytics Workspace
The id field for the azurerm_role_definition has changed in this release to work
around a bug in the Azure API when using management groups, where the Scope
isn't returned - the existing id field is available as role_definition_resource_id on
the new resource from version 2.28.0 of the Azure Provider.
FEATURES:
IMPROVEMENTS:
(#8322 )
azurerm_linux_virtual_machine_scale_set - Add support for
encryption_at_host_enabled (#8322 )
azurerm_servicebus_subscription - add support for
dead_lettering_on_filter_evaluation_error (#8412 )
azurerm_spring_cloud_app - support for the identity block (#8336 )
azurerm_storage_share_directory - Update name validation (#8366 )
azurerm_virtual_network_gateway - support for aad_audience , aad_issuer and
(#8322 )
azurerm_windows_virtual_machine_scale_set - Add support for
encryption_at_host_enabled (#8322 )
BUG FIXES:
resource (#8384 )
azurerm_role_definition - fixed delete operation when role is scoped to
Opt-In Beta: This release introduces an opt-in beta for in-line Virtual Machine
Scale Set Extensions. This functionality enables the resource to be used with Azure
Service Fabric and other extensions that may require creation time inclusion on
Scale Set members. Please see the documentation for
azurerm_linux_virtual_machine_scale_set and
azurerm_windows_virtual_machine_scale_set for information.
FEATURES:
IMPROVEMENTS:
(#7969 )
azurerm_application_gateway - Add support for probe.properties.port (#8278 )
azurerm_linux_virtual_machine_scale_set - Beta support for extension blocks
(#8222 )
azurerm_log_analytics_workspace - the sku value is now optional and defaults to
PerGB2018 (#8272 )
azurerm_windows_virtual_machine_scale_set - Beta support for extension blocks
(#8222 )
BUG FIXES:
(#8237 )
azurerm_cdn_profile - fixing the casing of the Resource ID to be consistent
(#8237 )
azurerm_key_vault_key - updating the latest version of the key when updating
metadata (#8304 )
azurerm_key_vault_secret - updating the latest version of the secret when
regardless of the value of provision_vm_agent (for when the VM Agent has been
installed manually) (#8001 )
azurerm_linux_virtual_machine_scale_set - working around a bug in the Azure
API by always sending the existing Storage Image Reference during updates
(#7983 )
azurerm_network_interface_application_gateway_association - handling the
regardless of the value of provision_vm_agent (for when the VM Agent has been
installed manually) (#8001 )
azurerm_windows_virtual_machine_scale_set - working around a bug in the Azure
API by always sending the existing Storage Image Reference during updates
(#7983 )
2.25.0 (August 27, 2020)
UPGRADE NOTES:
container now maps keys with empty values, which differs from previous versions
FEATURES:
IMPROVEMENTS:
(#8189 )
azurerm_frontdoor_firewall_policy - match_variable within the match_condition
BUG FIXES:
(#8233 )
azurerm_managed_disk - adding validation to the zone field (#8233 )
azurerm_nat_gateway - adding validation to the zone field (#8233 )
azurerm_orchestrated_virtual_machine_scale_set - adding validation to the zone
field (#8233 )
azurerm_public_ip_prefix - adding validation to the zone field (#8233 )
azurerm_public_ip - adding validation to the zone field (#8233 )
azurerm_redis_cache - adding validation to the zone field (#8233 )
azurerm_virtual_machine - adding validation to the zone field (#8233 )
azurerm_virtual_machine_scale_set - adding validation to the zone field (#8233 )
azurerm_windows_virtual_machine - support for updating ultra_ssd_enabled within
(#8233 )
IMPROVEMENTS:
openid_authentication (#7617 )
azurerm_policy_definition - mode can now be updated without recreating the
resource (#7976 )
BUG FIXES:
azurerm_frontdoor - ensuring all fields are set into the state (#8146 )
azurerm_frontdoor - rewriting case-inconsistent Resource ID's to ensure they're
reliable (#8146 )
azurerm_frontdoor_firewall_policy - ensuring all fields are set into the state
(#8146 )
azurerm_frontdoor_firewall_policy - rewriting case-inconsistent Resource ID's to
state (#8146 )
azurerm_frontdoor_custom_https_configuration - ensuring the
resource_group_name field is set into the state (#8173 )
azurerm_frontdoor_custom_https_configuration - rewriting case-inconsistent
(#8172 )
azurerm_lb_backend_address_pool - switching to use API version 2020-03-01 to
field (#8172 )
azurerm_lb_nat_pool - ensuring all fields are always set into the state (#8172 )
azurerm_lb_nat_pool - switching to use API version 2020-03-01 to workaround a
field (#8172 )
azurerm_lb_nat_rule - ensuring all fields are always set into the state (#8172 )
azurerm_lb_nat_rule - switching to use API version 2020-03-01 to workaround a
ID field (#8172 )
azurerm_lb_outbound_rule - ensuring all fields are always set into the state
(#8172 )
azurerm_lb_outbound_rule - switching to use API version 2020-03-01 to
(#8172 )
azurerm_lb_probe - ensuring all fields are always set into the state (#8172 )
azurerm_lb_probe - switching to use API version 2020-03-01 to workaround a bug
(#8172 )
azurerm_lb_rule - ensuring all fields are always set into the state (#8172 )
azurerm_lb_rule - switching to use API version 2020-03-01 to workaround a bug in
min_tls_version in Azure Public since these are currently not supported in other
regions (#8148 )
IMPROVEMENTS:
(#7945 )
azurerm_eventhub_namespace - support for the identity block (#8065 )
azurerm_postgresql_server - support for the identity block (#8044 )
azurerm_site_recovery_replicated_vm - support setting target_network_id and
type (#7890 )
azurerm_storage_account - filter allow_blob_public_access and min_tls_version
BUG FIXES:
All resources using a location field - allowing the value global when using
enhanced validation (#8042 )
Data Source: azurerm_api_management_user - user_id now accepts single
characters (#7975 )
azurerm_application_gateway - enforce case for the rule_type property (#8061 )
azurerm_iothub_consumer_group - lock during creation and deletion to workaround
stopped/deallocated (#8000 )
azurerm_mariadb_virtual_network_rule will now work across subscriptions
(#8100 )
azurerm_monitor_metric_alert_resource - continue using
threat_detection_policy (#7981 )
azurerm_orchestrated_virtual_machine_scale_set - allow single_placement_group
to be true (#7821 )
azurerm_mysql_server - support for the identity block (#8059 )
azurerm_storage_account - set default for min_tls_version to TLS_10 (#8152 )
azurerm_traffic_manager_profile - updating no longer clears all endpoints
(#7846 )
azurerm_windows_virtual_machine - handling machines which are already
IMPROVEMENTS:
(#8020 )
azurerm_servicebus_queue - support for the enable_batched_operations , status ,
forward_to , and forward_dead_lettered_messages_to (#7990 )
BUG FIXES:
FEATURES:
IMPROVEMENTS:
azurerm_api_management_identity_provider_aad - Support for signin_tenant
(#7901 )
azurerm_app_service_plan - update the relation between kind and reserved
(#7943 )
azurerm_automation_runbook - recreate azurerm_automation_job_schedule after an
update (#7555 )
azurerm_app_service_slot - support for the application_logs.file_system
(#7311 )
azurerm_firewall - no longer requires a zone (#7817 )
azurerm_function_app_slot - support for the site_config.auto_swap_slot_name
property (#7859 )
azurerm_kubernetes_cluster - support for in-place upgrade from Free to Paid for
sku_tier (#7927 )
azurerm_monitor_scheduled_query_rules_alert - action.0.custom_webhook_payload
(#7867 )
azurerm_servicebus_subscription - support for the status property (#7852 )
BUG FIXES:
(#7824 )
azurerm_api_management_named_value - the value has been marked as sensitive to
(#7916 )
azurerm_iothub_dps - the only valid value for the sku property for the API is now
S1 (#7847 )
azurerm_eventgrid_event_subscription - deprecate the topic_name as it is now
Enhanced Validation for Locations - the Azure Provider now validates that the
value for the location argument is a supported Azure Region within the Azure
Environment being used (from the Azure Metadata Service) - which allows us to
catch configuration errors for this field at terraform plan time, rather than during
a terraform apply . This functionality is now enabled by default, and can be opted-
out of by setting the Environment Variable ARM_PROVIDER_ENHANCED_VALIDATION to
false
DEPENDENCIES:
FEATURES:
IMPROVEMENTS:
BUG FIXES:
Data Source: azurerm_private_dns_zone - fix a crash when the zone does not exist
(#7783 )
azurerm_application_gateway - fix crash with gateway_ip_configuration (#7789 )
azurerm_cosmos_account - the geo_location.prefix property has been deprecated
HDInsight 3.6 will be retired (in Azure Public) on 2020-12-30 - HDInsight 4.0 does
not support ML Services, RServer or Storm Clusters - as such the
azurerm_hdinsight_ml_services_cluster , azurerm_hdinsight_rserver_cluster and
FEATURES:
IMPROVEMENTS:
property (#6341 )
azurerm_kubernetes_cluster - no longer sending the kubernetes_dashboard addon
(#7745 )
azurerm_machine_learning_workspace - adding the field high_business_impact
(#7703 )
azurerm_monitor_metric_alert - support for multiple scopes and associated criteria
(#7159 )
azurerm_mssql_database elastic_pool_id remove forcenew (#7628 )
azurerm_policy_assignment - support for metadata property (#7725 )
azurerm_policy_set_definition - support for the policy_definition_reference_id
property (#7018 )
azurerm_storage_account - support for configuring allow_blob_public_access
(#7739 )
azurerm_storage_container - container creation will retry if a container of the same
BUG FIXES:
(#7749 )
azurerm_eventhub_namespace - changing to zone_redundant now force a new
resource (#7612 )
azurerm_express_route_circuit - fix eventual consistency issue in create (#7753 )
azurerm_express_route_circuit - fix potential crash (#7776 )
azurerm_managed_disk - allow up to 65536 GB for the disk_size_gb property
(#7689 )
azurerm_machine_learning_workspace - waiting until the Machine Learning
updates (#7307 )
azurerm_notification_hub - validating that the ID is in the correct format when
(#7734 )
azurerm_virtual_hub - the field address_prefix is now ForceNew to match the
IMPROVEMENTS:
property (#7348 )
azurerm_application_gateway - support for the firewall_policy_id attribute within
field (#7548 )
azurerm_eventhub_namespace - support for setting partition_count to 1024 when
(#6969 )
azurerm_hdinsight_interactive_query_cluster - now supports Azure Monitor
(#7045 )
azurerm_hdinsight_kafka_cluster - now supports external metastores (#6969 )
azurerm_hdinsight_kafka_cluster - now supports external Azure Monitor
(#7045 )
azurerm_hdinsight_spark_cluster - now supports external metastores (#6969 )
azurerm_hdinsight_spark_cluster - now supports external Azure Monitor
(#7045 )
azurerm_hdinsight_storm_cluster - now supports external metastores (#6969 )
azurerm_hdinsight_storm_cluster - now supports external Azure Monitor
(#7045 )
azurerm_policy_set_definition - the management_group_id property has been
deprecated in favour of management_group_name to align with the behaviour in
azurerm_policy_definition (#6943 )
azurerm_kusto_cluster - support for the language_extensions property (#7421 )
azurerm_kusto_cluster - Support for the optimized_auto_scale property (#7371 )
azurerm_mysql_server - support for the threat_detection_policy property
(#7156 )
azurerm_mssql_database - the sku_name property now only forces a new resource
BUG FIXES:
azurerm_api_management_api_operation_policy - correctly parse XLM (#7345 )
azurerm_application_insights_api_key - now correctly checks if the resource exists
IDs (#7622 )
azurerm_policy_remediation - removing the validation for the
policy_definition_reference_id field since this isn't a Resource ID (#7600 )
azurerm_storage_data_lake_gen2_filesystem - prevent a crash during plan if
block now defaults to true and cannot be disabled, due to a behavioural change
in the Azure API (#7111 )
azurerm_hdinsight_hbase_cluster - the enabled property within the gateway block
now defaults to true and cannot be disabled, due to a behavioural change in the
Azure API (#7111 )
azurerm_hdinsight_interactive_query_cluster - the enabled property within the
gateway block now defaults to true and cannot be disabled, due to a behavioural
now defaults to true and cannot be disabled, due to a behavioural change in the
Azure API (#7111 )
azurerm_hdinsight_ml_services_cluster - the enabled property within the gateway
block now defaults to true and cannot be disabled, due to a behavioural change
in the Azure API (#7111 )
azurerm_hdinsight_rserver_cluster - the enabled property within the gateway
block now defaults to true and cannot be disabled, due to a behavioural change
in the Azure API (#7111 )
azurerm_hdinsight_spark_cluster - the enabled property within the gateway block
now defaults to true and cannot be disabled, due to a behavioural change in the
Azure API (#7111 )
azurerm_hdinsight_storm_cluster - the enabled property within the gateway block
now defaults to true and cannot be disabled, due to a behavioural change in the
Azure API (#7111 )
FEATURES:
IMPROVEMENTS:
(#7387 )
azurerm_kusto_cluster - Support trusted_external_tenants (#7374 )
azurerm_sentinel_alert_rule_ms_security_incident - the property text_whitelist
has been deprecated and renamed to display_name_filter to better match the api
(#7499 )
azurerm_shared_image - support for specialized images via the specialized
property (#7277 )
azurerm_shared_image_version - support for specialized images via the
BUG FIXES:
(#7547 )
azurerm_api_management_property - polling until the property is fully created
(#7547 )
azurerm_linux_virtual_machine_scale_set - using the provider feature
FEATURES:
IMPROVEMENTS:
(#4885 )
azurerm_app_service_environment - support a value of Web, Publishing for the
internal_load_balancing_mode property (#7346 )
azurerm_kusto_cluster - support for the identity block (#7367 )
azurerm_kusto_cluster - support for virtual_network_configuration block
(#7369 )
azurerm_kusto_cluster - supoport for the zone property (#7373 )
azurerm_firewall - support for configuring threat_intel_mode (#7437 )
azurerm_management_group - waiting until the Management Group has been fully
(#7457 )
azurerm_mssql_database - support GP_S_Gen5 SKUs up to GP_S_Gen5_40 (#7453 )
BUG FIXES:
(#7430 )
azurerm_hdinsight_hbase_cluster - fixes for node and instance count validation
(#7430 )
azurerm_hdinsight_interactive_query_cluster - fixes for node and instance count
validation (#7430 )
azurerm_hdinsight_kafka_cluster - fixes for node and instance count validation
(#7430 )
azurerm_hdinsight_ml_services_cluster - fixes for node and instance count
validation (#7430 )
azurerm_hdinsight_rserver_cluster - fixes for node and instance count validation
(#7430 )
azurerm_hdinsight_spark_cluster - fixes for node and instance count validation
(#7430 )
azurerm_hdinsight_storm_cluster - fixes for node and instance count validation
(#7430 )
azurerm_monitor_autoscale_settings - support for setting time_aggregation to
Last as per the documentation (#7480 )
azurerm_postgresql_server - can now update the tier of sku_name by recreating
recreate (#7424 )
azurerm_storage_account_network_rules - corretly clear ip_rules ,
DEPENDENCIES
FEATURES
IMPROVEMENTS:
(#7263 )
azurerm_app_service - support for scm_ip_restriction (#6955 )
azurerm_app_service_certificate - support for the
property (#7324 )
azurerm_kusto_cluster - Support for enable_purge (#7375 )
azurerm_kusto_cluster - Support for extended Kusto Cluster SKUs (#7372 )
azurerm_policy_assignment - added support for enforcement_mode (#7331 )
azurerm_private_endpoint - support for the private_dns_zone_group ,
private_dns_zone_configs , and custom_dns_configs blocks (#7246 )
azurerm_storage_share_directory - name can now contain one nested directory
(#7382 )
BUG FIXES:
optional (#7296 )
azurerm_hdinsight_cluster - deprecating the min_instance_count property
(#7272 )
azurerm_network_watcher_flow_log - propertly disable the flowlog on destroy
(#7154 )
FEATURES:
ENHANCEMENTS:
(#7182 )
azurerm_eventgrid_event_subscription - exposing base_url ,
max_events_per_batch , preferred_batch_size_in_kilobytes ,
active_directory_tenant_id and active_directory_app_id_or_uri in the
Integration v2 (#7233 )
azurerm_kubernetes_cluster - support for using a Disk Encryption Set (#7233 )
azurerm_kubernetes_cluster - support for configuring the Auto-Scale Profile
(#7233 )
azurerm_kubernetes_cluster - support for configuring outbound_ports_allocated
(#7233 )
azurerm_web_application_firewall_policy - Add support for GeoMatch operator in
BUG FIXES:
value (#7294 )
azurerm_eventhub_namespace_authorization_rule - handling the Resource ID
changing on Azure's side from authorizationRules to AuthorizationRules
(#7248 )
azurerm_eventgrid_event_subscription - fixing a crash when subject_filter was
omitted (#7222 )
azurerm_function_app - fix app_settings when using linux consumption plan
(#7230 )
azurerm_linux_virtual_machine_scale_set - adding validation for the
max_bid_price field (#7233 )
azurerm_kubernetes_cluster - the Azure Policy add-on is not supported in Azure
IMPROVEMENTS:
BUG FIXES:
specified (#7059 )
azurerm_app_service - App Services check correct scope for name availability in
ASE (#7157 )
azurerm_cdn_endpoint - origin_host_header can now be set to empty (#7164 )
azurerm_cosmosdb_account - workaround for CheckNameExists 500 response code
bug (#7189 )
azurerm_eventhub_authorization_rule - Fix intermittent 404 errors (#7122 )
azurerm_eventgrid_event_subscription - fixing an error when setting the
IMPROVEMENTS:
input_mapping_default_values (#6858 )
azurerm_kubernetes_cluster - exposing the oms_agent_identity block within the
BUG FIXES:
Resource ID (#7071 )
azurerm_key_vault_certificate - fixing a bug when using externally-signed
certificates (using the Unknown issuer) where polling would continue indefinitely
(#6979 )
azurerm_linux_virtual_machine - correctly validating the rsa ssh public_key
(#6968 )
azurerm_windows_virtual_machine - allow setting virtual_machine_scale_set_id in
FEATURES:
IMPROVEMENTS:
field (#6947 )
azurerm_app_service - the ip_restriction block now supports the action
property (#6967 )
azurerm_databricks_workspace - exposing workspace_id and workspace_url
(#6973 )
azurerm_netapp_volume - support the mount_ip_addresses property (#5526 )
azurerm_redis_cache - support new maxmemory policies allkeys-lfu & volatile-
lfu (#7031 )
azurerm_storage_account - allowing the value PATCH for allowed_methods within
BUG FIXES:
(#7023 )
azurerm_linux_virtual_machine_scale_set - allowing name to end with a capital
(#7023 )
azurerm_management_group - workaround for 403 bug in service response (#6668 )
azurerm_postgresql_server - do not attempt to get the threat protection when the
(#7023 )
FEATURES:
IMPROVEMENTS:
All Data Sources: adding validation for the resource_group_name field to not be
empty where it's Required (#6864 )
Data Source: azurerm_virtual_machine - export identity attribute (#6826 )
azurerm_api_management - support for configuring the Developer Portal (#6724 )
azurerm_api_management - support for user assigned managed identities (#6783 )
azurerm_api_management - support key_vault_id that do not have a version
(#6723 )
azurerm_api_management_diagnostic - support required property
api_management_logger_id (#6682 )
azurerm_application_gateway - support for WAF policies (#6105 )
azurerm_app_service_environment - support specifying explicit resource group
(#6821 )
azurerm_express_route_circuit - de-provision and re-provision circuit when
Tier (#6844 )
azurerm_mariadb_server - support for the create_mode property allowing the
(#6865 )
azurerm_mariadb_server - all properties in the storage_profile block have been
(#6833 )
azurerm_mysql_server - all properties in the storage_profile block have been
moved to the top level (#6833 )
azurerm_mysql_server - the following properties were renamed and changed to a
(#6822 )
azurerm_postgres_server - support for the threat_detection_policy property
(#6721 )
azurerm_storage_account - enable migration of account_kind from Storage to
StorageV2 (#6580 )
azurerm_windows_virtual_machine - the os_disk.disk_encryption_set_id can now
be updated (#6846 )
BUG FIXES:
api_management_logger_id (#6682 )
azurerm_api_management_named_value - fix the non empty plan when secret is true
(#6834 )
azurerm_application_insights - retention_in_days defaults to 90 (#6851 )
azurerm_data_factory_trigger_schedule - setting the type required for Pipeline
References (#6871 )
azurerm_kubernetes_cluster - fixes the InvalidLoadbalancerProfile error
(#6534 )
azurerm_linux_virtual_machine_scale_set - support for updating the
do_not_run_extensions_on_overprovisioned_machines property (#6917 )
azurerm_monitor_diagnostic_setting - fix possible crash with retention_policy
(#6911 )
azurerm_mariadb_server - the storage_mb property is now optional when
is enabled (#6833 )
azurerm_role_assignment - added evential consistency check to assignment
creation (#6925 )
azurerm_windows_virtual_machine_scale_set - support for updating the
IMPROVEMENTS:
Data Source: azurerm_eventhub_authorization_rule - support for the
primary_connection_string_alias an secondary_connection_string_alias
propeties (#6708 )
Data Source: azurerm_eventhub_namespace_authorization_rule - support for the
primary_connection_string_alias an secondary_connection_string_alias
propeties (#6708 )
Data Source: azurerm_eventhub_namespace - support for the
default_primary_connection_string_alias an
_defaultsecondary_connection_string_alias propeties (#6708 )
azurerm_analysis_services_server - support updating when the Server is paused
(#6786 )
azurerm_app_service - support for health_check_path preview feature added
(#6661 )
azurerm_app_service - support for name and priority on ip_restrictions
(#6705 )
azurerm_application_gateway - support for SSL Certificates without passwords
(#6742 )
azurerm_eventhub_authorization_rule - support for the
primary_connection_string_alias an secondary_connection_string_alias
propeties (#6708 )
azurerm_eventhub_namespace_authorization_rule - support for the
primary_connection_string_alias an secondary_connection_string_alias
propeties (#6708 )
azurerm_eventhub_namespace - support for the
default_primary_connection_string_alias an
_defaultsecondary_connection_string_alias propeties (#6708 )
azurerm_hdinsight_hadoop_cluster - support for metastores on cluster creation
(#6145 )
azurerm_key_vault_certificate - support for recovering a soft-deleted certificate if
AzureDiagnostics (#6769 )
azurerm_windows_virtual_machine_scale_set - support for configuring create_mode
BUG FIXES:
sensitive (#6774 )
azurerm_automation_runbook - the publish_content_link property is now optional
(#6813 )
azurerm_eventhub_namespace_authorization_rule - lock to prevent multiple
update (#6624 )
azurerm_policy_assignment - allow polices with scopes without subscription/<id>
(#6734 )
azurerm_redis_cache - ensure rdb_storage_connection_string is set when
IMPROVEMENTS:
(#6602 )
azurerm_api_management_api - support for openapi v3 content formats (#6618 )
azurerm_application_gateway - support host_names property (#6630 )
azurerm_express_route_circuit_peering - support for the customer_asn and
routing_registry_name propeties (#6596 )
azurerm_frontdoor - Add support for backend_pools_send_receive_timeout_seconds
(#6604 )
azurerm_mssql_server -support the public_network_access_enabled property
(#6678 )
azurerm_mssql_database - support for the extended_auditing_policy block
(#6402 )
azurerm_mssql_elasticpool - support license_type (#6631 )
azurerm_subnet : Support for multiple prefixes with address_prefixes (#6493 )
data.azurerm_shared_image_version - name supports latest and recent (#6707 )
BUG FIXES:
(#6260 )
azurerm_linux_virtual_machine - fix validation for name to allow full length
(#6402 )
azurerm_web_application_firewall_policy - support for the managed_rules
DEPENDENCIES:
IMPROVEMENTS:
properties (#6426 )
azurerm_function_app - added storage_account_id and
storage_account_access_key (#6304 )
azurerm_kubernetes_cluster - deprecating private_link_enabled in favour of
private_cluster_enabled (#6431 )
azurerm_mysql_server - support for the public_network_access_enabled property
(#6590 )
azurerm_notification_hub - support for tags (#6578 )
azurerm_notification_hub_namespace - support for tags (#6578 )
azurerm_postgres_server - support for the create_mode property allowing replicas,
point in time restores, and geo restores to be created (#6459 )
azurerm_postgres_server - support for the infrastructure_encryption_enabled ,
public_network_access_enabled , and ssl_minimal_tls_version_enforced properties
(#6459 )
azurerm_postgres_server - all properties in the storage_profile block have been
BUG FIXES:
update (#6476 )
azurerm_cdn_endpoint - origin_host_header is now required (#6550 )
azurerm_cdn_endpoint - setting the request_header_condition block (#6541 )
azurerm_iothub_dps - fix crash when path isn't cased correctly (#6570 )
azurerm_linux_virtual_machine_scale_set - fixes crash with boot_diagnositics
(#6569 )
azurerm_policy_assignment - allow scopes that don't start with subscription/<id>
(#6576 )
azurerm_postgres_server - the storage_mb property is now optional when
required (#6548 )
DEPENDENCIES:
IMPROVEMENTS:
(#6354 )
azurerm_cdn_endpoint - support for configuring delivery_rule (#6163 )
azurerm_cdn_endpoint - support for configuring global_delivery_rule (#6163 )
azurerm_function_app - support for the pre_warmed_instance_count property
(#6333 )
azurerm_hdinsight_hadoop_cluster - support for the tls_min_version property
(#6440 )
azurerm_hdinsight_hbase_cluster - support for the tls_min_version property
(#6440 )
azurerm_hdinsight_interactive_query_cluster - support for the tls_min_version
property (#6440 )
azurerm_hdinsight_kafka_cluster - support for the tls_min_version property
(#6440 )
azurerm_hdinsight_ml_services_cluster - support for the tls_min_version
property (#6440 )
azurerm_hdinsight_rserver_cluster - support for the tls_min_version property
(#6440 )
azurerm_hdinsight_spark_cluster - support for the tls_min_version property
(#6440 )
azurerm_hdinsight_storm_cluster - support the threat_detection_policy property
(#6437 )
azurerm_kubernetes_cluster - exporting the kubelet_identity (#6393 )
azurerm_kubernetes_cluster - support for updating the
(#6455 )
azurerm_policy_definition - the management_group_id has been deprecated and
BUG FIXES:
Data Source: azurerm_data_factory - fixing a bug where the ID wasn't set (#6492 )
Data Source: azurerm_eventhub_namespace_authorization_rule - ensuring the id
field is set (#6496 )
Data Source: azurerm_mariadb_server - ensuring the id field is set (#6496 )
Data Source: azurerm_network_ddos_protection_plan - ensuring the id field is set
(#6496 )
azurerm_function_app - prevent a panic from the API returning an empty IP
(#6397 )
azurerm_managed_disk - fixing a bug where the machine would be stopped
proceed.
azurerm_kubernetes_cluster_node_pool - clusters with auto-scale disabled must
ensure that min_count and max_count are set to null (or omitted) rather than 0
(since 0 isn't a valid value for these fields).
NOTES:
There's currently a bug in the Azure Kubernetes Service (AKS) API where the Tags
on Node Pools are returned in the incorrect case - this bug is being tracked in this
issue . This affects the tags field within the default_node_pool block for
azurerm_kubernetes_clusters and the tags field for the
azurerm_kubernetes_cluster_node_pool resource.
IMPROVEMENTS:
(#6230 )
azurerm_windows_virtual_machine - OS disk encryption settings can no be updated
(#6230 )
BUG FIXES:
disabled (#6095 )
azurerm_kubernetes_cluster - ensuring that a value for node_count within the
default_node_pool block is always passed to the API to match a requirement in the
API (#6095 )
azurerm_kubernetes_cluster - ensuring that tags are set into the state for the
default_node_pool (#6095 )
azurerm_kubernetes_cluster - conditionally sending the aci_connector_linux
IMPROVEMENTS:
api (#6289 )
azurerm_management_group - deprecated and rename the group_id property to
name to better match what it represents (#6276 )
BUGS:
(#6175 )
azurerm_policy_set_definition - mark metadata as computed (#6266 )
IMPROVEMENTS:
(#5778 )
azurerm_hpc_cache - exposing the mount_addresses field (#6214 )
azurerm_lb - allow ipv6 addresses for the private_ip_address property (#6125 )
azurerm_managed_disk - the disk_encryption_set_id field is no longer ForceNew
(#6207 )
azurerm_public_ip - support for Dynamic IPv6 Addresses (#6140 )
azurerm_service_fabric_cluster - support for the client_certificate_common_name
property (#6097 )
azurerm_storage_container - exposing the resource_manager_id field (#6170 )
azurerm_storage_share - exposing the resource_manager_id field (#6170 )
azurerm_traffic_manager_profile - support for the custom_header property
(#5923 )
BUG FIXES:
(#6225 )
azurerm_managed_disk - only rebooting the attached Virtual Machine when
changing the Disk Size, Disk Encryption Set ID or Storage Account Type (#6162 )
azurerm_netapp_volume - allow up to 102400 MB for the storage_quota_in_gb
property (#6228 )
azurerm_policy_definition - fixing a bug when parsing the Management Group ID
(#5981 )
azurerm_postgresql_server - updating the validation for the name field (#6064 )
azurerm_sql_database - use the correct base URI for the Extended Auditing Policies
Client (#6233 )
azurerm_storage_management_policy - conditionally setting values within the
(#6225 )
azurerm_windows_virtual_machine_scale_set - making the custom_data field
sensitive (#6225 )
IMPROVEMENTS:
(#6100 )
azurerm_logic_app_workflow - expose computed field: endpoint_configuration
(#5862 )
azurerm_linux_virtual_machine_scale_set - support for scale_in_policy and
terminate_notification (#5391 )
azurerm_sql_database - support for the extended_auditing_policy property
(#5049 )
azurerm_windows_virtual_machine_scale_set - support for scale_in_policy and
terminate_notification (#5391 )
BUG FIXES:
(#5966 )
azurerm_linux_virtual_machine_scale_set - updating the validation for name to
(#5803 )
FEATURES:
IMPROVEMENTS:
V2 SKU's (#5906 )
azurerm_automation_dsc_configuration - support for the tags property (#5827 )
azurerm_batch_pool - support for the public_ips property (#5967 )
azurerm_frontdoor - exposed new attributes in backend_pool_health_probe block
enabled and probe_method (#5924 )
azurerm_function_app - Added os_type field to facilitate support of linux function
apps (#5839 )
azurerm_kubernetes_cluster : Support for the node_labels property (#5531 )
azurerm_kubernetes_cluster : Support for the tags property (#5931 )
azurerm_kubernetes_cluster_node_pool : Support for the node_labels property
(#5531 )
azurerm_kubernetes_cluster_node_pool : Support for the tags property (#5931 )
azurerm_kusto_cluster - support for enable_disk_encryption and
(#5838 )
azurerm_redis_cache - support for the primary_connection_string and
(#5036 )
azurerm_storage_account - support up to 50 tags (#5934 )
azurerm_virtual_wan - support for the type property (#5877 )
BUG FIXES:
(#5837 )
azurerm_frontdoor - fix the way
location (#6015 )
azurerm_frontdoor_firewall_policy - add validation for Frontdoor WAF Name
Restrictions (#5943 )
azurerm_linux_virtual_machine_scale_set - correct source_image_id validation
(#5901 )
azurerm_netapp_volume - support volmes uoto 100TB in size (#5485 )
azurerm_search_service - changing the properties replica_count &
partition_count properties no longer force a new resource (#5935 )
azurerm_storage_account - fixing a crash when an empty static_website block was
specified (#6050 )
azurerm_storage_account - using SharedKey Authorization for reading/updating
Major Version: Version 2.0 of the Azure Provider is a major version - some
deprecated fields/resources have been removed - please refer to the 2.0 upgrade
guide for more information .
Provider Block: The Azure Provider now requires that a features block is specified
within the Provider block, which can be used to alter the behaviour of certain
resources - more information on the features block can be found in the
documentation .
Terraform 0.10/0.11: Version 2.0 of the Azure Provider no longer supports
Terraform 0.10 or 0.11 - you must upgrade to Terraform 0.12 to use version 2.0 of
the Azure Provider.
FEATURES:
Custom Timeouts: - all resources within the Azure Provider now allow configuring
custom timeouts - please see Terraform's Timeout documentation and the
documentation in each data source resource for more information.
Requires Import: The Azure Provider now checks for the presence of an existing
resource prior to creating it - which means that if you try and create a resource
which already exists (without importing it) you'll be prompted to import this into
the state.
New Data Source: azurerm_app_service_environment (#5508 )
New Data Source: azurerm_eventhub_authorization_rule (#5805 )
New Resource: azurerm_app_service_environment (#5508 )
New Resource: azurerm_express_route_gateway (#5523 )
New Resource: azurerm_linux_virtual_machine (#5705 )
New Resource: azurerm_linux_virtual_machine_scale_set (#5705 )
New Resource: azurerm_network_interface_security_group_association (#5784 )
New Resource: azurerm_storage_account_customer_managed_key (#5668 )
New Resource: azurerm_virtual_machine_scale_set_extension (#5705 )
New Resource: azurerm_windows_virtual_machine (#5705 )
New Resource: azurerm_windows_virtual_machine_scale_set (#5705 )
BREAKING CHANGES:
(#5725 )
azurerm_application_gateway - the field fqdns within the backend_address_pool
(#5823 )
azurerm_app_service - the field ip_address within the site_config block now
refers to a CIDR block, rather than an IP Address to match the Azure API (#5823 )
azurerm_app_service - removing the field virtual_network_name from the
since these properties have been moved to the top level (#5717 )
azurerm_app_service_slot - removing the field subnet_mask from the site_config
block (#5823 )
azurerm_app_service_slot - the field ip_address within the site_config block now
refers to a CIDR block, rather than an IP Address to match the Azure API (#5823 )
azurerm_app_service_slot - removing the field virtual_network_name from the
site_config block (#5823 )
azurerm_application_gateway - updating the default value for the body field within
(#5781 )
azurerm_automation_runbook - removing the deprecated account_name field
(#5781 )
azurerm_automation_schedule - removing the deprecated account_name field
(#5781 )
azurerm_autoscale_setting - the deprecated resource has been removed
(#5844 )
azurerm_availability_set - updating the default value for managed from false to
true (#5724 )
azurerm_azuread_application - This resource has been removed since it was
deprecated (#5748 )
azurerm_azuread_service_principal_password - This resource has been removed
deprecated (#5748 )
azurerm_client_config - removing the deprecated field
service_principal_application_id (#5823 )
azurerm_client_config - removing the deprecated field
service_principal_object_id (#5823 )
azurerm_cognitive_account - removing the deprecated sku_name block (#5797 )
azurerm_connection_monitor - the deprecated resource has been removed
(#5844 )
azurerm_container_group - removing the port field from the container block
(#5823 )
azurerm_container_group - removing the protocol field from the container block
(#5823 )
azurerm_container_group - the ports field is no longer Computed (#5823 )
azurerm_container_group - the protocol field within the ports block is no longer
(#5823 )
azurerm_container_service - This resource has been removed since it was
deprecated (#5709 )
azurerm_cosmosdb_mongo_collection - removing the deprecated indexes block
(#5853 )
azurerm_ddos_protection_plan - the deprecated resource has been removed
(#5844 )
azurerm_devspace_controller - removing the deprecated sku block (#5795 )
azurerm_dns_cname_record - removing the deprecated records field (#5794 )
azurerm_dns_ns_record - removing the deprecated records field (#5794 )
azurerm_dns_zone - removing the deprecated zone_type field (#5794 )
azurerm_dns_zone - removing the deprecated registration_virtual_network_ids
field (#5794 )
azurerm_dns_zone - removing the deprecated resolution_virtual_network_ids
field (#5794 )
azurerm_eventhub - removing the deprecated location field (#5793 )
azurerm_eventhub_authorization_rule - removing the deprecated location field
(#5793 )
azurerm_eventhub_consumer_group - removing the deprecated location field
(#5793 )
azurerm_eventhub_namespace - removing the deprecated kafka_enabled field since
(#5852 )
azurerm_frontdoor - the field forwarding_protocol within the
MatchRequest (#5852 )
azurerm_function_app - removing the field virtual_network_name from the
block to accept a CIDR rather than an IP Address to match the updated API
behaviour (#5823 )
azurerm_iot_dps - This resource has been removed since it was deprecated
(#5753 )
azurerm_iot_dps_certificate - This resource has been removed since it was
deprecated (#5753 )
azurerm_iothub - The deprecated sku.tier property will be removed. (#5790 )
azurerm_iothub_dps - The deprecated sku.tier property will be removed.
(#5790 )
azurerm_key_vault - removing the sku block since this has been deprecated in
(#5774 )
azurerm_key_vault_certificate - removing the deprecated vault_uri field
(#5774 )
azurerm_key_vault_key - removing the deprecated vault_uri field (#5774 )
azurerm_key_vault_secret - removing the deprecated vault_uri field (#5774 )
azurerm_kubernetes_cluster - updating the default value for load_balancer_sku to
(#5823 )
azurerm_kubernetes_cluster - removing the deprecated agent_pool_profile block
(#5823 )
azurerm_kubernetes_cluster - the field enable_pod_security_policy is no longer
computed (#5823 )
azurerm_lb_backend_address_pool - removing the deprecated location field
(#5823 )
azurerm_lb_nat_pool - removing the deprecated location field (#5823 )
azurerm_lb_nat_rule - removing the deprecated location field (#5823 )
azurerm_lb_probe - removing the deprecated location field (#5823 )
azurerm_lb_rule - removing the deprecated location field (#5823 )
azurerm_log_analytics_workspace_linked_service - This resource has been
(#5844 )
azurerm_mssql_elasticpool - removing the deprecated elastic_pool_properties
block (#5744 )
azurerm_mysql_server - removing the deprecated sku block (#5743 )
azurerm_network_interface - removing the deprecated
application_gateway_backend_address_pools_ids field from the ip_configurations
block (#5784 )
azurerm_network_interface - removing the deprecated
application_security_group_ids field from the ip_configurations block
(#5784 )
azurerm_network_interface - removing the deprecated
(#5784 )
azurerm_network_interface - removing the deprecated
(#5784 )
azurerm_network_interface - removing the deprecated internal_fqdn field
(#5784 )
azurerm_network_interface - removing the network_security_group_id field in
(#5844 )
azurerm_private_link_service - removing the deprecated field
network_interface_ids (#5823 )
azurerm_public_ip - making the allocation_method field required (#5823 )
azurerm_public_ip - removing the deprecated field public_ip_address_allocation
(#5823 )
azurerm_recovery_network_mapping - the deprecated resource has been removed
(#5816 )
azurerm_recovery_replicated_vm - the deprecated resource has been removed
(#5816 )
azurerm_recovery_services_fabric - the deprecated resource has been removed
(#5816 )
azurerm_recovery_services_protected_vm - the deprecated resource has been
removed (#5816 )
azurerm_recovery_services_protection_container - the deprecated resource has
(#5719 )
azurerm_scheduler_job - This resource has been removed since it was deprecated
(#5712 )
azurerm_scheduler_job_collection - This resource has been removed since it was
deprecated (#5712 )
azurerm_storage_account - updating the default value for account_kind from
(#5710 )
azurerm_storage_container - removing the deprecated resource_group_name field
(#5710 )
azurerm_storage_container - removing the deprecated properties block
(#5710 )
azurerm_storage_queue - removing the deprecated resource_group_name field
(#5710 )
azurerm_storage_share - removing the deprecated resource_group_name field
(#5710 )
azurerm_storage_table - removing the deprecated resource_group_name field
(#5710 )
azurerm_subnet - removing the deprecated ip_configuration field (#5801 )
azurerm_subnet - removing the deprecated network_security_group_id field
(#5801 )
azurerm_subnet - removing the deprecated route_table_id field (#5801 )
azurerm_subnet - making the actions list within the service_delegation block
(#5823 )
IMPROVEMENTS:
(#5649 )
azurerm_storage_account - support for configuring cors_rules within the
blob_properties block (#5425 )
azurerm_subnet - support for delta updates (#5801 )
azurerm_windows_virtual_machine - fixing a bug when provisioning from a Shared
BUG FIXES:
documented (#5817 )
azurerm_api_management_api - allows blank path field (#5833 )
azurerm_eventhub_namespace - the field ip_rule within the network_rulesets block
(#5764 )
azurerm_netapp_account - allowing the - character to be used in the name field
(#5842 )
azurerm_network_interface - the dns_servers field now respects ordering
(#5784 )
azurerm_public_ip_prefix - fixing the validation for the prefix_length to match
default (#5825 )
azurerm_role_assignment - validating that the name is a UUID (#5624 )
azurerm_signalr_service - ensuring the SignalR segment is parsed in the correct
case (#5737 )
azurerm_storage_account - locking on the storage account resource when
deletion (#5764 )
For information on changes between the v2.00.0 and v1.0.0 releases, please see the
previous v1.x changelog entries .
For information on changes prior to the v1.0.0 release, please see the v0.x changelog .
Versions 1.0.0 - 1.44.0
Preparation for 2.0: We intend for v1.44.0 to be the last release in the 1.x line -
we'll be turning our focus to 2.0 with the next release. We recommend consulting
the list of changes coming in 2.0 to be aware and trialling the Beta available in
1.x versions if you're interested.
Terraform 0.10/0.11: The upcoming version 2.0 of the Azure Provider will not
support Terraform 0.10.x & Terraform 0.11.x - you will need to upgrade to
Terraform 0.12 to use version 2.0 (and above) of the Azure Provider.
FEATURES:
(#5610 )
azurerm_windows_virtual_machine_scale_set - support for updating VMSS's with a
IMPROVEMENTS:
(#5619 )
azurerm_lb - fixing a crash when the HTTP response is dropped (#5680 )
azurerm_stream_analytics_job - support for importing jobs created in the portal
(#5522 )
azurerm_storage_blob - support for authenticating using Microsoft Entra ID
(#5614 )
azurerm_storage_container - support for authenticating using Microsoft Entra ID
(#5614 )
azurerm_storage_queue - support for authenticating using Microsoft Entra ID
(#5614 )
BUGS:
(#5565 )
azurerm_linux_virtual_machine - fix shared_image_id parsing (#5640 )
Opt-In Beta: Version 1.43 of the Azure Provider introduces an opt-in Beta for some
of the new functionality coming in 2.0 - more information can be found in the Beta
guide .
Terraform 0.10/0.11: The upcoming version 2.0 of the Azure Provider will not
support Terraform 0.10.x & Terraform 0.11.x - you will need to upgrade to
Terraform 0.12 to use version 2.0 (and above) of the Azure Provider.
FEATURES:
IMPROVEMENTS:
subresource_names (#5571 )
azurerm_recovery_services_vault - support for the soft_delete_enabled property
(#5586 )
BUGS:
machine (#5579 )
azurerm_marketplace_agreement - recreate agreement if not accepted (#5582 )
azurerm_mysql_virtual_network_rule - allow subnet_id to be in a different
to 32000 (#5540 )
FEATURES:
IMPROVEMENTS:
(#3889 )
azurerm_databricks_workspace - support for the no_public_ip custom parameter
(#5469 )
azurerm_express_route_circuit - support for the Basic and Local tiers (#5456 )
azurerm_frontdoor_firewall_policy - support for exclusions (#5407 )
azurerm_iothub - support for the event_hub_retention_in_days and
event_hub_partition_count properties (#5505 )
azurerm_kubernetes_cluster - Add support for load_balancer_profile (#5394 )
azurerm_network_watcher_flow_log - support for the version property (#5419 )
azurerm_traffic_manager_profile - add the expected_status_code_ranges
(#5471 )
azurerm_traffic_manager_profile - switch dns_config and monitor_config to type
BUG FIXES:
(#5443 )
azurerm_postgresql_firewall - correctly validate the server_name property
(#5443 )
azurerm_postgresql_virtual_network_rule - correctly validate the server_name
property (#5443 )
azurerm_private_link_service - fixing a crash when the auto_approval and
(#5413 )
1.41.0 (January 16, 2020)
NOTES:
field is specified during import, as such this field is now required during when
importing a VHD to a Managed Disk (#5250 )
FEATURES:
IMPROVEMENTS:
(#5319 )
azurerm_iothub - deprecate the sku.tier property as it is no longer required
(#5382 )
azurerm_iothub - add an upper range of 200 to the sku.capacify validation
(#5382 )
azurerm_iothub_dps - deprecate the sku.tier property as it is no longer required
(#5382 )
azurerm_iothub_dps - add an upper range of 200 to the sku.capacify validation
(#5382 )
azurerm_lb_rule - support for the enable_tcp_reset property (#5373 )
azurerm_lb_nat_rule - support for the enable_tcp_reset and
idle_timeout_in_minutes properties (#5373 )
azurerm_managed_disk - support for configuring disk_encryption_set_id (#5250 )
azurerm_managed_disk - support for configuring storage_account_id which is now
BUG FIXES:
queues (#5316 )
IMPROVEMENTS:
property (#5204 )
azurerm_api_management_operation - will no longer panic when response is missing
values (#5273 )
azurerm_cosmosdb_cassandra_keyspace - support for the throughput property
(#5203 )
azurerm_cosmosdb_sql_container - support for the throughput property (#5203 )
azurerm_cosmosdb_sql_database - support for the throughput property (#5203 )
azurerm_cosmosdb_table - support for the throughput property (#5203 )
azurerm_dns_a_record - support for configuring target_resource_id (#5218 )
azurerm_dns_aaaa_record - support for configuring target_resource_id (#5218 )
azurerm_dns_cname_record - support for configuring target_resource_id (#5218 )
azurerm_dns_mx_record - the name property is now optional (#5205 )
azurerm_function_app - support for the ftps_state property (#5169 )
azurerm_image - support for configuring hyper_v_generation (#4453 )
azurerm_iothub_dps_shared_access_policy - support for the
(#5244 )
azurerm_private_link_service - support for the enable_proxy_protocol property
(#5178 )
azurerm_recovery_services_fabric - has been deprecated and renamed to
azurerm_site_recovery_fabric (#5170 )
azurerm_recovery_network_mapping - has been deprecated and renamed to
azurerm_site_recovery_network_mapping (#5170 )
azurerm_recovery_services_protection_container - has been deprecated and
azurerm_backup_protected_vm (#5170 )
azurerm_search_service - exposing the query_keys (#5029 )
azurerm_storage_account - exposing the blob_properties block (#3807 )
aaurerm_storage_account - correctly handle an empty network rules API response
(#5210 )
azurerm_storage_account - making the resource group name case sensitive
(#5289 )
azurerm_shared_image_version - support for the storage_account_type property
(#5212 )
azurerm_virtual_network_gateway - support for configuring generation (#5198 )
azurerm_virtual_network_gateway_connection - support for the
BUG FIXES:
(#5046 )
azurerm_monitor_log_profile - polling until the log profile is repeatedly available
(#5194 )
azurerm_storage_account_network_rules - matching the validation used for
(#5308 )
azurerm_virtual_machine - handling a crash when the vault_certificates block
IMPROVEMENTS:
(#5107 )
azurerm_app_service_plan - adding validation to import (#5107 )
azurerm_app_service_slot - adding validation to import (#5107 )
azurerm_app_service_source_control_token - adding validation to import
(#5107 )
azurerm_cosmos_mongo_collection - deprecate the indexes property (#5116 )
azurerm_cosmos_mongo_collection - make throughput computed and remove the
azurerm_private_endpoint (#5150 )
BUG FIXES:
Data Source: azurerm_nat_gateway - handling a crash when the sku block was
malformed (#5104 )
azurerm_api_management_api - ensuring version_set_id is specified when version
is (#4993 )
azurerm_nat_gateway - handling a crash when the sku block was malformed
(#5104 )
azurerm_private_link_endpoint - fixing the validation for the subresource_names
field (#5118 )
azurerm_storage_account - querying all pages when listing storage accounts
(#5075 )
azurerm_storage_blob - querying all pages when listing storage accounts
(#5075 )
azurerm_storage_container - querying all pages when listing storage accounts
(#5075 )
azurerm_storage_file - querying all pages when listing storage accounts
(#5075 )
azurerm_storage_queue - querying all pages when listing storage accounts
(#5075 )
azurerm_storage_table - querying all pages when listing storage accounts
(#5075 )
IMPROVEMENTS:
BUG FIXES:
FEATURES:
IMPROVEMENTS:
2.0 prep: refresh functions now use custom timeouts when custom timeouts are
enabled (#4838 )
authentication: requesting a fresh token from the Azure CLI when the existing one
expires (#4775 )
dependencies: updating github.com/Azure/azure-sdk-for-go to v36.3.0 (#4913 )
dependencies: updating github.com/Azure/go-autorest to v0.9.2 (#4775 )
dependencies: updating github.com/hashicorp/go-azure-helpers to v0.10.0
(#4775 )
networking: updating to API version 2019-07-01 (#4596 )
sql: updating to API version 2017-03-01-preview (#4242 )
Data Source: azurerm_monitor_action_group - support for arm_role_receiver ,
automation_runbook_receiver , azure_app_push_receiver , azure_function_receiver ,
itsm_receiver , logic_app_receiver and voice_receiver (#4638 )
azurerm_api_management_api - the version and version_set_id properties can now
be set (#4592 )
azurerm_app_service - support for JAVA container (#4897 )
azurerm_app_service - support for configuring the minor version of Java (#4779 )
azurerm_app_service_slot - support for auto_swap_slot_name (#4752 )
azurerm_app_service_slot - support for configuring the minor version of Java
(#4779 )
azurerm_application_insights - support for the sampling_percentage property
(#4925 )
azurerm_automation_credential - deprecate account_name in favour of
automation_account_name (#4777 )
azurerm_cognitive_service - support for the kind LUIS.Authoring (#4888 )
azurerm_eventgrid_domain - Export primary_access_key and secondary_access_key
(#4876 )
azurerm_firewall - allow multiple ip_configuration blocks (#4639 )
azurerm_firewall_application_rule_collection - support for the protocol type
Mssql (#4596 )
azurerm_hdinsight_hadoop_cluster - Added edge node support (#4550 )
azurerm_hdinsight_hadoop_cluster - support for gen storage_account_gen2
property (#4634 )
azurerm_hdinsight_hbase_cluster - support for gen storage_account_gen2
property (#4634 )
azurerm_hdinsight_kafka_cluster - support for gen storage_account_gen2
property (#4634 )
azurerm_hdinsight_query_cluster - support for gen storage_account_gen2
property (#4634 )
azurerm_hdinsight_spark_cluster - support for the storage_account_gen2 property
(#4634 )
azurerm_iot_dps - has been deprecated and renamed to azurerm_iothub_dps
(#4896 )
azurerm_iot_dps_certificate - has been deprecated and renamed to
azurerm_iothub_dps_certificate (#4896 )
azurerm_key_vault_secret - support for not_before_date and expiration_date
(#4873 )
azurerm_kubernetes_cluster - introducing a new default_node_pool block which
property (#4426 )
azurerm_template_deployment - validating the ARM Template prior to deploying it,
BUG FIXES:
(#4953)
azurerm_eventhub_namespace - deprecating the kafka_enabled sproperty as it is
Interfaces (#4852 )
azurerm_postgresql_database - allowing dashes in the name (#4866 )
azurerm_private_dns_cname_record - fixing a bug where calling Delete didn't
weight 0 (#4849 )
provider: adding a flag to allow users to opt-out of the default Terraform Partner
ID (#4751 )
IMPROVEMENTS:
(#4467 )
azurerm_firewall - support for zones (#4670 )
azurerm_function_app - add support for the http2_enabled property (#4696 )
azurerm_frontdoor - update custom_host to be optional, add
redirect_configuration to documentation. (#4601 )
azurerm_kubernetes_cluster - allow the aci_connector_linux to be disabled by
(#4615 )
azurerm_network_security_rule - add support for Icmp to the protocol property
(#4615 )
azurerm_servicebus_namespace - allow capacity to 8 for the premium SKU
(#4630 )
azurerm_subnet - add support for the Microsoft.DBforPostgreSQL/serversv2 and
property (#4690 )
azurerm_subnet - add support for the Microsoft.Network/networkinterfaces/* and
Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action to
BUG FIXES:
azurerm_api_management - deprecate the disable_backend_ssl30 ,
disable_backend_tls10 , disable_backend_tls11 , disable_triple_des_ciphers ,
optional (#4513 )
azurerm_key_vault - temporarily making sku case insensitive to work around a
(#4725 )
azurerm_maps_account - temporarily making sku case insensitive to work around a
creation (#4573 )
azurere_storage_account - Ignore Advanced Threat Protection read errors in Azure
Germany (#4564 )
azurerm_storage_blob - making metadata a computed field (#4727 )
azurerm_virtual_machine - handling the plan block being nil (#4712 )
azurerm_virtual_machine_data_disk_attachment - will no longer remove the
IMPROVEMENTS:
(#3154 )
azurerm_app_service_custom_hostname_binding - support for ssl_state and
thumbprint (#4204 )
azurerm_app_service_slot - support for logs (#4473 )
azurerm_application_insights_analytics_item - Add support for App Insights
(#4409 )
azurerm_function_app - changes to app_service_plan_id no longer force a new
resource (#4439 )
azurerm_kubernetes_cluster - support for updating the Service Principal (#4469 )
azurerm_servicebus_namespace - support for zone_redundant (#4432 )
BUG FIXES:
(#4424 )
azurerm_hdinsight_hadoop_cluster - handling the API now masking passwords
(#4489 )
azurerm_hdinsight_hbase_cluster - handling the API now masking passwords
(#4489 )
azurerm_hdinsight_interactive_query_cluster - handling the API now masking
passwords (#4489 )
azurerm_hdinsight_kafka_cluster - handling the API now masking passwords
(#4489 )
azurerm_hdinsight_ml_services_cluster - handling the API now masking
passwords (#4489 )
azurerm_hdinsight_rserver_cluster - handling the API now masking passwords
(#4489 )
azurerm_hdinsight_spark_cluster - handling the API now masking passwords
(#4489 )
azurerm_hdinsight_storm_cluster - handling the API now masking passwords
(#4489 )
azurerm_key_vault_certificate - storing the certificate data as hex (#4335 )
azurerm_kubernetes_cluster - fixing a bug where upgrading to 1.34.0 would
IMPROVEMENTS:
(#4175 )
azurerm_application_gateway - allowing capacity to be set to 32 (#4189 )
azurerm_application_gateway - support OWASP version 3.1 for the
property (#4206 )
azurerm_app_service - fixing a bug where the Application logs block would get
(#4184 )
azurerm_app_service_slot - the ip_restriction.ip_address property is now
optional (#4184 )
azurerm_availability_set - support for the proximity_placement_group_id
property (#4020 )
azurerm_cognitive_account - supporting CognitiveServices as a kind (#4209 )
azurerm_container_registry - support for configuring Virtual Network Rules to
Subnets (#4293 )
azurerm_cosmosdb_account - correctly validate max_interval_in_seconds &
max_staleness_prefix for geo replicated accounts (#4273 )
azurerm_cosmosdb_account - increase creation & deletion wait timeout to 3 hours
(#4271 )
azurerm_cosmosdb_sql_container - changing the unique_key.paths property now
provisioned (#4307 )
azurerm_postgresql_server - support for configuring auto_grow (#4220 )
azurerm_resource_group - the name field can now be up to 90 characters (#4233 )
azurerm_role_assignment - add principal_type and
user doesn't have permissions to list the Keys for the storage account (#4248 )
azurerm_storage_blob - switching over to use the new Storage SDK (#4179 )
azurerm_storage_blob - support for Append Blobs (#4238 )
azurerm_storage_blob - support for configuring the access_tier (#4238 )
azurerm_storage_blob - support for specifying Block Blob content via
source_content (#4238 )
azurerm_storage_blob - the type field is now Required, since it had to be set
anyway (#4238 )
azurerm_storage_share_directory - support for upper-case characters in the name
field (#4178 )
azurerm_storage_table - using the correct storage account name when checking
optional (#4190 )
azurerm_stream_analytics_job - the field output_error_policy is now optional
(#4190 )
azurerm_subnet - support for the actions
Microsoft.Network/virtualNetworks/subnets/join/action and
Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action
(#4137 )
azurerm_virtual_machine - support for UltraSSD_LRS managed disks (#3860 )
azurerm_virtual_machine - support for the proximity_placement_group_id property
(#4020 )
azurerm_virtual_machine_scale_set - support for the
proximity_placement_group_id property (#4020 )
BUG FIXES:
sensitive (#4201 )
azurerm_key_vault_certificate - prevented a panic caused by an empty element
in extended_key_usage (#4272 )
azurerm_log_analytics_linked_service - will no longer panic if no items are
IMPROVEMENTS:
(#3716 )
azurerm_container_group - log_type can now be an empty string (#4013 )
azurerm_cognitive_account - Adding 'QnAMaker' as Kind (#4126 )
azurerm_dns_zone - deprecating the zone_type field (#4033 )
azurerm_function_app - support for cors (#3949 )
azurerm_function_app - support for the virtual_network_name property (#4078 )
azurerm_iot_dps - add support for the linked_hub property (#3922 )
azurerm_kubernetes_cluster - support for the enable_pod_security_policy
property (#4098 )
azurerm_monitor_diagnostic_setting - support for
log_analytics_destination_type (#3987 )
azurerm_role_assignment - now supports management groups (#4063 )
azurerm_storage_account - requesting an access token using the ARM Authorizer
(#4099 )
azurerm_storage_account - support for BlockBlobStorage (#4131 )
azurerm_subnet - support for the Service Endpoints
Microsoft.BareMetal/AzureVMware , Microsoft.BareMetal/CrayServers ,
Microsoft.Databricks/workspaces and Microsoft.Web/hostingEnvironments
(#4115 )
azurerm_traffic_manager_profile - support for the interval_in_seconds ,
(#4094 )
BUG FIXES:
insensitive (#3977 )
`azurerm_notification_hub_authorization_rule - fixing an issue when creating
multiple authorization rules at the same time (#4087 )
azurerm_postgresql_server - removal of unsupported version 10.2 (#3915 )
azurerm_role_definition - enture role_definition_id is correctly set if left empty
required (#4037 )
azurerm_storage_account - making the network_rules block computed (#4037 )
azurerm_storage_queue - switching to using SharedKey for authentication
(#4122 )
azurerm_storage_share - allow up to 100TB for the quota property (#4054 )
azurerm_storage_share_directory - handling the share being eventually consistent
(#4122 )
azurerm_storage_share_directory - allowing nested directories (#4122 )
(#3945 )
azurerm_network_ddos_protection_plan - correctly decodes the resource ID on
read/delete (#3975 )
azurerm_dev_test_virtual_network - generate subnet IDs in the correct format
(#3717 )
azurerm_iot_dps fixed deletion issue when using a service principal (#3973 )
azurerm_kubernetes_cluster - the load_balancer_sku property is now case
insensitive (#3958 )
azurerm_postgresql_server - add missing support for version 11.0 (#3970 )
azurerm_storage_* - prevent multiple panics when a storage account/resource
format (#3932 )
azurerm_virtual_machine_scale_set - the ssh_keys property of the
os_profile_linux_config block now recognizes updates (#3837 )
azurerm_virtual_machine_scale_set - changes made to the network_profile
IMPROVEMENTS:
(#3890 )
azurerm_recovery_services_protected_vm - changing backup_policy_id no longer
(#3750 )
azurerm_storage_account - support for the enable_advanced_threat_protection
property (#3782 )
azurerm_storage_account - support for queue_properties (#3859 )
azurerm_storage_blob - making metadata a computed field (#3842 )
azurerm_storage_container - switching to use github.com/tombuildsstuff/giovanni
(#3857 )
azurerm_storage_container - adding support for metadata (#3857 )
azurerm_storage_container - can now create containers with the name $web
(#3896 )
azurerm_storage_queue - switching to use github.com/tombuildsstuff/giovanni
(#3832 )
azurerm_storage_share - switching to use github.com/tombuildsstuff/giovanni
(#3828 )
azurerm_storage_share - support for configuring ACL's (#3830 )
azurerm_storage_share - support for configuring MetaData (#3830 )
azurerm_storage_table - switching to use github.com/tombuildsstuff/giovanni
(#3834 )
azurerm_storage_table - support for configuring ACL's (#3847 )
azurerm_traffic_manager_endpoint - supper for custom_header and subnet
properties (#3655 )
azurerm_virtual_machine - switching over to use the
Machine when optionally deleting them upon deletion rather than parsing them
from the config (#3838 )
azurerm_virtual_machine_scale_set - prevent public_ip_address_configuration
BUG FIXES:
IMPROVEMENTS:
(#3520 )
azurerm_app_service_plan - prevent a panic during import (#3657 )
azurerm_app_service_slot - updating identity no longer forces a new resource
(#3702 )
azurerm_automation_account - deprecated sku in favour of sku_name (#3119 )
azurerm_key_vault - deprecated sku in favour of sku_name (#3119 )
azurerm_key_vault_key - add support for Elliptic Curve based keys (#1814 )
azurerm_traffic_manager_profile - ttl can now be 1 second (#3632 )
azurerm_eventgrid_event_subscription - now retrieves the full URL for event
webhooks (#3630 )
azurerm_lb - support for the public_ip_prefix_id property (#3675 )
azurerm_mysql_server - add validation to the name property (#3695 )
azurerm_notification_hub_namespace - deprecated sku in favour of sku_name
(#3119 )
azurerm_redis_firewall_rule - no longer fails with multiple rules (#3731 )
azurerm_relay_namespace - deprecated sku in favour of sku_name (#3119 )
azurerm_service_fabric_cluster - tenant_id , cluster_application_id , and
client_application_id are now updateable (#3654 )
azurerm_service_fabric_cluster - ability to set certificate_common_names
(#3652 )
azurerm_storage_account - ability to set default_action oi the network_rules
block (#3255 )
BUG FIXES:
Ensuring the authorization header is set for calls to the User Assigned Identity API's
(#3613 )
IMPROVEMENTS:
disable_triple_des_ciphers (#3539 )
azurerm_application_gateway - support for the value General in the
rule_group_name field within the disabled_rule_group block (#3533 )
azurerm_app_service - support for windows containers (#3566 )
azurerm_app_service_plan - support for the maximum_elastic_worker_count
property (#3547 )
azurerm_managed_disk - support for the create_option of Restore (#3598 )
azurerm_app_service_plan - support for windows containers (#3566 )
IMPROVEMENTS:
BUG FIXES:
provisioning (#3482 )
azurerm_api_management_api - correct validation to allow empty and strings 400
creation (#3501 )
azurerm_express_route_circuit - no longer removes circuit subresources on
update (#3496 )
azurerm_role_assignment - making the role_definition_name field case-insensitive
(#3499 )
IMPROVEMENTS:
(#3353 )
azurerm_application_gateway added validation to ensure
redirect_configuration_name must not be set if either backend_address_pool_name
property (#3262 )
azurerm_kubernetes_cluster - support for setting type within the
agent_pool_profile block (Agent Pools via Virtual Machine Scale Sets) (#3424 )
azurerm_redis_cache - support for disabling authentication (#3389 )
azurerm_redis_cache - make the redis_configuration block optional (#3397 )
azurerm_sql_database - support for the read_scale property (#3377 )
azurerm_stream_analytics_job - tags can now be set on the property (#3329 )
azurerm_virtual_network_peering - retrying provisioning the peering of the virtual
network (#3392 )
azurerm_virtual_machine_scale_set - support for the provision_after_extensions
BUG FIXES:
validation (#3438 )
azurerm_eventhub - decrease minimum partition_count to correct value of 1
(#3439 )
azurerm_eventhub_namespace - decrease maximum maximum_throughput_units to
creation (#3397 )
azurerm_sql_database - making the collation field case insensitive to work
output (#3318 )
azurerm_app_service_plan - supports elastic for the sku tier (#3402 )
azurerm_application_gateway - supports disabled_rule_group for waf
configurations (#3394 )
azurerm_application_gateway - supports exclusion for waf configurations
(#3407 )
azurerm_application_gateway - supports updating a
gateway_ip_configuration.x.subnet_id (#3437 )
This release includes a Terraform SDK upgrade with compatibility for Terraform
v0.12. The provider remains backwards compatible with Terraform v0.11 and there
should not be any significant behavioural changes. (#2968 )
BUG FIXES:
IMPROVEMENTS:
(#3192 )
azurerm_container_group - support for specifying liveness_probe and
readiness_probe blocks (#3118 )
azurerm_key_vault_access_policy - support for setting storage_permissions
(#3153 )
azurerm_kubernetes_cluster - network_policy now supports azure (#3213 )
azurerm_iothub - support for configuring ip_filter_rule (#3173 )
azurerm_public_ip - support for attaching a azurerm_public_ip_prefix (#3139 )
azurerm_redis_cache - support for setting aof_backup_enabled ,
aof_storage_connection_string_0 and aof_storage_connection_string_1 (#3155 )
azurerm_storage_blob - support for the metadata property (#3206 )
azurerm_traffic_manager_profile - support the MultiValue and Weighted values
BUG FIXES:
(#3198 )
azurerm_function_app - ensuring deleted Function Apps are detected correctly
(#3198 )
azurerm_virtual_machine - adding validation for the identity_ids field (#3183 )
IMPROVEMENTS:
(#3151 )
azurerm_app_service - support for migrating between App Service Plans (#3048 )
azurerm_app_service - support for additional types for the scm_type field in the
(#3049 )
azurerm_function_app - exporting possible_outbound_ip_addresses (#3043 )
azurerm_iothub - properties batch_frequency_in_seconds ,
max_chunk_size_in_bytes , encoding , container_name , file_name_format are now
(#3104 )
azurerm_redis_cache - support for the minimum_tls_version property (#3111 )
azurerm_storage_account - support for configuring the Hierarchical Namespace
state (#3032 )
azurerm_storage_account - exposing the DFS File Secondary and Web endpoints
(#3110 )
azurerm_virtual_machine - support for managed disks up to 32TB (#3062 )
azurerm_virtual_machine_scale_set - support for managed disks up to 32TB
(#3062 )
BUG FIXES:
elements (#3038 )
azurerm_virtual_machine_scale_set - support setting zones to an empty list
(#3142 )
IMPROVEMENTS:
placement_properties (#2936 )
azurerm_storage_account - exposing primary/secondary _host attributes (#2792 )
BUG FIXES:
2018-06-01-preview (#2958 )
azurerm_application_gateway - updating the default value for
file_upload_limit_mb within the waf_configuration block to be 100 to match the
documentation (#3012 )
azurerm_batch_pool - updating max_tasks_per_node to be ForceNew (#2856 )
azurerm_key_vault_access_policy - no longer silenty fails on creation of the
key_vault_id property is invalid/doesn't exist (#2922 )
azurerm_policy_definition - making the metadata field to computed (#2939 )
azurerm_redis_firewall_rule - allowing underscores in the name field (#2906 )
azurerm_iothub - marking the connection_string property as sensitive (#3007 )
azurerm_iothub - ensuring the type property is alwaysa set (#3007 )
(#2874 )
azurerm_key_vault_secret - will no longer fail to find the Key Vault if key_vault_id
is (#2874 )
azurerm_storage_container - support for large numbers of containers within a
The v1.22 release includes a few new resources which are duplicates of existing
resources, the purpose of this is to correct some invalid naming so that we can
remove the mis-named resources in the next major version of the Provider. Please
see the upgrade guide for more information on how to migrate between these
resources.
The azurerm_builtin_role_definition Data Source has been deprecated in favour
of the azurerm_role_definition Data Source, which now provides the same
functionality and will be removed in the next major version of the AzureRM
Provider (2.0) (#2798 )
The azurerm_log_analytics_workspace_linked_service resource has been
deprecated in favour of the (new) azurerm_log_analytics_linked_service resource
and will be removed in the next major version of the AzureRM Provider (2.0)
(#2768 )
The azurerm_autoscale_setting resource has been deprecated in favour of the
(new) azurerm_monitor_autoscale_setting resource and will be removed in the
next major version of the AzureRM Provider (2.0) (#2768 )
The azurerm_metric_alertrule resource has been deprecated in favour of the
(new) azurerm_monitor_metric_alertrule resource and will be removed in the next
major version of the AzureRM Provider (2.0) (#2762 )
FEATURES:
DEPRECATIONS:
key_vault_id (#2820 )
azurerm_application_gateway - deprecating the fqdn_list field in favour of fqdns
(#2768 )
azurerm_application_gateway - deprecating the ip_address_list field in favour of
ip_addresses (#2768 )
azurerm_builtin_role_definition - deprecating in favour of the
azurerm_role_definition data source, which now provides the same functionality
(#2798 )
azurerm_log_analytics_workspace_linked_service - deprecating in favour of the
(#2789 )
IMPROVEMENTS:
(#2666 )
azurerm_application_gateway - support for the custom_error_configuration
property (#2783 )
azurerm_application_gateway - Support for pick_host_name_from_backend_address
(#2633 )
azurerm_function_app - support for linux via the linux_fx_version property
(#2767 )
azurerm_mssql_elasticpool - support for setting max_size_bytes (#2346 )
azurerm_mssql_elasticpool - support for setting max_size_gb (#2695 )
azurerm_postgresql_server - support for version 10 and 10.2 (#2768 )
azurerm_kubernetes_cluster - add addtional validation (#2772 )
azurerm_signalr_service - exporting primary_access_key , secondary_access_key ,
primary_connection_string and secondary_connection_string and secondary
BUG FIXES:
(#2729 )
azurerm_batch_pool - can now set multiple environment variables (#2685 )
azurerm_cosmosdb_account - prevent occasional error when deleting the resource
(#2702 )
azurerm_cosmosdb_account - allow empty values for the ip_range_filter property
(#2713 )
azurerm_express_route_circuit - added the premium SKU back to validation logic
(#2692 )
azurerm_firewall - ensuring rules aren't removed during an update (#2663 )
azurerm_notification_hub_namespace - now polls on creation to handle eventual
consistency (#2701 )
azurerm_redis_cache - locking on the Virtual Network/Subnet name to avoid a
update (#2738 )
IMPROVEMENTS:
config: support for specifying the partner_id for partner resource attribution
(#2643 )
dependencies: updating to v24.0.0 of Azure/azure-sdk-for-go (#2572 )
dependencies: upgrading the network SDK to 2018-08-01 (#2433 )
Data Source: azurerm_app_service - exporting the possible_outbound_ip_addresses
(#2513 )
Data Source: azurerm_azuread_application - deprecating in favour of the split-out
AzureAD Provider (#2632 )
Data Source: azurerm_azuread_service_principal - deprecating in favour of the
split-out AzureAD Provider (#2632 )
Data Source: azurerm_container_registry - now exports tags (#2607 )
Data Source: azurerm_network_interface - now exports
ip_configuration.private_ip_address_version (#2646 )
Data Source: azurerm_public_ip - now exports location , sku , allocation_method ,
reverse_fqdn and zones (#2576 )
azurerm_app_service - exporting the possible_outbound_ip_addresses (#2513 )
azurerm_azuread_application - deprecating in favour of the split-out AzureAD
Provider (#2632 )
azurerm_azuread_service_principal - deprecating in favour of the split-out
(#2433 )
azurerm_kubernetes_cluster - support for Virtual Nodes (#2641 )
azurerm_kubernetes_cluster - the dns_prefix now forces a new resource and is
(#2620 )
azurerm_policy_definition - polices can now be assigned to a management group
(#2490 )
azurerm_policy_set_definition - policy sets can now be assigned to a
(#2544 )
azurerm_service_fabric_cluster - support for reverse_proxy_endpoint_port
(#2544 )
azurerm_subnet - support for delegation (#2042 )
BUG FIXES:
(#2609 )
azurerm_network_security_rule - the properties
source_application_security_group_ids and
(#2558 )
azurerm_role_assignment - retrieving the role definition name during import
(#2565 )
azurerm_template_deployment - fixing regression and supportting nested template
deployments (#2514 )
1.20.0 (December 12, 2018)
FEATURES:
IMPROVEMENTS:
(#2442 )
azurerm_app_service_slot - support for configuring app_command_line in the
(#2446 )
azurerm_postgresql_server support for new skus GP_Gen5_64 and MO_Gen5_32 -
(#2447 )
BUG FIXES:
ID (#2374 )
azurerm_mssql_elasticpool - relaxed validation of the name property (#2398 )
azurerm_recovery_services_protection_policy_vm - added the timezone property
(#2404 )
azurerm_route_table - validation updated to prevent empty and blank property
IMPROVEMENTS:
(#2268 )
azurerm_kubernetes_cluster - support for role_based_access_control (#1820 )
azurerm_network_interface - deprecating internal_fqdn since it's no longer
(#2226 )
azurerm_virtual_network_gateway - support for Zone Redundant Gateways
(#2260 )
BUG FIXES:
addresses (#2222 )
azurerm_public_ip - fixing the casing of the ip_version /
public_ip_address_allocation fields (#2296 )
azurerm_recovery_services_protected_vm - VM can now be in a different resource
(#2204 )
azurerm_route - allowing setting next_hop_in_ip_address to an empty value
(#2184 )
azurerm_route_table - allowing setting next_hop_in_ip_address to an empty value
(#2184 )
azurerm_virtual_network_gateway - plan is now empty when bgp_settings is
omitted (#2304 )
azurerm_virtual_network - add valdiation to prevent panics (#2305 )
IMPROVEMENTS:
property (#2109 )
azurerm_eventhub_namespace - allow maximum_throughput_units to be zero
(#2124 )
azurerm_key_vault_certificate - support for setting extended_key_usage
(#2128 )
azurerm_key_vault_certificate - support for setting subject_alternative_names
(#2123 )
azurerm_managed_disk - support for the UltraSSD_LRS storage account type
(#2118 )
azurerm_monitor_activity_log_alert - support the criteria fields
resource_provider , resource_type , resource_group (#2150 )
azurerm_recovery_services_protected_vm - backup_policy_id is now required
(#2154 )
azurerm_sql_database - adding validation to requested_service_objective_name
(#2125 )
azurerm_virtual_network_gateway - support for OpenVPN as a client protocol option
(#2126 )
azurerm_virtual_machine_scale_set - support for the
BUG FIXES:
security: removing the Authorization header from the debug logs (#2131 )
azurerm_api_management - validating the Key Vault Secret ID for the key_vault_id
deletion (#2111 )
azurerm_kubernetes_cluster - changing os_disk_size_gb to computed as the API
(#2122 )
azurerm_virtual_machine - making availability_set_id conflict with zones
(#2185 )
FEATURES:
n (#2079 )
New Resource: azurerm_network_interface_backend_address_pool_association
(#2079 )
New Resource: azurerm_network_interface_nat_rule_association (#2079 )
New Resource: azurerm_recovery_services_protection_policy_vm (#1978 )
New Resource: azurerm_recovery_services_protected_vm (#1637 )
New Resource: azurerm_security_center_contact (#2045 )
New Resource: azurerm_security_center_subscription_pricing (#2043 )
New Resource: azurerm_security_center_workspace (#2072 )
New Resource: azurerm_subnet_network_security_group_association (#1933 )
New Resource: azurerm_subnet_route_table_association (#1933 )
BUG FIXES:
Data Source azurerm_subnet - fixing the ordering of the resource group name and
network name in the error message (#2017 )
azurerm_kubernetes_cluster - using the correct casing for the addon_profile
IMPROVEMENTS:
tiers (#2015 )
azurerm_container_group - adding the secure_environment_variables property
(#2024 )
azurerm_dev_test_virtual_network - support for managing the Subnet (#2041 )
azurerm_key_vault - support for Virtual Network Rules (#2027 )
azurerm_kubernetes_cluster - changing the oms_agent property no longer forces a
ignore_missing_vnet_service_endpoint (#2056 )
azurerm_public_ip - support for IPv6 addresses (#2019 )
azurerm_search_service - adding the administrative primary_key and
FEATURES:
IMPROVEMENTS:
BUG FIXES:
Data Source azurerm_builtin_role_definition : support for data_actions and
not_data_actions (#2000 )
azurerm_app_service_plan - exposing additional information on failure (#1926 )
azurerm_app_service_custom_hostname_binding - handling multiple bindings being
property (#1925 )
azurerm_role_assignment - only retry on errors when they are retryable (#1934 )
azurerm_role_definition - support for the data_actions and not_data_action
blocks (#1971 )
azurerm_service_fabric_cluster - allow two client_certificate_thumbprint
blocks (#1938 )
azurerm_service_fabric_cluster - support for specifying the
IMPROVEMENTS:
(#1898 )
azurerm_virtual_machine - support for the managed_disk_type of StandardSSD_LRS
(#1901 )
azurerm_virtual_machine_scale_set - support for the managed_disk_type of
StandardSSD_LRS (#1901 )
azurerm_virtual_network_gateway - additional validation (#1899 )
BUG FIXES:
and {} s (#1918 )
azurerm_role_assignment - parsing the Resource ID during deletion (#1887 )
azurerm_role_definition - parsing the Resource ID during deletion (#1887 )
azurerm_servicebus_namespace - polling for the deletion of the namespace
(#1908 )
IMPROVEMENTS:
BUG FIXES:
(#1856 )
azurerm_eventhub - updating the validation to support periods, hyphens and
underscores (#1795 )
azurerm_eventhub_authorization_rule - updating the validation error (#1795 )
azurerm_eventhub_consumer_group - updating the validation to support periods,
than the entire instance view of the Virtual Machine to work around an issue in the
API (#1855 )
IMPROVEMENTS:
field (#1740 )
azurerm_iothub - support for the Basic SKU (#1717 )
azurerm_kubernetes_cluster - support for max_pods within the agent_pool_profile
block (#1753 )
azurerm_kubernetes_cluster - support for the add_on_profile block (#1751 )
azurerm_kubernetes_cluster - validation for when pod_cidr is set with a
network_plugin set to azure (#1763 )
azurerm_kubernetes_cluster - client_id and client_secret in the
BUG FIXES:
Create API which working around a breaking change in the API (#1769 )
azurerm_autoscale_setting - filtering out the $tags tag (#1770 )
azurerm_eventhub - allowing underscores in the name field (#1768 )
azurerm_eventhub_authorization_rule - allowing underscores in the name field
(#1768 )
azurerm_eventhub_consumer_group - allowing underscores in the name field
(#1768 )
Please Note: When upgrading to v1.12.0 of the Azure Provider, you may need to
specify the priority of any VM Scale Sets created between v1.6 of the Provider
and v1.12. (#1586 )
FEATURES:
IMPROVEMENTS:
(#1479 )
azurerm_kubernetes_cluster - outputting the node_resource_group field (#1649 )
azurerm_role_assignment - retrying resource creation to match the Azure CLI's
behaviour (#1647 )
azurerm_virtual_machine - setting the connection information for Provisioners
(#1646 )
BUG FIXES:
IMPROVEMENTS:
(#1601 )
azurerm_app_service_slot - support for min_tls_version in the site_config block
(#1601 )
azurerm_data_lake_store - support for enabling/disabling encryption (#1623 )
azurerm_data_lake_store - support for managing the firewall state (#1623 )
BUG FIXES:
(#1640 )
IMPROVEMENTS:
(#1577 )
azurerm_app_service - support for running containers (#1578 )
azurerm_app_service_slot - support for Managed Service Identity (#1579 )
azurerm_app_service_slot - Slots can now be updated in-place (#1436 )
azurerm_container_group - support for images hosted in a private registry
(#1529 )
azurerm_function_app - adding support for the site_credential block (#1567 )
azurerm_function_app - only setting WEBSITE_CONTENTSHARE and
BUG FIXES:
other (#1563 )
azurerm_lb - allow subnet_id to be set to an empty value (#1588 )
azurerm_servicebus_subscription - only sending correlation_filter values if
(#1568 )
azurerm_snapshot - allowing dashes in the name field (#1574 )
azurerm_traffic_manager_endpoint - working around a bug in the API by setting
IMPROVEMENTS:
(#1510 )
azurerm_cdn_profile - support for Standard_ChinaCdn and Standard_Microsoft
SKU's (#1465 )
azurerm_cosmosdb_account - checking to see if the name is in use before creating
(#1464 )
azurerm_cosmosdb_account - fixing the validation on the ip_range_filter field
(#1463 )
azurerm_dns_zone - support for Private DNS Zones (#1404 )
azurerm_image - change os_disk property to a list and add additional property
validation (#1443 )
azurerm_lb - allow private_ip_address to be set to an empty value (#1481 )
azurerm_mysql_server - changing the storage_mb property no longer forces a new
resource (#1532 )
azurerm_postgresql_server - changing the storage_mb property no longer forces a
(#1471 )
azurerm_virtual_machine_data_disk_attachment - adding support for
write_accelerator_enabled (#1473 )
azurerm_virtual_machine_scale_set - ensuring we set the vhd_containers field to
identities (#1448 )
azurerm_virtual_machine_scale_set - making the content field in the
(#1471 )
azurerm_virtual_network_gateway - adding support for the radius_server_address ,
radius_server_secret and vpn_client_protocols fields to the Data Source
(#1505 )
BUG FIXES:
azurerm_key_vault_key - handling the parent Key Vault being deleted (#1535 )
azurerm_sql_database - fix requested_service_objective_name updates (#1503 )
azurerm_storage_account - limiting the tags field to 128 characters to match the
service (#1524 )
azurerm_virtual_network_gateway - fix azurerm_virtual_network_gateway crashing
IMPROVEMENTS:
(#1265 )
BUG FIXES:
BUG FIXES:
default (#1380 )
azurerm_servicebus_namespace - the capacity propety no longer unnecessarily
default (#1322 )
azurerm_app_service_plan - the name property validation now allows understores
(#1351 )
IMPROVEMENTS:
(#991 )
azurerm_function_app - adding the identity property (#1369 )
azurerm_role_definition - the role_definition_id property is now optional. The
property (#1209 )
azurerm_virtual_machine_scale_set - adding the ip_forwarding property
(#1209 )
azurerm_virtual_network_gateway - adding the properties vpn_client_protocols ,
radius_server_address and radius_server_secret (#946 )
dependencies: migrating to the un-deprecated Preview's for Container Instance,
EventGrid, Log Analytics and SQL (#1322 )
dependencies: upgrading to 2018-01-01 of the EventGrid API (#1322 )
dependencies: upgrading to 2018-03-01 of the Monitor API (#1322 )
~> Please Note: The azurerm_mysql_server resource has been updated from the
Preview API's to the GA API's - which requires code changes in your Terraform
Configuration to use the new Pricing SKU's. Upon updating to v1.6.0 - you'll need to
update the configuration from the Preview SKU's to the GA SKU's.
~> Please Note: The azurerm_postgresql_server resource has been updated from the
Preview API's to the GA API's - which requires code changes in your Terraform
Configuration to use the new Pricing SKU's. Upon updating to v1.6.0 - you'll need to
update the configuration from the Preview SKU's to the GA SKU's.
FEATURES:
BUG FIXES:
(#5107 )
azurerm_app_service_plan - adding validation to import (#5107 )
azurerm_app_service_slot - adding validation to import (#5107 )
azurerm_app_service_source_control_token - adding validation to import
(#5107 )
~> Please Note: Prior to v1.5 Data Sources in the AzureRM Provider returned nil rather
than an error message when a Resource didn't exist, which was a bug. In order to bring
this into line with other Providers - starting in v1.5 the AzureRM Provider will return an
error message when a resource doesn't exist.
~> Please Note: This release fixes a bug in the azurerm_redis_cache resource where
changes to fields weren't detected; as such you may see changes in the
redis_configuration block, particularly with the rdb_storage_connection_string field.
There's a bug tracking this inconsistency in the Azure Rest API Specs Repository .
FEATURES:
BUG FIXES:
detected - please see the note above for more information (#1211 )
IMPROVEMENTS:
(#1194 )
azurerm_key_vault_certificate - exposing the certificate_data (#1200 )
azurerm_kubernetes_cluster - making kube_config_raw a sensitive field (#1225 )
azurerm_redis_cache - Redis Caches can now be Imported (#1211 )
azurerm_redis_firewall_rule - Redis Firewall Rules can now be Imported
(#1211 )
azurerm_virtual_network - guarding against nil-objects in the response (#1208 )
azurerm_virtual_network_gateway - ignoring the case of the GatewaySubnet
(#1141 )
FEATURES:
IMPROVEMENTS:
(#1055 )
azurerm_cosmosdb_account - prefixes can now be configured for locations
(#1055 )
azurerm_function_app - support for updating in-place (#1125 )
azurerm_key_vault - adding cert permissions for Purge and Recover (#1132 )
azurerm_key_vault - polling to ensure the Key Vault is resolvable via DNS
(#1081 ] [#1164 )
azurerm_kubernetes_cluster - only setting the Subnet ID when it's not an empty
string (#1158 )
azurerm_kubernetes_cluster - exposing the clusters credentials as kube_config
(#953 )
azurerm_metric_alertrule - filtering out tags prefixed with $type (#1107 )
azurerm_virtual_machine - loading managed disk information from Azure when
IMPROVEMENTS:
(#1096 )
azurerm_redis_cache - support for clusters on the internal network (#1086 )
azurerm_servicebus_queue - support for setting requires_session (#1111 )
azurerm_sql_database - changes to collation force a new resource (#1066 )
IMPROVEMENTS:
IMPROVEMENTS:
(#1027 )
azurerm_traffic_manager_endpoint - adding support for geo_mappings (#986 )
azurerm_traffic_manager_profile - adding support for the
resource (#1040 )
BUG FIXES:
azurerm_application_gateway - fixes a crash where ssl_policy isn't returned from
resources (#982 )
IMPROVEMENTS:
(#967 )
azurerm_function_app - adding client_affinity_enabled ,
use_32_bit_worker_process and websockets_enabled (#886 )
azurerm_load_balancer - adding support for Availability Zones (#811 )
azurerm_managed_disk - adding support for Availability Zones (#811 )
azurerm_network_interface - setting internal_fqdn if it's not nil (#977 )
azurerm_network_security_group - support for security rules including Application
parameters_body (#404 )
azurerm_virtual_machine - adding support for Availability Zones (#811 )
azurerm_virtual_machine_scale_set - adding support for Availability Zones
(#811 )
BUG FIXES:
IMPROVEMENTS:
(#911 )
azurerm_network_security_group - support for augmented security rules (#781 )
azurerm_servicebus_subscription - added support for the forward_to property
(#861 )
azurerm_storage_account - adding support for account_kind being StorageV2
(#851 )
azurerm_virtual_network_gateway_connection - support for IPsec/IKE Policies
(#834 )
BUG FIXES:
IMPROVEMENTS:
authentication: pulling the Environment key from the Azure CLI Config (#842 )
core: upgrading to v12.5.0-beta of the Azure SDK for Go (#830 )
compute: upgrading to use the 2017-12-01 API Version (#797 )
azurerm_app_service_plan : support for attaching to an App Service Environment
(#850 )
azurerm_container_group - adding restart_policy (#827 )
azurerm_managed_disk - updated the validation on disk_size_gb / made it
computed (#800 )
azurerm_role_assignment - add role_definition_name (#775 )
azurerm_subnet - add support for Service Endpoints (#786 )
azurerm_virtual_machine - changing managed_disk_id and create_option to be
(#772 )
azurerm_virtual_machine - ignores the case of the Managed Data Disk ID's to work
FEATURES:
FEATURES:
IMPROVEMENTS:
fields (#695 )
azurerm_image - add support for filtering images by a regex on the name (#642 )
azurerm_lb - adding support for the Standard SKU (in Preview) (#665 )
azurerm_public_ip - adding support for the Standard SKU (in Preview) (#665 )
azurerm_network_security_rule - add support for augmented security rules
(#692 )
azurerm_role_assignment - generating a name if one isn't specified (#685 )
azurerm_traffic_manager_profile - adding support for setting protocol to TCP
(#742 )
IMPROVEMENTS:
(#641 )
azurerm_lb - adding the computed field public_ip_addresses (#633 )
azurerm_local_network_gateway - add support for tags (#638 )
azurerm_network_interface - support for Accelerated Networking (#672 )
azurerm_storage_account - expose primary_connection_string and
secondary_connection_string (#647 )
IMPROVEMENTS:
authentication - add support for the latest Azure CLI configuration (#573 )
authentication - conditional loading of the Subscription ID / Tenant ID /
Environment (#574 )
core - appending additions to the User Agent, so we don't overwrite the Go SDK
User Agent info (#587 )
core - Upgrading Azure/azure-sdk-for-go to v11.2.2-beta (#594 )
core - upgrading Azure/go-autorest to v9.5.2 (#617 )
core - skipping Resource Provider Registration in AutoRest when opted-out
(#630 )
azurerm_app_service - exposing the Default Hostname as a Computed field
For information on changes prior to the v1.0.0 release, please see the v0.x changelog .
authentication: allow using multiple subscriptions for Azure CLI auth (#445 )
core: appending the CloudShell version to the user agent when running within
CloudShell (#483 )
azurerm_app_service / azurerm_app_service_plan - adding validation for the name
fields (#528 )
azurerm_container_registry - Migration: Fixing a crash when the storage_account
label (#485 )
azurerm_network_security_group - fixing a crash when changes were made outside
of Terraform (#492 )
azurerm_redis_cache : support for Patch Schedules (#540 )
azurerm_virtual_machine - ensuring vhd_uri is validated (#470 )
azurerm_virtual_machine_scale_set : fixing a crash where accelerated networking
IMPROVEMENTS:
secret_permissions have all had the All option removed by Azure. Each
SKU's
azurerm_servicebus_queue - The enable_batched_operations and support_ordering
FEATURES:
IMPROVEMENTS:
auth (#393 )
azurerm_container_group - add support for volume mounts (#366 )
azurerm_key_vault - fix a crash when no certificate_permissions are defined
(#374 )
azurerm_key_vault - waiting for the DNS to propagate (#401 )
azurerm_managed_disk - support for creating Managed Disks from Platform Images
(#405 )
azurerm_route_table - removing routes when none are specified (#403 )
azurerm_route_table - refactoring route from a Set to a List (#402 )
azurerm_route - refactoring route from a Set to a List (#402 )
azurerm_storage_account - support for File Encryption (#363 )
azurerm_storage_account - support for Custom Domain (#363 )
azurerm_storage_account - splitting the storage account Tier and Replication out
Tables (#411 )
azurerm_virtual_machine - fixing a bug where
(#378 )
IMPROVEMENTS:
IMPROVEMENTS:
(#348 )
BUG FIXES:
block (#266 )
IMPROVEMENTS:
attribute (#330 )
IMPROVEMENTS:
MongoDB/GlobalDocumentDB (#299 )
IMPROVEMENTS:
(#189 )
azurerm_sql_server - making administrator_login ForceNew (#189 )
azurerm_sql_server - migrate to using the azure-sdk-for-go (#189 )
azurerm_virtual_machine - Force recreation if storage_data_disk . create_option
changes (#240 )
azurerm_virtual_machine_scale_set - Fix address issue when setting the winrm
block (#271 )
updating to v10.3.0-beta of the Azure SDK for Go (#258 )
Removing the (now unused) Riviera SDK (#289 ] [#291 )
BUG FIXES:
(#212 )
azurerm_virtual_machine_scale_set - support for custom images and managed
disks (#203 )
BUG FIXES:
(#211 )
azurerm_virtual_machine - fixes a crash caused by an empty
IMPROVEMENTS:
(#150 )
azurerm_storage_account - Added support for Require secure transfer (#167 )
azurerm_storage_table - updating the name validation (#143 )
azurerm_virtual_machine - making admin_password optional for Linux VM's
(#154 )
azurerm_virtual_machine_scale_set - adding a plan block for Marketplace images
(#161 )
IMPROVEMENTS:
Ensuring consistency in when storing the location field in the state for the
azurerm_availability_set , azurerm_express_route_circuit ,
azurerm_load_balancer , azurerm_local_network_gateway , azurerm_managed_disk ,
(#130 )
azurerm_storage_account - exposing a formatted Connection String for Blob access
(#142 )
BUG FIXES:
(#128 )
azurerm_network_security_rule : network_security_group_name is now ForceNew
(#138 )
azurerm_subnet now correctly detects changes to Network Securtiy Groups and
optional (#129 )
FEATURES:
IMPROVEMENTS:
Feedback
Was this page helpful? Yes No
When deploying Azure resources with an Infrastructure as Code tool, you need to
understand what resource types are available, and what values to use in your files. The
Azure resource reference documentation provides these values. The syntax is shown for
Bicep, ARM template JSON, and Terraform AzAPI provider.
Choose language
Select the deployment language you wish to use for viewing the resource reference. The
options are available at the top of each article.
Bicep
For an introduction to working with Bicep files, see Quickstart: Create Bicep files with
Visual Studio Code. To learn about the sections of a Bicep file, see Understand the
structure and syntax of Bicep files.
To learn about Bicep files through a guided set of Learn modules, see Deploy and
manage resources in Azure by using Bicep.
Microsoft recommends that you use VS Code to create Bicep files. For more information,
see Install Bicep tools.
ARM templates
Tip
Bicep is a new language that offers the same capabilities as ARM templates but
with a syntax that's easier to use. If you're deciding between the two languages, we
recommend Bicep.
To learn about the sections of an ARM template, see Understand the structure and
syntax of ARM templates. For an introduction to working with templates, see Tutorial:
Create and deploy your first ARM template.
Microsoft recommends that you use VS Code to create ARM templates. When you add
the Azure Resource Managed tools extension, you get intellisense for the template
properties. For more information, see Quickstart: Create ARM templates with Visual
Studio Code.
For an introduction to creating a configuration file for the Terraform AzAPI provider, see
Quickstart: Deploy your first Azure resource with the AzAPI Terraform provider.
Find resources
If you know the resource type, you can go directly to it with the following URL format:
https://learn.microsoft.com/azure/templates/{provider-namespace}/{resource-type} .
The resource types are located under the Reference node. Expand the resource provider
that contains the type you are looking for. The following image shows the types for
Storage.
Or, you can filter the resource types in navigation pane: