0% found this document useful (0 votes)
2 views

Azure Developer Terraform

The document provides comprehensive guidance on using Terraform for provisioning Azure infrastructure, detailing the setup process, benefits, and various Terraform providers available for Azure. It covers key concepts, quickstart guides, and how-to instructions for managing resources like virtual machines and Kubernetes clusters. Additionally, it introduces the AzAPI provider for managing Azure resources and offers steps for configuring Terraform in different environments.

Uploaded by

faavend2815
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Azure Developer Terraform

The document provides comprehensive guidance on using Terraform for provisioning Azure infrastructure, detailing the setup process, benefits, and various Terraform providers available for Azure. It covers key concepts, quickstart guides, and how-to instructions for managing resources like virtual machines and Kubernetes clusters. Additionally, it introduces the AzAPI provider for managing Azure resources and offers steps for configuring Terraform in different environments.

Uploaded by

faavend2815
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1302

Tell us about your PDF experience.

Terraform on Azure documentation


Learn how to use Terraform to reliably provision virtual machines and other
infrastructure on Azure.

Getting started

e OVERVIEW

About Terraform on Azure

Terraform AzAPI provider

i REFERENCE

AzureRM provider versions

Y ARCHITECTURE

Terraform Azure Provider

p CONCEPT

Comparing features of Terraform and Bicep

b GET STARTED

Install and configure Terraform

Install the Azure Terraform Visual Studio Code extension

Authenticate Terraform to Azure

Store Terraform state in Azure Storage

Azure Export for Terraform

e OVERVIEW

Azure Export for Terraform overview

p CONCEPT
Azure Export for Terraform concepts

f QUICKSTART

Export your first resources

Export resources to HCL code

c HOW-TO GUIDE

Select custom resources

Advanced scenarios

Popular Terraform Azure service articles

f QUICKSTART

Create an Azure resource group using Terraform

Create an AKS cluster

Create a Linux VM

Create a Windows VM

Create an Azure key vault and key using Terraform

Direct web traffic with Azure Application Gateway - Terraform

Create a single database in Azure SQL Database using Terraform

Create an Azure API Management service using Terraform

Create an Azure Front Door Standard/Premium profile using Terraform

Create an Azure Container Instance with a public IP address using Terraform

Networking

f QUICKSTART

Deploy with IP Groups - Terraform

Deploy with multiple addresses - Terraform

Deploy with Availability Zones - Terraform


Create a NAT Gateway

Create a private endpoint

Manage infrastructure

f QUICKSTART

Create a Linux VM

Create a Linux VM cluster

Create a Windows VM

Create a Windows VM cluster

c HOW-TO GUIDE

Provision VM scale set with infrastructure

Provision VM scale set from a Packer custom image

Work with Containers (AKS, Application Gateway, ...)

f QUICKSTART

Create an AKS cluster

Create an ACI instance with a public IP address

Deploy Azure Application Gateway v2

c HOW-TO GUIDE

Create an Application Gateway ingress controller in AKS


Overview of Terraform on Azure - What
is Terraform?
Article • 02/05/2024

Hashicorp Terraform is an open-source IaC (Infrastructure-as-Code) tool for


configuring and deploying cloud infrastructure. It codifies infrastructure in configuration
files that describe the desired state for your topology. Terraform enables the
management of any infrastructure - such as public clouds, private clouds, and SaaS
services - by using Terraform providers .

Terraform providers for Azure infrastructure


There are several Terraform providers that enable the management of Azure
infrastructure:

AzureRM : Manage stable Azure resources and functionality such as virtual


machines, storage accounts, and networking interfaces.
AzureAD : Manage Microsoft Entra resources such as groups, users, service
principals, and applications.
AzureDevops : Manage Azure DevOps resources such as agents, repositories,
projects, pipelines, and queries.
AzAPI : Manage Azure resources and functionality using the Azure Resource
Manager APIs directly. This provider compliments the AzureRM provider by
enabling the management of Azure resources that aren't released. For more
information about the AzAPI provider, see Terraform AzAPI provider.
AzureStack : Manage Azure Stack Hub resources such as virtual machines, DNS,
virtual networks, and storage.

Benefits of Terraform with Azure


This section describes the benefits of using Terraform to manage Azure infrastructure.

Common IaC tool


Terraform Azure providers enable you to manage all of your Azure infrastructure using
the same declarative syntax and tooling. Using these providers you can:

1. Configure core platform capabilities such as management groups, policies, users,


groups, and policies. For more information, see Terraform implementation of Cloud
Adoption Framework Enterprise-scale .
2. Configure Azure DevOps projects and pipelines to automate regular infrastructure
and application deployments.
3. Deploy Azure resources required by your applications.

Automate infrastructure management


The Terraform template-based configuration file syntax enables you to configure Azure
resources in a repeatable and predictable manner. Automating infrastructure includes
the following benefits:

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.

Understand infrastructure changes before being applied


As a resource topology becomes complex, understanding the meaning and impact of
infrastructure changes can be difficult.

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:

Team members can collaborate more effectively by understanding proposed


changes and their impact.
Unintended changes can be caught early in the development process.

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

Resource Name Description

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.

Resource configuration examples


The following code snippet configures a resource that doesn't currently exist in the
AzureRM provider:

Terraform

resource "azapi_resource" "publicip" {


type = "Microsoft.Network/Customipprefixes@2021-03-01"
name = "exfullrange"
parent_id = azurerm_resource_group.example.id
location = "westus2"
body = jsonencode({
properties = {
cidr = "10.0.0.0/24"
signedMessage = "Sample Message for WAN"
}
})
}

The following code snippet configures a preview property for an existing resource from
AzureRM:

Terraform

resource "azapi_update_resource" "test" {


type = "Microsoft.ContainerRegistry/registries@2020-11-01-preview"
resource_id = azurerm_container_registry.acr.id

body = jsonencode({
properties = {
anonymousPullEnabled = var.bool_anonymous_pull
}
})
}

Authentication using the AzAPI provider


The AzAPI provider enables the same authentication methods as the AzureRM provider.
For more information on authentication options, see Authenticate Terraform to Azure.

Benefits of using the AzAPI provider


The AzAPI provider features the following benefits:

Supports all Azure services:


Private preview services and features
Public preview services and features
All API versions
Full Terraform state file fidelity
Properties and values are saved to state
No dependency on Swagger
Common and consistent Azure authentication

Experience and lifecycle of the AzAPI provider


This section describes some tools to help you use the AzAPI provider.

VS Code extension and Language Server


The AzAPI VS Code extension provides a rich authoring experience with the following
benefits:

List all available resource types and API versions.

Auto-completion of the allowed properties and values for any resource.

Show hints when hovering over a property.


Syntax validation

Auto-completion with code samples.

AzAPI2AzureRM migration tool


The AzureRM provider provides the most integrated Terraform experience for managing
Azure resources. Therefore, the recommended usage of the AzAPI and AzureRM
providers is as follows:

1. While the service or feature is in preview, use the AzAPI provider.


2. once the service is officially released, use the AzureRM provider.

The AzAPI2AzureRM tool is designed to help migrate from the AzAPI provider to the
AzureRM provider.

AzAPI2AzureRM is an open-source tool that automates the process of converting AzAPI


resources to AzureRM resources.

AzAPI2AzureRM has two modes: plan and migrate:

Plan displays the AzAPI resources that can be migrated.


Migrate migrates the AzAPI resources to AzureRM resources in both the HCL files
and the state.

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.

Using the AzAPI provider


1. Install VS Code extension

2. Add the AzAPI provider to your Terraform configuration.

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

resource "azapi_resource" "example" {


name = "example"
parent_id = data.azurerm_machine_learning_workspace.existing.id
type = "Microsoft.MachineLearningServices/workspaces/computes@2021-
07-01"

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

Provide product feedback | Get help at Microsoft Q&A


Quickstart: Install and Configure
Terraform
Article • 06/13/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

Configure in Azure Cloud Shell with Bash


Configure in Azure Cloud Shell with PowerShell
Configure in Windows with Bash
Configure in Windows with PowerShell

Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.

Configure in Azure Cloud Shell with Bash


Azure Cloud Shell includes Terraform and automatically updates to the latest version of
Terraform. However, the updates come within a couple of weeks of release. The
following article shows you how to download and install the current version of Terraform
using Bash within the Cloud Shell environment.

Configure Terraform in Azure Cloud Shell with Bash

Configure in Azure Cloud Shell with PowerShell


Azure Cloud Shell includes Terraform and automatically updates to the latest version of
Terraform. However, the updates come within a couple of weeks of release. The
following article shows you how to download and install the current version of Terraform
using PowerShell within the Cloud Shell environment.

Configure Terraform in Azure Cloud Shell with PowerShell


Configure in Windows with Bash
The following article shows you how to install and test Terraform in Windows using a
Bash emulator.

Configure Terraform in Windows with Bash

Configure in Windows with PowerShell


The following article shows you how to install and test Terraform in Windows using
PowerShell.

Configure Terraform in Windows with PowerShell

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Create Azure resource group
Install the Azure Terraform Visual Studio
Code extension
Article • 05/10/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Install the Azure Terraform Visual Studio Code extension


" Use the extension to create an Azure resource group
" Verify the resource group was created
" Delete the resource group when finished testing using the extension

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

Install Node.js .

2. Install the Azure Terraform Visual Studio


Code extension
1. Launch Visual Studio Code.
2. From the left menu, select Extensions, and enter Azure Terraform in the search
text box.

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.

3. Implement the Terraform code


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"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


location = var.resource_group_location
name = random_pet.rg_name.id
}

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
}

4. Push your code to Cloud Shell


1. From the View menu, select Command Palette....

2. In the Command Palette text box, start entering Azure Terraform: Push and select
it when it displays.

3. Select OK to confirm the opening of Cloud Shell.

Key points:

Your workspace files that meet the filter defined in the azureTerraform.files
setting in your configuration are copied to Cloud Shell.

5. Initialize Terraform within Visual Studio Code


1. From the View menu, select Command Palette....

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.

6. Create a Terraform execution plan within


Visual Studio Code
1. From the View menu, select Command Palette....
2. In the Command Palette text box, start entering Azure Terraform: Plan and select
it when it displays.

Key points:

This command runs terraform plan to create an execution plan from the
Terraform configuration files in the current directory.

7. Apply a Terraform execution plan within


Visual Studio Code
1. From the View menu, select Command Palette....

2. In the Command Palette text box, start entering Azure Terraform: Apply and select
it when it displays.

3. When prompted for confirmation, enter yes and press <Enter> .

8. Verify the results


Azure CLI

1. From the View menu, select Command Palette....

2. In the Command Palette text box, start entering Azure: Open Bash in Cloud
Shell and select it when it displays.

3. Run az group show to display the resource group. Replace the


<resource_group_name> placeholder with the randomly generated name of the
resource group displayed after applying the Terraform execution plan.

Azure CLI

az group show --name <resource_group_name>

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.

3. When prompted for confirmation, enter yes and press <Enter> .

4. To confirm that Terraform successfully destroyed your new resource group, run the
steps in the section, Verify the results.

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Read more about the Azure Terraform Visual Studio Code extension
Authenticate Terraform to Azure
Article • 06/20/2024

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" See a list of available authentication methods.


" Select select and authentication method.
" Verify that you're authenticated.

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

2. Authenticate Terraform to Azure


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 using the Azure CLI.

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

3. Verify the results


Verify that you've authenticated to the Azure subscription by displaying the current
subscription.

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

Provide product feedback | Get help at Microsoft Q&A


Create a Terraform base template in
Azure using Yeoman
Article • 03/20/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to do the following tasks:

" Create a base Terraform template using the Yeoman module generator.


" Test the Terraform template using two different methods.
" Run the Terraform module using a Docker file.
" Run the Terraform module natively in Azure Cloud Shell.

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

Visual Studio Code: Download Visual Studio Code for your platform.

Docker: Install Docker to run the module created by the Yeoman generator.

Go programming language: Install Go as Yeoman-generated test cases are code


using the Go language.
Nodejs: Install Node.js

Install Yeoman: Run the following command: npm install -g yo .

Yeoman template: Run the following command to install the Yeoman template for
Terraform module: npm install -g generator-az-terra-module .

2. Create directory for Yeoman-generated


module
The Yeoman template generates files in the current directory. For this reason, you need
to create a directory.

This empty directory is required to be put under $GOPATH/src. For more information
about this path, see the article Setting GOPATH .

1. Navigate to the parent directory from which to create a new directory.

2. Run the following command replacing the placeholder. For this example, a
directory name of GeneratorDocSample is used.

Bash

mkdir <new-directory-name>

3. Navigate to the new directory:

Bash

cd <new-directory-name>

3. Create base module template


1. Run the following command:

Bash

yo az-terra-module

2. Follow the on-screen instructions to provide the following information:

Terraform module project Name - A value of doc-sample-module is used for


the example.

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.

The following files were created by the Yeoman module generator:

main.tf - Defines a module called random-shuffle . The input is a string_list . The


output is the count of the permutations.
variables.tf - Defines the input and output variables used by the module.

outputs.tf - Defines what the module outputs. Here, it's the value returned by
random_shuffle , which is a built-in, Terraform module.

Rakefile - Defines the build steps. These steps include:


build - Validates the formatting of the main.tf file.

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.

For more information about the Yeoman generator for Azure


https://github.com/Azure/generator-az-terra-module , see the Terratest
documentation .

5. Test the Terraform module using a Docker


file
This section shows how to test a Terraform module using a Docker file.

7 Note

This example runs the module locally; not on Azure.

Confirm Docker is installed and running


From a command prompt, enter docker version .

The resulting output confirms that Docker is installed.

To confirm that Docker is actually running, enter docker info .


Set up a Docker container
1. From a command prompt, enter

docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID= --build-arg

BUILD_ARM_CLIENT_ID= --build-arg BUILD_ARM_CLIENT_SECRET= --build-arg


BUILD_ARM_TENANT_ID= -t terra-mod-example . .

The message Successfully built will be displayed.

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.

Build the module


1. Run the following command:

Bash

bundle install

2. Run the following command:

Bash

rake build

Run the end-to-end test


1. Run the following command:

Bash

rake e2e

2. After a few moments, the PASS message will appear.

3. Enter exit to complete the test and exit the Docker environment.

6. Use Yeoman generator to create and test a


module
In this section, the Yeoman generator is used to create and test a module in Cloud Shell.
Using Cloud Shell instead of using a Docker file greatly simplifies the process. Using
Cloud Shell, the following products are all pre-installed:

Node.js
Yeoman
Terraform

Start a Cloud Shell session


1. Start an Azure Cloud Shell session via either the Azure portal , shell.azure.com ,
or the Azure mobile app .

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>

5. Navigate to your module directory:

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

2. Run the following command to install the dependencies:

Bash

bundle install

3. Run the following command to build the module:

Bash

rake build

4. Run the following command to run the test:

Bash

rake e2e

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Install and use the Azure Terraform Visual Studio Code extension .
Store Terraform state in Azure Storage
Article • 05/08/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

Terraform state is used to reconcile deployed resources with Terraform configurations.


State allows Terraform to know what Azure resources to add, update, or delete.

By default, Terraform state is stored locally, which isn't ideal for the following reasons:

Local state doesn't work well in a team or collaborative environment.


Terraform state can include sensitive information.
Storing state locally increases the chance of inadvertent deletion.

In this article, you learn how to:

" Create an Azure storage account


" Use Azure storage to store remote Terraform state.
" Understand state locking
" Understand encryption at rest

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

2. Configure remote state storage account


Before you use Azure Storage as a backend, you must create a storage account.

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

# Create resource group


az group create --name $RESOURCE_GROUP_NAME --location eastus

# Create storage account


az storage account create --resource-group $RESOURCE_GROUP_NAME --name
$STORAGE_ACCOUNT_NAME --sku Standard_LRS --encryption-services blob

# Create blob container


az storage container create --name $CONTAINER_NAME --account-name
$STORAGE_ACCOUNT_NAME

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.

3. Configure terraform backend state


To configure the backend state, you need the following Azure storage information:
storage_account_name: The name of the Azure Storage account.
container_name: The name of the blob container.
key: The name of the state store file to be created.
access_key: The storage access key.

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

ACCOUNT_KEY=$(az storage account keys list --resource-group


$RESOURCE_GROUP_NAME --account-name $STORAGE_ACCOUNT_NAME --query
'[0].value' -o tsv)
export ARM_ACCESS_KEY=$ACCOUNT_KEY

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

export ARM_ACCESS_KEY=$(az keyvault secret show --name terraform-


backend-key --vault-name myKeyVault --query value -o tsv)

Create a Terraform configuration with a backend configuration block.

HashiCorp Configuration Language

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 {}
}

resource "azurerm_resource_group" "state-demo-secure" {


name = "state-demo"
location = "eastus"
}

Replace <storage_account_name> with the name of your Azure storage account.

Run the following command to initialize the configuration:

Bash

terraform init

Run the following command to run the configuration:

Bash

terraform apply

You can now find the state file in the Azure Storage blob.

4. Understand state locking


Azure Storage blobs are automatically locked before any operation that writes state. This
pattern prevents concurrent state operations, which can cause corruption.

For more information, see State locking in the Terraform documentation.

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.

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Learn more about using Terraform in Azure
Implement compliance testing with
Terraform and Azure
Article • 03/20/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Understand when to use compliance testing


" Learn how to do a compliance test
" See and run an example compliance test

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

Docker: Install Docker .

Python: Install Python .


Terraform-compliance tool: Install the Terraform compliance tool by running the
following command: pip install terraform-compliance .

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.

2. Understand compliance testing and checks


Compliance testing is a nonfunctional testing technique to determine if a system meets
prescribed standards. Compliance testing is also known as conformance testing.

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.

Doing compliance checks is straight forward. A set of standards and procedures is


developed and documented for each phase of the development lifecycle. The output of
each phase is compared against the documented requirements. The results of the test
are any "gaps" in not conforming to the predetermined standards. Compliance testing is
done through the inspection process and the outcome of the review process should be
documented.

Let's take a look at a specific example.

A common problem is environments that break when multiple developers apply


incompatible changes. Let's say one person works on a change and applies resources
such as creating a VM in a test environment. Another person then applies a different
version of the code that provisions different version of that VM. What is needed here is
oversight to ensure conformity to stated rules.

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.

Terraform-compliance focuses on negative testing. Negative testing is the process of


ensuring that a system can gracefully handle unexpected input or unwanted behavior.
Fuzzing is an example of negative testing. With fuzzing, a system that receives input is
tested to ensure that it can safely handle unexpected input.

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.

Terraform-compliance allows you to apply BDD, or behavior-driven development,


principles. BDD is a collaborative process where all stakeholders work together to define
what a system should do. These stakeholders generally include the developers, testers,
and anyone with a vested interest in - or who will be impacted by - the system being
developed. The goal of BDD is to encourage teams to build concrete examples that
express a common understanding of how the system should behave.

3. Examine a compliance-test example


Previously in this article, you read about a compliance-testing example of creating a VM
for a test environment. This section shows how to translate that example into a BDD
Feature and Scenario. The rule is first expressed using Cucumber, which is a tool used to
support BDD.

Cucumber

when creating Azure resources, every new resource should have a tag

The previous rule is translated as follows:

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.

HashiCorp Configuration Language

resource "random_uuid" "uuid" {}

resource "azurerm_resource_group" "rg" {


name = "rg-hello-tf-${random_uuid.uuid.result}"
location = var.location

tags = {
environment = "dev"
application = "Azure Compliance"
}
}

The first policy could be written as a BDD feature scenario as follows:

Cucumber

Feature: Test tagging compliance # /target/src/features/tagging.feature


Scenario: Ensure all resources have tags
If the resource supports tags
Then it must contain a tag
And its value must not be null

The following code shows a test for a specific tag:

Cucumber

Scenario Outline: Ensure that specific tags are defined


If the resource supports tags
Then it must contain a tag <tags>
And its value must match the "<value>" regex

Examples:
| tags | value |
| Creator | .+ |
| Application | .+ |
| Role | .+ |
| Environment | ^(prod\|uat\|dev)$ |

4. Run the compliance-test example


In this section, you download and test the example.

1. Within the example directory, navigate to the src directory.

2. Run terraform init to initialize the working directory.

Console

terraform init

3. Run terraform validate to validate the syntax of the configuration files.

Console

terraform validate

Key points:

You see a message indicating that the Terraform configuration is valid.

4. Run terraform plan to create an execution plan.

Console

terraform plan -out main.tfplan

5. Run terraform show to convert the execution plan to JSON for the compliance
step.

Bash

terraform show -json main.tfplan > main.tfplan.json

6. Run docker pull to download the terraform-compliance image.

Console

docker pull eerkunt/terraform-compliance

7. Run docker run to run the tests in a docker container.

Console

docker run --rm -v $PWD:/target -it eerkunt/terraform-compliance -f


features -p main.tfplan.json
Key points:

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:

The configuration is now in compliance with the policy.

5. Verify the results


1. Run terraform validate again to verify the syntax.

Console

terraform validate

2. Run terraform plan again to create a new execution plan.


Console

terraform plan -out main.tfplan

3. Run terraform show to convert the execution plan to JSON for the compliance
step.

Bash

terraform show -json main.tfplan > main.tfplan.json

4. Run docker run again to test the configuration. If the full spec has been
implemented, the test succeeds.

Console

docker run --rm -v $PWD:/target -it eerkunt/terraform-compliance -f


features -p main.tfplan.json

5. Run terraform apply to apply the execution plan.

Console

terraform apply main.tfplan -target=random_uuid.uuid

Key points:

A resource group is created with a name following the pattern: rg-hello-tf-


<random_number> .

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Learn more about using Terraform in Azure
Implement end-to-end Terratest testing
on Terraform projects
Article • 09/01/2022

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

End-to-end (E2E) testing is used to validate a program works before deploying it to


production. An example scenario might be a Terraform module deploying two virtual
machines into a virtual network. You might want to prevent the two machines from
pinging each other. In this example, you could define a test to verify the intended
outcome before deployment.

E2E testing is typically a three-step process.

1. A configuration is applied to a test environment.


2. Code is run to verify the results.
3. The test environment is either reinitialized or taken down (such as deallocating a
virtual machine).

In this article, you learn how to:

Understand the basics of end-to-end testing with Terratest


Learn how to write end-to-end test using Golang
Learn how to use Azure DevOps to automatically trigger end-to-end tests
when code is committed to your 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

Go programming language: Install Go .

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.

2. Understand end-to-end testing


End-to-end tests validate a system works as a collective whole. This type of testing is as
opposed to testing specific modules. For Terraform projects, end-to-end testing allows
for the validation of what has been deployed. This type of testing differs from many
other types that test pre-deployment scenarios. End-to-end tests are critical for testing
complex systems that include multiple modules and act on multiple resources. In such
scenarios, end-to-end testing is the only way to determine if the various modules are
interacting correctly.

This article focuses on using Terratest to implement end-to-end testing. Terratest


provides all the plumbing that is required to do the following task:

Deploy a Terraform configuration


Enables you to write a test using the Go language to validate what has been
deployed
Orchestrate the tests into stages
Tear down the deployed infrastructure

3. Understand the test example


For this article, we're using a sample available in the Azure/terraform sample repo .

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.

The test validates the following scenarios:

The infrastructure is deployed correctly


Using port 22, it's possible to open an SSH session to vm-linux-1
Using the SSH session on vm-linux-1 , it's possible to ping vm-linux-2
If you downloaded the sample, the Terraform configuration for this scenario can be
found in the src/main.tf file. The main.tf file contains everything necessary to deploy
the Azure infrastructure represented in the preceding figure.

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.

4. Examine the test example


The end-to-end test is written in the Go language and uses the Terratest framework. If
you downloaded the sample, the test is defined in the src/test/end2end_test.go file.

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"
)

func TestEndToEndDeploymentScenario(t *testing.T) {


t.Parallel()

fixtureFolder := "../"

// Use Terratest to deploy the infrastructure


test_structure.RunTestStage(t, "setup", func() {
terraformOptions := &terraform.Options{
// Indicate the directory that contains the Terraform
configuration to deploy
TerraformDir: fixtureFolder,
}

// Save options for later test stages


test_structure.SaveTerraformOptions(t, fixtureFolder,
terraformOptions)

// Triggers the terraform init and terraform apply command


terraform.InitAndApply(t, terraformOptions)
})

test_structure.RunTestStage(t, "validate", func() {


// run validation checks here
terraformOptions := test_structure.LoadTerraformOptions(t,
fixtureFolder)
publicIpAddress := terraform.Output(t, terraformOptions,
"public_ip_address")
})

// When the test is completed, teardown the infrastructure by calling


terraform destroy
test_structure.RunTestStage(t, "teardown", func() {
terraformOptions := test_structure.LoadTerraformOptions(t,
fixtureFolder)
terraform.Destroy(t, terraformOptions)
})
}

As you can see in the previous code snippet, the test is composed by three stages:

setup: Runs Terraform to deploy the configuration


validate`: Does the validation checks and assertions
teardown: Cleans up the infrastructure after the test has run

The following list shows some of the key functions provided by the Terratest framework:

terraform.InitAndApply: Enables running terraform init and terraform apply


from Go code
terraform.Output: Retrieves the value of the deployment output variable.
terraform.Destroy: Runs the terraform destroy command from Go code.
test_structure.LoadTerraformOptions: Loads Terraform options - such as
configuration and variables - from the state
test_structure.SaveTerraformOptions: Saves Terraform options - such as
configuration and variables - to the state

5. Run the test example


The following steps run the test against the sample configuration and deployment.

1. Open a bash/terminal window.

2. Log in to your Azure account.

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

your home directory.

Bash

export TEST_SSH_KEY_PATH="~/.ssh/id_rsa"

4. Within the example directory, navigate to the src/test directory.

5. Run the test.

Go

go test -v ./ -timeout 10m

6. Verify the results


After successfully running go test , you see results similar to the following output:

Output

--- PASS: TestEndToEndDeploymentScenario (390.99s)


PASS
ok test 391.052s
Troubleshoot Terraform on Azure
Troubleshoot common problems when using Terraform on Azure

Next steps
Learn more about using Terraform in Azure
Implement integration tests for
Terraform projects in Azure
Article • 03/23/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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:

Static code analysis tools such as lint and format.


Run terraform validate to verify the syntax of the configuration file.
Run terraform plan to ensure the configuration will work as expected.

In this article, you learn how to:

" Learn the basics of integration testing for Terraform projects.


" Use Azure DevOps to configure a continuous integration pipeline.
" Run static code analysis on Terraform code.
" Run terraform validate to validate Terraform configuration files on the local
machine.
" Run terraform plan to validate that Terraform configuration files from a remote
services perspective.
" Use an Azure Pipeline to automate continuous integration.

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

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

Example code and resources: Download from GitHub the integration-testing


project . The directory into which you download the sample is referred to as the
example directory.

2. Validate a local Terraform configuration


The terraform validate command is run from the command line in the directory
containing your Terraform files. This commands main goal is validating syntax.

1. Within the example directory, navigate to the src directory.

2. Run terraform init to initialize the working directory.

Console

terraform init

3. Run terraform validate to validate the syntax of the configuration files.

Console

terraform validate

Key points:

You see a message indicating that the Terraform configuration is valid.

4. Edit the main.tf file.


5. On line 5, insert a typo that invalidates the syntax. For example, replace
var.location with var.loaction

6. Save the file.

7. Run validation again.

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.

3. Validate Terraform configuration


In the previous section, you saw how to validate a Terraform configuration. That level of
testing was specific to syntax. That test didn't take into consideration what might
already be deployed on Azure.

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.

4. Run static code analysis


Static code analysis can be done directly on the Terraform configuration code, without
executing it. This analysis can be useful to detect issues such as security problems and
compliance inconsistency.

The following tools provide static analysis for Terraform files:

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.

5. Automate integration tests using Azure


Pipeline
Continuous integration involves testing an entire system when a change is introduced.
In this section, you see an Azure Pipeline configuration used to implement continuous
integration.

1. Using your editor of choice, browse to the local clone of the Terraform sample
project on GitHub .

2. Open the samples/integration-testing/src/azure-pipeline.yaml file.

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:

This script is responsible for running Checkov in the Terraform workspace


mounted inside a Docker container. Microsoft-managed agents are Docker
enabled. Running tools inside a Docker container is easier and removes the
need to install Checkov on the Azure Pipeline agent.
The $(terraformWorkingDirectory) variable is defined in the azure-
pipeline.yaml file.

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:

The command input specifies which Terraform command to run.


The workingDirectory input indicates the path of the Terraform directory.
The $(terraformWorkingDirectory) variable is defined in the azure-
pipeline.yaml file.

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:

The environmentServiceName input refers to the name of the Azure service


connection created in Configure your environment. The connection allows
Terraform to access your Azure subscription.
The commandOptions input is used to pass arguments to the Terraform
command. In this case, a location is being specified. The $(azureLocation)
variable is defined earlier in the YAML file.

Import the pipeline into Azure DevOps


1. Open your Azure DevOps project and go into the Azure Pipelines section.

2. Select Create Pipeline button.

3. For the Where is your code? option, select GitHub (YAML).


4. At this point, you might have to authorize Azure DevOps to access your
organization. For more information on this topic, see the article, Build GitHub
repositories.

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 .

8. Select Continue to load the Azure YAML pipeline from GitHub.


9. When the Review your pipeline YAML page displays, select Run to create and
manually trigger the pipeline for the first time.

Verify the results


You can run the pipeline manually from the Azure DevOps UI. However, the point of the
article is to show automated continuous integration. Test the process by committing a
change to the samples/integration-testing/src folder of your forked repository. The
change will automatically trigger a new pipeline on the branch on which you're pushing
the code.

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.

If you encounter a problem that is specific to Terraform, use one of HashiCorp's


community support channels.

Unable to list provider registration status


VPN errors

HashiCorp Terraform specific support channels


Questions, use-cases, and useful patterns: Terraform section of the HashiCorp
community portal
Provider-related questions: Terraform Providers section of the HashiCorp
community portal

Unable to list provider registration status


Error message:

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

ARM_SUBSCRIPTION_ID Azure subscription ID

ARM_TENANT_ID Microsoft account tenant ID

ARM_CLIENT_ID Azure service principal app ID

ARM_CLIENT_SECRET Azure service principal password

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 acquiring the state lock


Error message:

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

aztfexport [command] [option] <scope>


The scope changes depending on the command being run, as do the available set of
option flags. There are three commands that should be used based on what you are
trying to export:

Task Description Example

Export a To export a single resource, specify the Azure aztfexport resource [option]
single resourceID associated with the resource. <resource id>
resource.

Export a To export a resource group (and its nested aztfexport resource-group


resource resources), specify the resource group name; not [option] <resource group
group. the ID. name>

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.

Microsoft aggregates collected data to identify patterns of usage to identify common


issues and to improve the experience of Azure Export for Terraform. For example, the
usage data helps identify issues such as commands with low success and helps prioritize
our work. Azure Export for Terraform doesn't collect any private or personal data.

If you do want to disable data collection, run the following command after installing the
tool:

Console

aztfexport config set telemetry_enabled false

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

Create the test Azure resources


Create a Linux VM.

Azure CLI

1. Run az group create to create an Azure resource group.

Azure CLI

az group create --name myResourceGroup --location eastus

2. Run az vm create to create the virtual machine.

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.

1. Create a directory in which to test.

2. Open a command prompt and navigate to the new directory.

3. Run aztfexport resource-group to export the resource group named


myResourceGroup .

Console

aztfexport resource-group myResourceGroup

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:

For a non-interactive resource, add the --non-interactive flag: aztfexport


rg --non-interactive myResourceGroup .

7 Note

Running Azure Export for Terraform can take several minutes to complete.

Verify the results


After the tool has finished exporting your Azure resources, run the following commands
in the same directory that contains the generated files.

1. Run terraform init .

Console

terraform init --upgrade


2. Run terraform plan .

Console

terraform plan

If the terminal outputs No changes needed, then congratulations!

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.

2. Run terraform destroy .

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

Create the test Azure resources


Create a Linux VM.

Azure CLI

1. Run az group create to create an Azure resource group.

Azure CLI

az group create --name myResourceGroup --location eastus

2. Run az vm create to create the virtual machine.

Azure CLI

az vm create \
--resource-group myResourceGroup \
--name myVM \
--image Debian \
--admin-username azureadmin \
--generate-ssh-keys \
--public-ip-sku Standard

Understand the hcl-only flag


Azure Export for Terraform supports a flag - --hcl-only - that causes the generation of
the following files from the exported resource(s):

Generated .tf HCL files.


Mapping file aztfexportResourceMapping.json .
Skipped resources are listed in aztfexportSkippedResources.txt .

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.

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 non-interactive mode.

1. Create a directory in which to test.

2. Open a command prompt and navigate to the new directory.

3. Run aztfexport resource-group to export the resource group named


myResourceGroup .

Console

aztfexport resource-group --non-interactive --hcl-only myResourceGroup

7 Note

Running Azure Export for Terraform can take several minutes to complete.

Verify the results


After the tool has finished exporting your Azure resources, verify the following files in
the directory where you ran Azure Export for Terraform:

main.tf contains the HCL code that defines the exported resources.

aztfexportResourceMapping.json contains the Azure/Terraform mappings. The

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

shouldn't see this file for this example.

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.

2. Run terraform destroy .

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

Using the user interface


When you run Azure Export for Terraform in interactive mode, the specified resources
(via the parameters you specify when running) display. By default, all of the resources
are exported.

The Delete acts as a toggle in skipping or including resources. To remove resources


from being exported, use the arrow keys to select the desired resource and press Delete

. The resource is updated to display "Skip".

To undo the skip action, verify the skipped resource is selected, and press Delete again.

Pros:

Requires the use of a single toggle key.


Don’t need to know the resources you want before running the command.

Cons:

Action can be time consuming if you have many resources to scroll through and
skip.

Using query mode


Applying a filter using Azure Resource Graph query syntax is a powerful technique when
you know exactly what filters you need.
Console

aztfexport query [option] <ARG_where_predicate>

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

aztfexport query -n "resourceGroup =~ 'myResourceGroup' and type contains


'Microsoft.Network'"

Pros:

Single command with no manual editing required.


Supports an unlimited number of filters.
Handles large amount of resources efficiently.

Cons:

Easy to exclude resources you need to export.


Requires knowledge of Azure Resource Graph syntax.

Using a mapping file


The following syntax shows the basics to export a set of resources that is defined in a
resource mapping file:

Console

aztfexport mapping-file [option] <resource_mapping_file>

You can use a mapping file in either interactive or non-interactive modes:

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

aztfexport rg --generate-mapping-file --non-interactive myResourceGroup

The results are similar to the following JSON file:

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.

We could update the mapping file as follows:

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

aztfexport map -n "aztfexportResourceMapping.json"

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:

For simple scenarios, this technique might be overkill.


Requires manual modifications.

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.

" Append resources to existing Terraform environments.


" Export resources into an existing Terraform environment with a remote backend
state

Appending to existing resources


By default, Azure Export for Terraform ensures the output directory is empty to avoid
any conflicts with existing user files. If you need to import resources to an existing state
file, add the --append flag.

Console

aztfexport [command] --append <scope>

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.

If you run aztfexport --append multiple times, a single main.aztfexport.tf is created


with the export results appended to the file each time the command is run.

Bring your own Terraform configuration


By default, Azure Export for Terraform uses a local backend to store the state file.
However, it's also possible to use a remote backend. Azure Export for Terraform enables
you to define your own terraform or provider blocks to pass.
Define these blocks in a .tf file within your target directory, export with the --append
flag, and your config exports to the specified backend and provider version (if it's
provided).

) Important

If the specified version of AzureRM doesn't match your installed version when
exporting, the command fails.

Azure Storage example


This example is based on the article, Store Terraform state in Azure Storage.

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 example


Terraform

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 .

Resource group name


Storage account name
Storage container name

Pass these parameters into the command along with your backend type:

Console

aztfexport [subcommand] --backend-type=azurerm \


--backend-config=resource_group_name=<resource group
name> \
--backend-config=storage_account_name=<account name>
\
--backend-config=container_name=<container name> \
--backend-config=key=terraform.tfstate

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

aztfexport resource -o tempdir --hcl-only <resource_id>

Key points:

The -o flag specifies to create the directory if it doesn't exist.


The --hcl-only flag specifies to export the configured resources to HCL

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

aztfexport map --append `./tempdir/aztfexportResourceMapping.json`

3. Run terraform init .

Console

terraform init --upgrade

4. Run terraform plan .

5. Azure Export for Terraform should display No changes needed.

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

Select previous item in the resource list. ↑ -or- k

Select next item in the resource list. ↓ -or- j

Move to previous page in the resource list. ← -or- h -or-


Page Up

Move to next page in the resource list. → -or- l -or-


Page Down

Jump to the start of the resource list. g -or- Home

Jump to the end of the resource list. G -or- End

Selecting resources to skip

Skip resource (or unskip if marked as "Skip") Delete

Filter operations

Define a filter by text on the resource list. /

Clear any current filter Esc

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 recommendations for current resource. r

Show resource export errors (if any). e

Display help. ?

Quit

Quit interactive mode. q

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.

Best practices on core workflows


On a fundamental level, any user of Azure Export faces a decision between two options:

Export existing resources into state


Export existing resources into HCL

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.

Infrastructure outside resource scope


When you're using Azure Export for Terraform to target resource scopes, resources
required for the config might exist outside of the scope specified. One example is a role
assignment. The user needs to identify resources that are outside of scope.

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.

Modifying code to match coding standards


There are a few necessary operations if the user wishes to modify their code to abide by
coding standards. These steps would only be necessary if the user plans to use the code
in nonsandbox environments.

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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.
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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


location = var.resource_group_location
name = random_pet.rg_name.id
}

4. 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."
}
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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.
Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Run az group show to display the resource group.

Azure CLI

az group show --name $resource_group_name

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
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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

" Define and configure the AzureRM and AzAPI providers.


" Use the AzureRM provider to create an Azure resource group
" Use the AzureRM provider to register the "Microsoft.LabServices" provider in your
subscription
" Use the AzAPI provider to create the Azure Lab Services resources

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

Implement the Terraform code


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 {
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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "azurerm_resource_group" "qs101" {


name = "rg-qs101"
location = "westus2"
}
4. Create a file named main-generic.tf and insert the following code:

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
}
})
}

resource "azapi_resource" "qs101-lab" {


type = "Microsoft.LabServices/labaccounts/labs@2018-10-15"
name = "qs101Lab"
parent_id = azapi_resource.qs101-account.id

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. In your Azure subscription browse to the rg-qs101 resource group.
2. A new Lab Services account named qs101LabAccount displays as a member of the
resource group.
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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

" Define and configure the AzureRM and AzAPI providers


" Generate a random name for the Event Hubs namespace
" Use the AzureRM provider to create an Azure resource group and the required
networking and Event Hubs resources
" Use the AzAPI provider to add a network rule set to the
azurerm_eventhub_namespace resources

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

Implement the Terraform code


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 {
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" {
}

3. Create a file named main.tf and insert the following code:

Terraform
resource "azurerm_resource_group" "qs101" {
name = "rg-qs101-eh-rules"
location = "westus2"
}

resource "azurerm_virtual_network" "qs101" {


name = "myvnet"
location = azurerm_resource_group.qs101.location
resource_group_name = azurerm_resource_group.qs101.name
address_space = ["172.17.0.0/16"]
dns_servers = ["10.0.0.4", "10.0.0.5"]
}

resource "azurerm_subnet" "qs101" {


name = "default"
resource_group_name = azurerm_resource_group.qs101.name
virtual_network_name = azurerm_virtual_network.qs101.name
address_prefixes = ["172.17.0.0/24"]

service_endpoints = ["Microsoft.EventHub"]
}

resource "random_pet" "qs101_namespace" {


length = 3
separator = ""
}

resource "azurerm_eventhub_namespace" "qs101" {


name = random_pet.qs101_namespace.id
location = azurerm_resource_group.qs101.location
resource_group_name = azurerm_resource_group.qs101.name
sku = "Standard"
capacity = 2
}

4. Create a file named main-generic.tf and insert the following code:

Terraform

# AzAPI update resource is used to enable Network Rule sets on Event


Hub namespace
resource "azapi_update_resource" "qs101" {
type = "Microsoft.EventHub/namespaces/networkRuleSets@2021-11-
01"
name = "default"
parent_id = azurerm_eventhub_namespace.qs101.id

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

Run az eventhubs namespace network-rule list to display the Event Hubs


Namespace network rules.

Azure CLI

az eventhubs namespace network-rule list --resource-group


<resource_group_name> --namespace-name <namespace_name>

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:

1. Run terraform plan and specify the destroy flag.

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_cognitive_account_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_cognitive_account" "cognitive_service" {


name =
"CognitiveService-${random_string.azurerm_cognitive_account_name.result
}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku_name = var.sku
kind = "CognitiveServices"
}

3. Create a file named outputs.tf and insert the following code:

Terraform

output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "azurerm_cognitive_account_name" {
value = azurerm_cognitive_account.cognitive_service.name
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource name in which the Azure AI services account was
created.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the Azure AI services account name.

Console

azurerm_cognitive_account_name=$(terraform output -raw


azurerm_cognitive_account_name)

3. Run az cognitiveservices account show to show the Azure AI services account


you created in this article.

Azure CLI

az cognitiveservices account show --name


$azurerm_cognitive_account_name \
--resource-group
$resource_group_name

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

Implement the Terraform code

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.

2. Create a file named main.tf and insert the following code:


Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_search_service_name" {


length = 25
upper = false
numeric = false
special = false
}

resource "azurerm_search_service" "search" {


name =
random_string.azurerm_search_service_name.result
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = var.sku
replica_count = var.replica_count
partition_count = var.partition_count
}

3. Create a file named outputs.tf and insert the following code:

Terraform

output "resource_group_name" {
value = azurerm_resource_group.rg.name
}

output "azurerm_search_service_name" {
value = azurerm_search_service.search.name
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. Get the Azure resource name in which the Azure AI Search service was created.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the Azure AI Search service name.

Console

azurerm_search_service_name=$(terraform output -raw


azurerm_search_service_name)

3. Run az search service show to show the Azure AI Search service you created in this
article.

Azure CLI

az search service show --name $azurerm_search_service_name \


--resource-group $resource_group_name

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

In this article, you learn how to:

" 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

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_analysis_services_server_name" {


length = 25
upper = false
numeric = false
special = false
}

resource "azurerm_analysis_services_server" "server" {


name =
random_string.azurerm_analysis_services_server_name.result
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = var.sku
backup_blob_container_uri = var.backup_blob_container_uri

ipv4_firewall_rule {
name = "AllowFromAll"
range_start = "0.0.0.0"
range_end = "255.255.255.255"
}
}

3. Create a file named outputs.tf and insert the following code:

Terraform

output "resource_group_name" {
value = azurerm_resource_group.rg.name
}

output "analysis_services_server_name" {
value = azurerm_analysis_services_server.server.name
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. Open a PowerShell command prompt.

2. Get the Azure resource group name.

Console

$resource_group_name=$(terraform output -raw resource_group_name)

3. Get the server name.

Console

$analysis_services_server_name=$(terraform output -raw


analysis_services_server_name)

4. Run Get-AzAnalysisServicesServer to display information about the new server.

Azure PowerShell

Get-AzAnalysisServicesServer -ResourceGroupName $resource_group_name `


-Name $analysis_services_server_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = "rg"
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_pet" "stream_analytics_job_name" {


prefix = "job"
}

resource "azurerm_stream_analytics_job" "job" {


name =
random_pet.stream_analytics_job_name.id
resource_group_name =
azurerm_resource_group.rg.name
location =
azurerm_resource_group.rg.location
streaming_units =
var.number_of_streaming_units
events_out_of_order_max_delay_in_seconds = 0
events_late_arrival_max_delay_in_seconds = 5
data_locale = "en-US"
events_out_of_order_policy = "Adjust"
output_error_policy = "Stop"

transformation_query = <<QUERY
SELECT
*
INTO
[YourOutputAlias]
FROM
[YourInputAlias]
QUERY

4. Create a file named variables.tf and insert the following code:

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."
}
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the new Azure Stream Analytics job name.

Console

stream_analytics_job_name=$(terraform output -raw


stream_analytics_job_name)

3. Run az stream-analytics job show to display information about the job.

Azure CLI

az stream-analytics job show \


--resource-group $resource_group_name \
--job-name $stream_analytics_job_name

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
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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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:

Deploy an AKS cluster using Terraform.


Run a sample multi-container application with a group of microservices and web
front ends simulating a retail scenario.

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.

Before you begin


This quickstart assumes a basic understanding of Kubernetes concepts. For more
information, see Kubernetes core concepts for Azure Kubernetes Service (AKS).
You need an Azure account with an active subscription. If you don't have one,
create an account for free .
Follow the instructions based on your command line interface.

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.

Install and configure Terraform.


Download kubectl .
Create a random value for the Azure resource group name using random_pet .
Create an Azure resource group using azurerm_resource_group .
Access the configuration of the AzureRM provider to get the Azure Object ID using
azurerm_client_config .
Create a Kubernetes cluster using azurerm_kubernetes_cluster .
Create an AzAPI resource azapi_resource .
Create an AzAPI resource to generate an SSH key pair using
azapi_resource_action .

Login to your Azure account


First, log into your Azure account and authenticate using one of the methods described
in the following section.

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.

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 you can use to test the sample Terraform code and make it your
current directory.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named ssh.tf and insert the following code:

Terraform

resource "random_pet" "ssh_key_name" {


prefix = "ssh"
separator = ""
}

resource "azapi_resource_action" "ssh_public_key_gen" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
resource_id = azapi_resource.ssh_public_key.id
action = "generateKeyPair"
method = "POST"

response_export_values = ["publicKey", "privateKey"]


}

resource "azapi_resource" "ssh_public_key" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
name = random_pet.ssh_key_name.id
location = azurerm_resource_group.rg.location
parent_id = azurerm_resource_group.rg.id
}

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

# Generate random resource group name


resource "random_pet" "rg_name" {
prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


location = var.resource_group_location
name = random_pet.rg_name.id
}

resource "random_pet" "azurerm_kubernetes_cluster_name" {


prefix = "cluster"
}

resource "random_pet" "azurerm_kubernetes_cluster_dns_prefix" {


prefix = "dns"
}

resource "azurerm_kubernetes_cluster" "k8s" {


location = azurerm_resource_group.rg.location
name = random_pet.azurerm_kubernetes_cluster_name.id
resource_group_name = azurerm_resource_group.rg.name
dns_prefix =
random_pet.azurerm_kubernetes_cluster_dns_prefix.id

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"
}
}

5. 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 "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"
}

6. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.
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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. Get the Azure resource group name using the following command.

Console

resource_group_name=$(terraform output -raw resource_group_name)

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

echo "$(terraform output kube_config)" > ./azurek8s

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

kubectl get nodes

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.

Deploy the application


To deploy the application, you use a manifest file to create all the objects required to
run the AKS Store application . A Kubernetes manifest file defines a cluster's desired
state, such as which container images to run. The manifest includes the following
Kubernetes deployments and services:

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

We don't recommend running stateful containers, such as Rabbit MQ, without


persistent storage for production. These are used here for simplicity, but we
recommend using managed services, such as Azure CosmosDB or Azure Service
Bus.

1. Create a file named aks-store-quickstart.yaml and copy in the following manifest:

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

kubectl apply -f aks-store-quickstart.yaml

The following example output shows the deployments and services:

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

Test the application


When the application runs, a Kubernetes service exposes the application front end to
the internet. This process can take a few minutes to complete.

1. Check the status of the deployed pods using the kubectl get pods command.
Make all pods are Running before proceeding.
Console

kubectl get pods

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

kubectl get service store-front --watch

The EXTERNAL-IP output for the store-front service initially shows as pending:

Output

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)


AGE
store-front LoadBalancer 10.0.100.10 <pending> 80:30025/TCP
4h4m

3. Once the EXTERNAL-IP address changes from pending to an actual public IP


address, use CTRL-C to stop the kubectl watch process.

The following example output shows a valid public IP address assigned to the
service:

Output

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)


AGE
store-front LoadBalancer 10.0.100.10 20.62.159.19 80:30025/TCP
4h5m

4. Open a web browser to the external IP address of your service to see the Azure
Store app in action.

Clean up resources

Delete AKS 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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan


Delete service principal
1. Get the service principal ID using the following command.

Azure CLI

sp=$(terraform output -raw sp)

2. Delete the service principal using the az ad sp delete command.

Azure CLI

az ad sp delete --id $sp

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure.

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.

Learn more about using AKS.

) Note: The author created this article with assistance from AI. Learn more

6 Collaborate with us on Azure Kubernetes Service


GitHub feedback
The source for this content can Azure Kubernetes Service is an open
be found on GitHub, where you source project. Select a link to
can also create and review provide feedback:
issues and pull requests. For
more information, see our  Open a documentation issue
contributor guide.
 Provide product feedback
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 article applies to: ❌ Basic ✔️Standard ✔️Enterprise

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.

The Enterprise deployment plan includes the following Tanzu components:

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.

Review the Terraform plan


The configuration file used in this quickstart is from the Azure Spring Apps reference
architecture.

Enterprise plan
HashiCorp Configuration Language

# Azure provider version

terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "= 3.21.1"
}
}
}

provider "azurerm" {
features {}
}

### Create Resource group


resource "azurerm_resource_group" "sc_corp_rg" {
name = var.resource_group_name
location = var.location
}

### Create Application Insights


resource "azurerm_application_insights" "sc_app_insights" {
name = var.app_insights_name
location = var.location
resource_group_name = var.resource_group_name
application_type = "web"
workspace_id =
"/subscriptions/${var.subscription}/resourceGroups/${var.azurespringclou
dvnetrg}/providers/Microsoft.OperationalInsights/workspaces/${var.sc_law
_id}"

depends_on = [azurerm_resource_group.sc_corp_rg]
}

### Create Spring Cloud Service


resource "azurerm_spring_cloud_service" "sc" {
name = var.sc_service_name
resource_group_name = var.resource_group_name
location = var.location
sku_name = "E0"

# Tanzu service registry - Set to true if Enterprise Tier


service_registry_enabled = true
build_agent_pool_size = "S1"

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

### Update Diags setting for Spring Cloud Service

resource "azurerm_monitor_diagnostic_setting" "sc_diag" {


name = "monitoring"
target_resource_id = azurerm_spring_cloud_service.sc.id
log_analytics_workspace_id =
"/subscriptions/${var.subscription}/resourceGroups/${var.azurespringclou
dvnetrg}/providers/Microsoft.OperationalInsights/workspaces/${var.sc_law
_id}"

log {
category = "ApplicationConsole"
enabled = true

retention_policy {
enabled = false
}
}

metric {
category = "AllMetrics"

retention_policy {
enabled = false
}
}
}

# Begin Tanzu Components

resource "azurerm_spring_cloud_build_pack_binding" "appinsights-binding"


{
name = "appins-binding"
spring_cloud_builder_id =
"${azurerm_spring_cloud_service.sc.id}/buildServices/default/builders/de
fault"
binding_type = "ApplicationInsights"
launch {
properties = {
sampling_percentage = "10"
}

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
}

resource "azurerm_spring_cloud_api_portal" "apiportal" {


name = "default"
spring_cloud_service_id = azurerm_spring_cloud_service.sc.id
gateway_ids =
[azurerm_spring_cloud_gateway.scgateway.id]
https_only_enabled = false
public_network_access_enabled = true
instance_count = 1
}

Apply the Terraform plan


To apply the Terraform plan, follow these steps:

1. Save the variables.tf file for the Standard plan or the Enterprise plan locally,
then open it in an editor.

2. Edit the file to add the following values:

The subscription ID of the Azure account you'll be deploying to.


A deployment location from the regions where Azure Spring Apps is
available, as shown in Products available by region . You'll need the short
form of the location name. To get this value, use the following command to
generate a list of Azure locations, then look up the Name value for the region
you selected.

Azure CLI

az account list-locations --output table

3. Edit the file to add the following new deployment information:

The name of the resource group you'll deploy to.


A name of your choice for the Azure Spring Apps Deployment.
A name of your choice for the Application Insights resource.
Three CIDR ranges (at least /16) which are used to host the Azure Spring
Apps backend infrastructure. The CIDR ranges must not overlap with any
existing CIDR ranges in the target Subnet
The key/value pairs to be applied as tags on all resources that support tags.
For more information, see Use tags to organize your Azure resources and
management hierarchy

4. Edit the file to add the following existing infrastructure information:

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.

5. Run the following command to initialize the Terraform modules:

Bash

terraform init

6. Run the following command to create the Terraform deployment plan:

Bash

terraform plan -out=springcloud.plan


7. Run the following command to apply the Terraform deployment plan:

Bash

terraform apply springcloud.plan

Review deployed resources


You can either use the Azure portal to check the deployed resources, or use Azure CLI or
Azure PowerShell script to list the deployed resources.

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

terraform destroy -auto-approve

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_storage_account_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "random_string" "azurerm_batch_account_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_storage_account" "storage" {


name =
"storage${random_string.azurerm_storage_account_name.result}"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
account_tier = element(split("_",
var.storage_account_type), 0)
account_replication_type = element(split("_",
var.storage_account_type), 1)
}

resource "azurerm_batch_account" "batch" {


name =
"batch${random_string.azurerm_batch_account_name.result}"
resource_group_name = azurerm_resource_group.rg.name
location =
azurerm_resource_group.rg.location
storage_account_id =
azurerm_storage_account.storage.id
storage_account_authentication_mode = "StorageKeys"
}

4. Create a file named variables.tf and insert the following code:

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'."
}
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.
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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console
resource_group_name=$(terraform output -raw resource_group_name)

2. Get the Batch account name.

Console

batch_name=$(terraform output -raw batch_name)

3. Run az batch account show to display information about the new Batch
account.

Azure CLI

az batch account show \


--resource-group $resource_group_name \
--name $batch_name

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

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 .
2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Applies to: ✔️Linux VMs

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named ssh.tf and insert the following code:


Terraform

resource "random_pet" "ssh_key_name" {


prefix = "ssh"
separator = ""
}

resource "azapi_resource_action" "ssh_public_key_gen" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
resource_id = azapi_resource.ssh_public_key.id
action = "generateKeyPair"
method = "POST"

response_export_values = ["publicKey", "privateKey"]


}

resource "azapi_resource" "ssh_public_key" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
name = random_pet.ssh_key_name.id
location = azurerm_resource_group.rg.location
parent_id = azurerm_resource_group.rg.id
}

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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


location = var.resource_group_location
name = random_pet.rg_name.id
}

# Create virtual network


resource "azurerm_virtual_network" "my_terraform_network" {
name = "myVnet"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}

# 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"]
}

# Create public IPs


resource "azurerm_public_ip" "my_terraform_public_ip" {
name = "myPublicIP"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Dynamic"
}

# Create Network Security Group and rule


resource "azurerm_network_security_group" "my_terraform_nsg" {
name = "myNetworkSecurityGroup"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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 = "*"
}
}

# Create network interface


resource "azurerm_network_interface" "my_terraform_nic" {
name = "myNIC"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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
}
}

# Connect the security group to the network interface


resource "azurerm_network_interface_security_group_association"
"example" {
network_interface_id =
azurerm_network_interface.my_terraform_nic.id
network_security_group_id =
azurerm_network_security_group.my_terraform_nsg.id
}

# Generate random text for a unique storage account name


resource "random_id" "random_id" {
keepers = {
# Generate a new ID only when a new resource group is defined
resource_group = azurerm_resource_group.rg.name
}

byte_length = 8
}

# Create storage account for boot diagnostics


resource "azurerm_storage_account" "my_storage_account" {
name = "diag${random_id.random_id.hex}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
account_tier = "Standard"
account_replication_type = "LRS"
}

# Create virtual machine


resource "azurerm_linux_virtual_machine" "my_terraform_vm" {
name = "myVM"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
network_interface_ids =
[azurerm_network_interface.my_terraform_nic.id]
size = "Standard_DS1_v2"

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
}
}

5. 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 = "azureadmin"
}

6. Create a file named outputs.tf and insert the following code:

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

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:

1. Run terraform plan and specify the destroy flag.

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Azure Linux virtual machine tutorials


Quickstart: Create a Linux VM cluster in
Azure 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

Applies to: ✔️Linux VMs

This article shows you how to create a Linux VM cluster (containing two Linux VM
instances) in Azure using Terraform.

In this article, you learn how to:

" 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

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.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named ssh.tf and insert the following code:

Terraform

resource "random_pet" "ssh_key_name" {


prefix = "ssh"
separator = ""
}

resource "azapi_resource_action" "ssh_public_key_gen" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
resource_id = azapi_resource.ssh_public_key.id
action = "generateKeyPair"
method = "POST"

response_export_values = ["publicKey", "privateKey"]


}

resource "azapi_resource" "ssh_public_key" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
name = random_pet.ssh_key_name.id
location = azurerm_resource_group.rg.location
parent_id = azurerm_resource_group.rg.id
}

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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_pet" "azurerm_virtual_network_name" {


prefix = "vnet"
}

resource "azurerm_virtual_network" "test" {


name = random_pet.azurerm_virtual_network_name.id
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}

resource "random_pet" "azurerm_subnet_name" {


prefix = "sub"
}

resource "azurerm_subnet" "test" {


name = random_pet.azurerm_subnet_name.id
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.test.name
address_prefixes = ["10.0.2.0/24"]
}

resource "azurerm_public_ip" "test" {


name = "publicIPForLB"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
}
resource "azurerm_lb" "test" {
name = "loadBalancer"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

frontend_ip_configuration {
name = "publicIPAddress"
public_ip_address_id = azurerm_public_ip.test.id
}
}

resource "azurerm_lb_backend_address_pool" "test" {


loadbalancer_id = azurerm_lb.test.id
name = "BackEndAddressPool"
}

resource "azurerm_network_interface" "test" {


count = 2
name = "acctni${count.index}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

ip_configuration {
name = "testConfiguration"
subnet_id = azurerm_subnet.test.id
private_ip_address_allocation = "Dynamic"
}
}

resource "azurerm_availability_set" "avset" {


name = "avset"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
platform_fault_domain_count = 2
platform_update_domain_count = 2
managed = true
}

resource "random_pet" "azurerm_linux_virtual_machine_name" {


prefix = "vm"
}

resource "azurerm_linux_virtual_machine" "test" {


count = 2
name =
"${random_pet.azurerm_linux_virtual_machine_name.id}${count.index}"
location = azurerm_resource_group.rg.location
availability_set_id = azurerm_availability_set.avset.id
resource_group_name = azurerm_resource_group.rg.name
network_interface_ids =
[azurerm_network_interface.test[count.index].id]
size = "Standard_DS1_v2"

# Uncomment this line to delete the OS disk automatically when


deleting the VM
# delete_os_disk_on_termination = true

# Uncomment this line to delete the data disks automatically when


deleting the VM
# delete_data_disks_on_termination = true

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
}

resource "azurerm_managed_disk" "test" {


count = 2
name = "datadisk_existing_${count.index}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
storage_account_type = "Standard_LRS"
create_option = "Empty"
disk_size_gb = "1024"
}

resource "azurerm_virtual_machine_data_disk_attachment" "test" {


count = 2
managed_disk_id = azurerm_managed_disk.test[count.index].id
virtual_machine_id =
azurerm_linux_virtual_machine.test[count.index].id
lun = "10"
caching = "ReadWrite"
}

5. Create a file named variables.tf and insert the following code:

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"
}

6. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.
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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

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:

1. Run terraform plan and specify the destroy flag.

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Applies to: ✔️Windows VMs

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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.

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.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform
resource "azurerm_resource_group" "rg" {
location = var.resource_group_location
name = "${random_pet.prefix.id}-rg"
}

# Create 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
}

# 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"]
}

# Create public IPs


resource "azurerm_public_ip" "my_terraform_public_ip" {
name = "${random_pet.prefix.id}-public-ip"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Dynamic"
}

# Create Network Security Group and rules


resource "azurerm_network_security_group" "my_terraform_nsg" {
name = "${random_pet.prefix.id}-nsg"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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 = "*"
}
}

# Create network interface


resource "azurerm_network_interface" "my_terraform_nic" {
name = "${random_pet.prefix.id}-nic"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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
}
}

# Connect the security group to the network interface


resource "azurerm_network_interface_security_group_association"
"example" {
network_interface_id =
azurerm_network_interface.my_terraform_nic.id
network_security_group_id =
azurerm_network_security_group.my_terraform_nsg.id
}

# Create storage account for boot diagnostics


resource "azurerm_storage_account" "my_storage_account" {
name = "diag${random_id.random_id.hex}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
account_tier = "Standard"
account_replication_type = "LRS"
}

# Create virtual machine


resource "azurerm_windows_virtual_machine" "main" {
name = "${var.prefix}-vm"
admin_username = "azureuser"
admin_password = random_password.password.result
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
network_interface_ids =
[azurerm_network_interface.my_terraform_nic.id]
size = "Standard_DS1_v2"

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
}
}

# Install IIS web server to the virtual machine


resource "azurerm_virtual_machine_extension" "web_server_install" {
name = "${random_pet.prefix.id}-wsi"
virtual_machine_id = azurerm_windows_virtual_machine.main.id
publisher = "Microsoft.Compute"
type = "CustomScriptExtension"
type_handler_version = "1.8"
auto_upgrade_minor_version = true

settings = <<SETTINGS
{
"commandToExecute": "powershell -ExecutionPolicy Unrestricted
Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature -
IncludeManagementTools"
}
SETTINGS
}

# Generate random text for a unique storage account name


resource "random_id" "random_id" {
keepers = {
# Generate a new ID only when a new resource group is defined
resource_group = azurerm_resource_group.rg.name
}

byte_length = 8
}

resource "random_password" "password" {


length = 20
min_lower = 1
min_upper = 1
min_numeric = 1
min_special = 1
special = true
}

resource "random_pet" "prefix" {


prefix = var.prefix
length = 1
}

4. Create a file named variables.tf and insert the following code:

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"
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.
Verify the results
1. Run the following command to get the VM's public IP address and make note of it:

Azure CLI

echo $(terraform output -raw public_ip_address)

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:

1. Run terraform plan and specify the destroy flag.

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Azure Linux virtual machine tutorials


Quickstart: Create a Windows VM
cluster in Azure using Terraform
Article • 01/04/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

Applies to: ✔️Windows 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

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.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "windows_server_vm_hostname" {


length = 8
lower = true
upper = false
special = false
}

resource "random_pet" "windows_server_public_ip_dns" {


prefix = "dns"
}

resource "random_password" "password" {


length = 16
special = true
lower = true
upper = true
numeric = true
}

# The following module is a Terraform Verified Module.


# For more information about Verified Modules, see
# https://github.com/azure/terraform-azure-modules/
module "windows_server" {
count = 3 # Define 3 Windows Server VMs
source = "Azure/compute/azurerm"
resource_group_name = azurerm_resource_group.rg.name
vnet_subnet_id = module.network.vnet_subnets[0]
is_windows_image = true
vm_hostname =
"vm-${random_string.windows_server_vm_hostname.result}-${count.index}"
delete_os_disk_on_termination = true
admin_password = random_password.password.result
vm_os_simple = "WindowsServer"
public_ip_dns =
["${random_pet.windows_server_public_ip_dns.id}-${count.index}"]
}

# The following module is a Terraform Verified Module.


# For more information about Verified Modules, see
# https://github.com/azure/terraform-azure-modules/
module "network" {
source = "Azure/network/azurerm"
resource_group_name = azurerm_resource_group.rg.name
version = "5.2.0"
subnet_prefixes = ["10.0.1.0/24"]
subnet_names = ["subnet1"]
use_for_each = true
}

4. Create a file named variables.tf and insert the following code:

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."
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

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:

1. Run terraform plan and specify the destroy flag.

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure
Next steps
Azure Linux virtual machine tutorials
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:

Deploy an AKS cluster using Terraform.


Run a sample multi-container application with a group of microservices and web
front ends simulating a retail scenario.

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.

Before you begin


This quickstart assumes a basic understanding of Kubernetes concepts. For more
information, see Kubernetes core concepts for Azure Kubernetes Service (AKS).
You need an Azure account with an active subscription. If you don't have one,
create an account for free .
Follow the instructions based on your command line interface.

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.

Install and configure Terraform.


Download kubectl .
Create a random value for the Azure resource group name using random_pet .
Create an Azure resource group using azurerm_resource_group .
Access the configuration of the AzureRM provider to get the Azure Object ID using
azurerm_client_config .
Create a Kubernetes cluster using azurerm_kubernetes_cluster .
Create an AzAPI resource azapi_resource .
Create an AzAPI resource to generate an SSH key pair using
azapi_resource_action .

Login to your Azure account


First, log into your Azure account and authenticate using one of the methods described
in the following section.

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.

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 you can use to test the sample Terraform code and make it your
current directory.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named ssh.tf and insert the following code:

Terraform

resource "random_pet" "ssh_key_name" {


prefix = "ssh"
separator = ""
}

resource "azapi_resource_action" "ssh_public_key_gen" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
resource_id = azapi_resource.ssh_public_key.id
action = "generateKeyPair"
method = "POST"

response_export_values = ["publicKey", "privateKey"]


}

resource "azapi_resource" "ssh_public_key" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
name = random_pet.ssh_key_name.id
location = azurerm_resource_group.rg.location
parent_id = azurerm_resource_group.rg.id
}

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

# Generate random resource group name


resource "random_pet" "rg_name" {
prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


location = var.resource_group_location
name = random_pet.rg_name.id
}

resource "random_pet" "azurerm_kubernetes_cluster_name" {


prefix = "cluster"
}

resource "random_pet" "azurerm_kubernetes_cluster_dns_prefix" {


prefix = "dns"
}

resource "azurerm_kubernetes_cluster" "k8s" {


location = azurerm_resource_group.rg.location
name = random_pet.azurerm_kubernetes_cluster_name.id
resource_group_name = azurerm_resource_group.rg.name
dns_prefix =
random_pet.azurerm_kubernetes_cluster_dns_prefix.id

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"
}
}

5. 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 "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"
}

6. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.
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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. Get the Azure resource group name using the following command.

Console

resource_group_name=$(terraform output -raw resource_group_name)

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

echo "$(terraform output kube_config)" > ./azurek8s

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

kubectl get nodes

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.

Deploy the application


To deploy the application, you use a manifest file to create all the objects required to
run the AKS Store application . A Kubernetes manifest file defines a cluster's desired
state, such as which container images to run. The manifest includes the following
Kubernetes deployments and services:

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

We don't recommend running stateful containers, such as Rabbit MQ, without


persistent storage for production. These are used here for simplicity, but we
recommend using managed services, such as Azure CosmosDB or Azure Service
Bus.

1. Create a file named aks-store-quickstart.yaml and copy in the following manifest:

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

kubectl apply -f aks-store-quickstart.yaml

The following example output shows the deployments and services:

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

Test the application


When the application runs, a Kubernetes service exposes the application front end to
the internet. This process can take a few minutes to complete.

1. Check the status of the deployed pods using the kubectl get pods command.
Make all pods are Running before proceeding.
Console

kubectl get pods

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

kubectl get service store-front --watch

The EXTERNAL-IP output for the store-front service initially shows as pending:

Output

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)


AGE
store-front LoadBalancer 10.0.100.10 <pending> 80:30025/TCP
4h4m

3. Once the EXTERNAL-IP address changes from pending to an actual public IP


address, use CTRL-C to stop the kubectl watch process.

The following example output shows a valid public IP address assigned to the
service:

Output

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)


AGE
store-front LoadBalancer 10.0.100.10 20.62.159.19 80:30025/TCP
4h5m

4. Open a web browser to the external IP address of your service to see the Azure
Store app in action.

Clean up resources

Delete AKS 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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan


Delete service principal
1. Get the service principal ID using the following command.

Azure CLI

sp=$(terraform output -raw sp)

2. Delete the service principal using the az ad sp delete command.

Azure CLI

az ad sp delete --id $sp

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure.

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.

Learn more about using AKS.

) Note: The author created this article with assistance from AI. Learn more

6 Collaborate with us on Azure Kubernetes Service


GitHub feedback
The source for this content can Azure Kubernetes Service is an open
be found on GitHub, where you source project. Select a link to
can also create and review provide feedback:
issues and pull requests. For
more information, see our  Open a documentation issue
contributor guide.
 Provide product feedback
Quickstart: Create an Azure Container
Instance with a public IP address using
Terraform
Article • 07/05/2023

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "container_name" {


length = 25
lower = true
upper = false
special = false
}

resource "azurerm_container_group" "container" {


name =
"${var.container_group_name_prefix}-${random_string.container_name.resu
lt}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
ip_address_type = "Public"
os_type = "Linux"
restart_policy = var.restart_policy

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"
}
}
}

3. Create a file named outputs.tf and insert the following code:

Terraform

output "container_ipv4_address" {
value = azurerm_container_group.container.ip_address
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. When you apply the execution plan, Terraform outputs the public IP address. To
display the IP address again, run terraform output .

Console

terraform output -raw container_ipv4_address

2. Enter the sample's public IP address in your browser's address bar.

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article shows how to use Terraform to deploy an Azure Cosmos DB to Azure
Container Instances.

In this article, you learn how to:

" Create an Azure Cosmos DB instance


" Create an Azure Container Instance
" Create an app that works across these two resources

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

Implement the Terraform code


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 = ">=1.0"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "azurerm_resource_group" "rg" {


name = "${random_pet.rg_name.id}-rg"
location = var.resource_group_location
}

resource "azurerm_cosmosdb_account" "vote_cosmos_db" {


name =
"${random_pet.rg_name.id}-${random_integer.ri.result}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
offer_type = "Standard"
kind = "GlobalDocumentDB"

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
}
}

resource "random_integer" "ri" {


min = 10000
max = 99999
}

resource "random_pet" "rg_name" {


prefix = var.prefix
}

4. Create a file named aci.tf and insert the following code:

Terraform

resource "azurerm_container_group" "main" {


name = "${random_pet.rg_name.id}-vote-aci"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
ip_address_type = "Public"
dns_name_label = "vote-aci-${random_integer.ri.result}"
os_type = "Linux"

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"
}
}
}

5. Create a file named variables.tf and insert the following code:

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"
}

6. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.
Verify the results
1. Get the resource group name.

Console

echo "$(terraform output resource_group_name)"

2. Get the Azure Cosmos DB account name.

Console

echo "$(terraform output cosmosdb_account_name)"

3. Run az cosmosdb sql database list/

Azure CLI

az cosmosdb sql database list \


--resource-group <resource_group_name> \
--account-name <cosmosdb_account_name>

Test application
1. Get the Azure Cosmos DB account name.

Console

echo "$(terraform output dns)"

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:

1. Run terraform plan and specify the destroy flag.

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article shows how to use Terraform to deploy an Azure Cosmos DB to Azure
Container Instances.

In this article, you learn how to:

" Create an Azure Cosmos DB instance


" Create an Azure Container Instance
" Create an app that works across these two resources

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

Implement the Terraform code


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 = ">=1.0"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "azurerm_resource_group" "rg" {


name = "${random_pet.rg_name.id}-rg"
location = var.resource_group_location
}

resource "azurerm_cosmosdb_account" "vote_cosmos_db" {


name =
"${random_pet.rg_name.id}-${random_integer.ri.result}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
offer_type = "Standard"
kind = "GlobalDocumentDB"

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
}
}

resource "random_integer" "ri" {


min = 10000
max = 99999
}

resource "random_pet" "rg_name" {


prefix = var.prefix
}

4. Create a file named aci.tf and insert the following code:

Terraform

resource "azurerm_container_group" "main" {


name = "${random_pet.rg_name.id}-vote-aci"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
ip_address_type = "Public"
dns_name_label = "vote-aci-${random_integer.ri.result}"
os_type = "Linux"

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"
}
}
}

5. Create a file named variables.tf and insert the following code:

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"
}

6. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.
Verify the results
1. Get the resource group name.

Console

echo "$(terraform output resource_group_name)"

2. Get the Azure Cosmos DB account name.

Console

echo "$(terraform output cosmosdb_account_name)"

3. Run az cosmosdb sql database list/

Azure CLI

az cosmosdb sql database list \


--resource-group <resource_group_name> \
--account-name <cosmosdb_account_name>

Test application
1. Get the Azure Cosmos DB account name.

Console

echo "$(terraform output dns)"

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:

1. Run terraform plan and specify the destroy flag.

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Learn more about using Terraform in Azure
Quickstart: Create an Azure SQL
Database server and database using
Terraform
Article • 03/07/2024

Applies to: Azure SQL Database

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_pet" "azurerm_mssql_server_name" {


prefix = "sql"
}

resource "random_password" "admin_password" {


count = var.admin_password == null ? 1 : 0
length = 20
special = true
min_numeric = 1
min_upper = 1
min_lower = 1
min_special = 1
}

locals {
admin_password = try(random_password.admin_password[0].result,
var.admin_password)
}

resource "azurerm_mssql_server" "server" {


name =
random_pet.azurerm_mssql_server_name.id
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
administrator_login = var.admin_username
administrator_login_password = local.admin_password
version = "12.0"
}

resource "azurerm_mssql_database" "db" {


name = var.sql_db_name
server_id = azurerm_mssql_server.server.id
}

4. Create a file named variables.tf and insert the following code:

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
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)


2. Get the new logical server name.

Console

sql_server_name=$(terraform output -raw sql_server_name)

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:

1. Run terraform plan and specify the destroy flag.

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan


Troubleshoot Terraform on Azure
Troubleshoot common problems when using Terraform on Azure

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

Provide product feedback


Quickstart: Create an instance of Azure
Database for MySQL - Flexible Server by
using Terraform
Article • 06/18/2024

APPLIES TO: Azure Database for MySQL - Flexible Server

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.

In this article, you learn how to:

" Create an Azure resource group by using azurerm_resource_group .


" Create an Azure virtual network by using azurerm_virtual_network .
" Create an Azure subnet by using azurerm_subnet .
" Define a private DNS zone within an instance of Azure DNS by using
azurerm_private_dns_zone .
" Define a private DNS zone virtual network link by using
azurerm_private_dns_zone_virtual_network_link .
" Deploy Azure Database for MySQL - Flexible Server by using
azurerm_mysql_flexible_server .
" Deploy a database by using azurerm_mysql_flexible_database .

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.

Install and configure Terraform

Implement the Terraform code


1. Create a directory that you can use to test the sample Terraform code. Make the
Terraform directory the current directory.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

# Generate random resource group name


resource "random_pet" "rg_name" {
prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


location = var.resource_group_location
name = random_pet.rg_name.id
}

# Generate random value for the name


resource "random_string" "name" {
length = 8
lower = true
numeric = false
special = false
upper = false
}

# Generate random value for the login password


resource "random_password" "password" {
length = 8
lower = true
min_lower = 1
min_numeric = 1
min_special = 1
min_upper = 1
numeric = true
override_special = "_"
special = true
upper = true
}

# Manages the Virtual Network


resource "azurerm_virtual_network" "default" {
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.rg.location
name = "vnet-${random_string.name.result}"
resource_group_name = azurerm_resource_group.rg.name
}

# Manages the Subnet


resource "azurerm_subnet" "default" {
address_prefixes = ["10.0.2.0/24"]
name = "subnet-${random_string.name.result}"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.default.name
service_endpoints = ["Microsoft.Storage"]

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
}

# Enables you to manage Private DNS zone Virtual Network Links


resource "azurerm_private_dns_zone_virtual_network_link" "default" {
name =
"mysqlfsVnetZone${random_string.name.result}.com"
private_dns_zone_name = azurerm_private_dns_zone.default.name
resource_group_name = azurerm_resource_group.rg.name
virtual_network_id = azurerm_virtual_network.default.id

depends_on = [azurerm_subnet.default]
}

# Manages the MySQL Flexible Server


resource "azurerm_mysql_flexible_server" "default" {
location = azurerm_resource_group.rg.location
name = "mysqlfs-${random_string.name.result}"
resource_group_name = azurerm_resource_group.rg.name
administrator_login = random_string.name.result
administrator_password = random_password.password.result
backup_retention_days = 7
delegated_subnet_id = azurerm_subnet.default.id
geo_redundant_backup_enabled = false
private_dns_zone_id = azurerm_private_dns_zone.default.id
sku_name = "GP_Standard_D2ds_v4"
version = "8.0.21"

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]
}

4. Create a file named mysql-fs-db.tf and insert the following code:

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
}

5. Create a file named variables.tf and insert the following code:

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."
}

6. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

To display the Azure Database for MySQL - Flexible Server database, run az mysql
flexible-server db show:

Azure CLI

az mysql flexible-server db show \


--resource-group <resource_group_name> \
--server-name <azurerm_mysql_flexible_server> \
--database-name <mysql_flexible_server_database_name>

Consider the following key points:

The values for <resource_group_name> , <azurerm_mysql_flexible_server> , and


<mysql_flexible_server_database_name> are displayed in the terraform apply

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:

1. Run terraform plan and specify the destroy flag.

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Explore how to troubleshoot common problems for using Terraform on Azure.

Next step
Connect to an instance of Azure Database for MySQL - Flexible Server by using
private access

Feedback
Was this page helpful?  Yes  No

Provide product feedback


Quickstart: Create a lab in Azure DevTest
Labs 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 a Windows Server 2019 Datacenter
virtual machine in a lab within Azure DevTest Labs using Terraform.

In this article, you learn how to:

" 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

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "random_string" "vm_suffix" {


length = 5
upper = false
special = false
numeric = false
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_password" "password" {


count = var.password == null ? 1 : 0
length = 20
special = true
min_numeric = 1
min_upper = 1
min_lower = 1
min_special = 1
}

locals {
password = try(random_password.password[0].result, var.password)
}

resource "azurerm_dev_test_lab" "lab" {


name = var.lab_name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}

resource "azurerm_dev_test_virtual_network" "vnet" {


name = "Dtl${var.lab_name}"
lab_name = azurerm_dev_test_lab.lab.name
resource_group_name = azurerm_resource_group.rg.name
}

resource "azurerm_dev_test_windows_virtual_machine" "vm" {


name =
"ExampleVM-${random_string.vm_suffix.result}"
lab_name = azurerm_dev_test_lab.lab.name
lab_subnet_name = "Dtl${var.lab_name}Subnet"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
storage_type = "Standard"
size = var.vm_size
username = var.user_name
password = local.password
allow_claim = false
lab_virtual_network_id = azurerm_dev_test_virtual_network.vnet.id

gallery_image_reference {
offer = "WindowsServer"
publisher = "MicrosoftWindowsServer"
sku = "2019-Datacenter"
version = "latest"
}
}

3. Create a file named outputs.tf and insert the following code:

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
}

4. 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"
}
}
}
provider "azurerm" {
features {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. Get the Azure resource name in which the lab was created.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the lab name.

Console

lab_name=$(terraform output -raw lab_name)

3. Run az lab vm list to list the virtual machines for the lab you created in this article.

Azure CLI

az lab vm list --resource-group $resource_group_name \


--lab-name $lab_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Tutorial: Work with lab VMs

Feedback
Was this page helpful?  Yes  No

Provide product feedback | Get help at Microsoft Q&A


Quickstart: Create a lab in Azure DevTest
Labs 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 a Windows Server 2019 Datacenter
virtual machine in a lab within Azure DevTest Labs using Terraform.

In this article, you learn how to:

" 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

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "random_string" "vm_suffix" {


length = 5
upper = false
special = false
numeric = false
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_password" "password" {


count = var.password == null ? 1 : 0
length = 20
special = true
min_numeric = 1
min_upper = 1
min_lower = 1
min_special = 1
}

locals {
password = try(random_password.password[0].result, var.password)
}

resource "azurerm_dev_test_lab" "lab" {


name = var.lab_name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}

resource "azurerm_dev_test_virtual_network" "vnet" {


name = "Dtl${var.lab_name}"
lab_name = azurerm_dev_test_lab.lab.name
resource_group_name = azurerm_resource_group.rg.name
}

resource "azurerm_dev_test_windows_virtual_machine" "vm" {


name =
"ExampleVM-${random_string.vm_suffix.result}"
lab_name = azurerm_dev_test_lab.lab.name
lab_subnet_name = "Dtl${var.lab_name}Subnet"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
storage_type = "Standard"
size = var.vm_size
username = var.user_name
password = local.password
allow_claim = false
lab_virtual_network_id = azurerm_dev_test_virtual_network.vnet.id

gallery_image_reference {
offer = "WindowsServer"
publisher = "MicrosoftWindowsServer"
sku = "2019-Datacenter"
version = "latest"
}
}

3. Create a file named outputs.tf and insert the following code:

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
}

4. 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"
}
}
}
provider "azurerm" {
features {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. Get the Azure resource name in which the lab was created.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the lab name.

Console

lab_name=$(terraform output -raw lab_name)

3. Run az lab vm list to list the virtual machines for the lab you created in this article.

Azure CLI

az lab vm list --resource-group $resource_group_name \


--lab-name $lab_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Tutorial: Work with lab VMs

Feedback
Was this page helpful?  Yes  No

Provide product feedback | Get help at Microsoft Q&A


Quickstart: Create an Azure API
Management instance using Terraform
Article • 03/21/2024

APPLIES TO: Developer | Standard | Premium

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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.

Install and configure Terraform

For Azure CLI:


Use the Bash environment in Azure Cloud Shell. For more information, see
Quickstart for Bash in Azure Cloud Shell.

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.

For Azure PowerShell:


If you choose to use Azure PowerShell locally:
Install the latest version of the Az PowerShell module.
Connect to your Azure account using the Connect-AzAccount cmdlet.
If you choose to use Azure Cloud Shell:
See Overview of Azure Cloud Shell for more information.

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_api_management_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_api_management" "api" {


name =
"apiservice${random_string.azurerm_api_management_name.result}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
publisher_email = var.publisher_email
publisher_name = var.publisher_name
sku_name = "${var.sku}_${var.sku_count}"
}

3. Create a file named outputs.tf and insert the following code:

Terraform

output "resource_group_name" {
value = azurerm_resource_group.rg.name
}

output "api_management_service_name" {
value = azurerm_api_management.api.name
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the service name.

Console
api_management_service_name=$(terraform output -raw
api_management_service_name)

3. Run az apim show to display information about the new service.

Azure CLI

az apim show --resource-group $resource_group_name \


--name $api_management_service_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure
Next steps
Tutorial: Import and publish your first API

) Note: The author created this article with assistance from AI. Learn more

Feedback
Was this page helpful?  Yes  No

Provide product feedback


Quickstart: Create an Azure API
Management instance using Terraform
Article • 03/21/2024

APPLIES TO: Developer | Standard | Premium

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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.

Install and configure Terraform

For Azure CLI:


Use the Bash environment in Azure Cloud Shell. For more information, see
Quickstart for Bash in Azure Cloud Shell.

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.

For Azure PowerShell:


If you choose to use Azure PowerShell locally:
Install the latest version of the Az PowerShell module.
Connect to your Azure account using the Connect-AzAccount cmdlet.
If you choose to use Azure Cloud Shell:
See Overview of Azure Cloud Shell for more information.

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_api_management_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_api_management" "api" {


name =
"apiservice${random_string.azurerm_api_management_name.result}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
publisher_email = var.publisher_email
publisher_name = var.publisher_name
sku_name = "${var.sku}_${var.sku_count}"
}

3. Create a file named outputs.tf and insert the following code:

Terraform

output "resource_group_name" {
value = azurerm_resource_group.rg.name
}

output "api_management_service_name" {
value = azurerm_api_management.api.name
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the service name.

Console
api_management_service_name=$(terraform output -raw
api_management_service_name)

3. Run az apim show to display information about the new service.

Azure CLI

az apim show --resource-group $resource_group_name \


--name $api_management_service_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure
Next steps
Tutorial: Import and publish your first API

) Note: The author created this article with assistance from AI. Learn more

Feedback
Was this page helpful?  Yes  No

Provide product feedback


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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article shows how to use Terraform to deploy an Azure Cosmos DB to Azure
Container Instances.

In this article, you learn how to:

" Create an Azure Cosmos DB instance


" Create an Azure Container Instance
" Create an app that works across these two resources

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

Implement the Terraform code


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 = ">=1.0"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "azurerm_resource_group" "rg" {


name = "${random_pet.rg_name.id}-rg"
location = var.resource_group_location
}

resource "azurerm_cosmosdb_account" "vote_cosmos_db" {


name =
"${random_pet.rg_name.id}-${random_integer.ri.result}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
offer_type = "Standard"
kind = "GlobalDocumentDB"

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
}
}

resource "random_integer" "ri" {


min = 10000
max = 99999
}

resource "random_pet" "rg_name" {


prefix = var.prefix
}

4. Create a file named aci.tf and insert the following code:

Terraform

resource "azurerm_container_group" "main" {


name = "${random_pet.rg_name.id}-vote-aci"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
ip_address_type = "Public"
dns_name_label = "vote-aci-${random_integer.ri.result}"
os_type = "Linux"

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"
}
}
}

5. Create a file named variables.tf and insert the following code:

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"
}

6. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.
Verify the results
1. Get the resource group name.

Console

echo "$(terraform output resource_group_name)"

2. Get the Azure Cosmos DB account name.

Console

echo "$(terraform output cosmosdb_account_name)"

3. Run az cosmosdb sql database list/

Azure CLI

az cosmosdb sql database list \


--resource-group <resource_group_name> \
--account-name <cosmosdb_account_name>

Test application
1. Get the Azure Cosmos DB account name.

Console

echo "$(terraform output dns)"

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:

1. Run terraform plan and specify the destroy flag.

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = "rg"
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_pet" "stream_analytics_job_name" {


prefix = "job"
}

resource "azurerm_stream_analytics_job" "job" {


name =
random_pet.stream_analytics_job_name.id
resource_group_name =
azurerm_resource_group.rg.name
location =
azurerm_resource_group.rg.location
streaming_units =
var.number_of_streaming_units
events_out_of_order_max_delay_in_seconds = 0
events_late_arrival_max_delay_in_seconds = 5
data_locale = "en-US"
events_out_of_order_policy = "Adjust"
output_error_policy = "Stop"

transformation_query = <<QUERY
SELECT
*
INTO
[YourOutputAlias]
FROM
[YourInputAlias]
QUERY

4. Create a file named variables.tf and insert the following code:

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."
}
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the new Azure Stream Analytics job name.

Console

stream_analytics_job_name=$(terraform output -raw


stream_analytics_job_name)

3. Run az stream-analytics job show to display information about the job.

Azure CLI

az stream-analytics job show \


--resource-group $resource_group_name \
--job-name $stream_analytics_job_name

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
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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax. The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

Create a Storage Account & Storage Container


Create an Event Hubs, Namespace, & Authorization Rule
Create an IoT Hub
Link IoT Hub to Storage Account endpoint & Event Hubs endpoint
Create an IoT Hub Shared Access Policy
Create a DPS Resource
Link DPS & IoT Hub

Prerequisites
Azure subscription: If you don't have an Azure subscription, create a free
account before you begin.

Install and configure Terraform

Implement the Terraform code

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.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


location = var.resource_group_location
name = random_pet.rg_name.id
}

# Create storage account & container


resource "random_string" "sa_name" {
length = 12
special = false
upper = false
}
resource "azurerm_storage_account" "sa" {
name = random_string.sa_name.id
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
account_tier = "Standard"
account_replication_type = "LRS"
}

resource "azurerm_storage_container" "my_terraform_container" {


name = "mycontainer"
storage_account_name = azurerm_storage_account.sa.name
container_access_type = "private"
}

# Create an Event Hub & Authorization Rule


resource "random_pet" "eventhub_namespace_name" {
prefix = var.eventhub_namespace_name_prefix
}

resource "azurerm_eventhub_namespace" "namespace" {


name = random_pet.eventhub_namespace_name.id
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = "Basic"
}

resource "azurerm_eventhub" "my_terraform_eventhub" {


name = "myEventHub"
resource_group_name = azurerm_resource_group.rg.name
namespace_name = azurerm_eventhub_namespace.namespace.name
partition_count = 2
message_retention = 1
}

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
}

# Create an IoT Hub


resource "random_pet" "iothub_name" {
prefix = var.iothub_name_prefix
length = 1
}

resource "azurerm_iothub" "iothub" {


name = random_pet.iothub_name.id
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku {
name = "S1"
capacity = 1
}

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"
}
}

#Create IoT Hub Access Policy


resource "azurerm_iothub_shared_access_policy" "hub_access_policy" {
name = "terraform-policy"
resource_group_name = azurerm_resource_group.rg.name
iothub_name = azurerm_iothub.iothub.name

registry_read = true
registry_write = true
service_connect = true
}

# Create IoT Hub DPS


resource "random_pet" "dps_name" {
prefix = var.dps_name_prefix
length = 1
}

resource "azurerm_iothub_dps" "dps" {


name = random_pet.dps_name.id
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
allocation_policy = "Hashed"

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
}
}

4. Create a file named variables.tf 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."
}

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."
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Bash

Run az iot dps show to display the Azure DPS resource.

Azure CLI

az iot dps show \


--name <azurerm_iothub_dps_name> \
--resource-group <resource_group_name>

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:

1. Run terraform plan and specify the destroy flag.

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Quickstart: Provision a simulated symmetric key device


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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_notification_hub_namespace_name" {


length = 25
upper = false
numeric = false
special = false
}

resource "azurerm_notification_hub_namespace" "namespace" {


name =
"hubns-${random_string.azurerm_notification_hub_namespace_name.result}"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
namespace_type = "NotificationHub"
sku_name = "Free"
}

resource "random_string" "azurerm_notification_hub_name" {


length = 25
upper = false
numeric = false
special = false
}

resource "azurerm_notification_hub" "hub" {


name =
"hub-${random_string.azurerm_notification_hub_name.result}"
resource_group_name = azurerm_resource_group.rg.name
namespace_name =
azurerm_notification_hub_namespace.namespace.name
location = azurerm_resource_group.rg.location
}

4. Create a file named variables.tf and insert the following code:

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."
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the namespace name.

Console

notification_hub_namespace_name=$(terraform output -raw


notification_hub_namespace_name)

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:

1. Run terraform plan and specify the destroy flag.

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

When assigning a built-in policy or initiative definition, it's optional to reference a


version. Policy assignments of built-in definitions default to the latest version and
automatically inherit minor version changes unless otherwise specified.

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.

Create the Terraform configuration, variable,


and output file
In this quickstart, you create a policy assignment and assign the Audit VMs that do not
use managed disks definition. This policy definition identifies resources that aren't
compliant to the conditions set in the policy definition.

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.

2. Create main.tf with the following code:


7 Note

To create a Policy Assignment at a Management Group use the


azurerm_management_group_policy_assignment resource, for a Resource
Group use the azurerm_resource_group_policy_assignment and for a
Subscription use the azurerm_subscription_policy_assignment resource.

Terraform

provider "azurerm" {
features {}
}

terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 2.96.0"
}
}
}

resource "azurerm_subscription_policy_assignment" "auditvms" {


name = "audit-vm-manageddisks"
subscription_id = var.cust_scope
policy_definition_id =
"/providers/Microsoft.Authorization/policyDefinitions/06a78e20-9358-
41c9-923c-fb736d382a4d"
description = "Shows all virtual machines not using managed disks"
display_name = "Audit VMs without managed disks assignment"
}

3. Create variables.tf with the following code:

Terraform

variable "cust_scope" {
default = "{scope}"
}

A scope determines what resources or grouping of resources the policy


assignment gets enforced on. It could range from a management group to an
individual resource. Be sure to replace {scope} with one of the following patterns
based on the declared resource:

Subscription: /subscriptions/{subscriptionId}
Resource group:
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}

Resource:
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/provi

ders/{resourceProviderNamespace}/[{parentResourcePath}/]

4. Create output.tf with the following code:

Terraform

output "assignment_id" {
value = azurerm_subscription_policy_assignment.auditvms.id
}

Initialize Terraform and create plan


Initialize Terraform to download the necessary providers and then create a plan.

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

terraform plan -out assignment.tfplan

7 Note

For information about persisting execution plans and security, see Terraform
Plan: Security Warning .

Apply the Terraform execution plan


Apply the execution plan.

Run the terraform apply command and specify the assignment.tfplan already
created.

Bash

terraform apply assignment.tfplan


With the Apply complete! Resources: 1 added, 0 changed, 0 destroyed. message, the
policy assignment is now created. Since we defined the outputs.tf file, the
assignment_id is also returned.

Identify non-compliant resources


To view the resources that aren't compliant under this new assignment, use the
assignment_id returned by terraform apply . With it, run the following command to get
the resource IDs of the non-compliant resources that are output into a JSON file:

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>

Your results resemble the following example:

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

az policy assignment delete --name 'audit-vm-manageddisks' --scope


'/subscriptions/<subscriptionID>/<resourceGroupName>'

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:

Tutorial: Create and manage policies to enforce compliance

Feedback
Was this page helpful?  Yes  No

Provide product feedback


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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_traffic_manager_profile_name" {


length = 25
upper = false
numeric = false
special = false
}

resource "random_string"
"azurerm_traffic_manager_profile_dns_config_relative_name" {
length = 10
upper = false
numeric = false
special = false
}

resource "azurerm_traffic_manager_profile" "profile" {


name =
random_string.azurerm_traffic_manager_profile_name.result
resource_group_name = azurerm_resource_group.rg.name
traffic_routing_method = "Performance"
dns_config {
relative_name =
random_string.azurerm_traffic_manager_profile_dns_config_relative_name.
result
ttl = 30
}

monitor_config {
protocol = "HTTPS"
port = 443
path = "/"
expected_status_code_ranges = ["200-202", "301-302"]
}
}

resource "azurerm_traffic_manager_external_endpoint" "endpoint1" {


profile_id = azurerm_traffic_manager_profile.profile.id
name = "endpoint1"
target = "www.contoso.com"
endpoint_location = "eastus"
weight = 50
}

resource "azurerm_traffic_manager_external_endpoint" "endpoint2" {


profile_id = azurerm_traffic_manager_profile.profile.id
name = "endpoint2"
target = "www.fabrikam.com"
endpoint_location = "westus"
weight = 50
}

4. Create a file named variables.tf and insert the following code:

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"
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the Traffic Manager profile name.

Console
traffic_manager_profile_name=$(terraform output -raw
azurerm_traffic_manager_profile_name)

3. Run az network traffic-manager profile show to display information about the


new Traffic Manager profile.

Azure CLI

az network traffic-manager profile show \


--resource-group $resource_group_name \
--name $traffic_manager_profile_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan


Troubleshoot Terraform on Azure
Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "aazurerm_cdn_profile_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_cdn_profile" "profile" {


name =
"profile-${random_string.azurerm_cdn_endpoint_name.result}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku = var.cdn_sku
}

resource "random_string" "azurerm_cdn_endpoint_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_cdn_endpoint" "endpoint" {


name =
"endpoint-${random_string.azurerm_cdn_endpoint_name.result}"
profile_name = azurerm_cdn_profile.profile.name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
is_http_allowed = true
is_https_allowed = true
querystring_caching_behaviour = "IgnoreQueryString"
is_compression_enabled = true
content_types_to_compress = [
"application/eot",
"application/font",
"application/font-sfnt",
"application/javascript",
"application/json",
"application/opentype",
"application/otf",
"application/pkcs7-mime",
"application/truetype",
"application/ttf",
"application/vnd.ms-fontobject",
"application/xhtml+xml",
"application/xml",
"application/xml+rss",
"application/x-font-opentype",
"application/x-font-truetype",
"application/x-font-ttf",
"application/x-httpd-cgi",
"application/x-javascript",
"application/x-mpegurl",
"application/x-opentype",
"application/x-otf",
"application/x-perl",
"application/x-ttf",
"font/eot",
"font/ttf",
"font/otf",
"font/opentype",
"image/svg+xml",
"text/css",
"text/csv",
"text/html",
"text/javascript",
"text/js",
"text/plain",
"text/richtext",
"text/tab-separated-values",
"text/xml",
"text/x-script",
"text/x-component",
"text/x-java-source",
]

origin {
name = "origin1"
host_name = var.origin_url
}
}

3. Create a file named outputs.tf and insert the following code:

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
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name in which the Azure CDN profile and
endpoint were created.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the CDN profile name.

Console
cdn_profile_name=$(terraform output -raw cdn_profile_name)

3. Get the CDN endpoint name.

Console

cdn_endpoint_endpoint_name=$(terraform output -raw


cdn_endpoint_endpoint_name)

4. Run az cdn custom-domain show to show details of the custom domain you
created in this article.

Azure CLI

az cdn endpoint show --resource-group $resource_group_name \


--profile-name $cdn_profile_name \
--name $cdn_endpoint_endpoint_name

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

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.

2. Run terraform apply to apply the execution plan.


Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

APPLIES TO: Developer | Standard | Premium

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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.

Install and configure Terraform

For Azure CLI:


Use the Bash environment in Azure Cloud Shell. For more information, see
Quickstart for Bash in Azure Cloud Shell.

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.

For Azure PowerShell:


If you choose to use Azure PowerShell locally:
Install the latest version of the Az PowerShell module.
Connect to your Azure account using the Connect-AzAccount cmdlet.
If you choose to use Azure Cloud Shell:
See Overview of Azure Cloud Shell for more information.

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_api_management_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_api_management" "api" {


name =
"apiservice${random_string.azurerm_api_management_name.result}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
publisher_email = var.publisher_email
publisher_name = var.publisher_name
sku_name = "${var.sku}_${var.sku_count}"
}

3. Create a file named outputs.tf and insert the following code:

Terraform

output "resource_group_name" {
value = azurerm_resource_group.rg.name
}

output "api_management_service_name" {
value = azurerm_api_management.api.name
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the service name.

Console
api_management_service_name=$(terraform output -raw
api_management_service_name)

3. Run az apim show to display information about the new service.

Azure CLI

az apim show --resource-group $resource_group_name \


--name $api_management_service_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure
Next steps
Tutorial: Import and publish your first API

) Note: The author created this article with assistance from AI. Learn more

Feedback
Was this page helpful?  Yes  No

Provide product feedback


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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_cognitive_account_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_cognitive_account" "cognitive_service" {


name =
"CognitiveService-${random_string.azurerm_cognitive_account_name.result
}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku_name = var.sku
kind = "CognitiveServices"
}

3. Create a file named outputs.tf and insert the following code:

Terraform

output "resource_group_name" {
value = azurerm_resource_group.rg.name
}
output "azurerm_cognitive_account_name" {
value = azurerm_cognitive_account.cognitive_service.name
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource name in which the Azure AI services account was
created.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the Azure AI services account name.

Console

azurerm_cognitive_account_name=$(terraform output -raw


azurerm_cognitive_account_name)

3. Run az cognitiveservices account show to show the Azure AI services account


you created in this article.

Azure CLI

az cognitiveservices account show --name


$azurerm_cognitive_account_name \
--resource-group
$resource_group_name

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

" 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 an Azure public IP using azurerm_public_ip
" Create an Azure Application Gateway using azurerm_application_gateway
" Create an Azure network interface using azurerm_network_interface
" Create an Azure network interface application gateway backend address pool
association using
azurerm_network_interface_application_gateway_backend_address_pool_association
" Create an Azure Windows Virtual Machine using azurerm_windows_virtual_machine
" Create an Azure Virtual Machine Extension using
azurerm_virtual_machine_extension
7 Note

Application Gateway frontend now supports dual-stack IP addresses (Preview). You


can now create up to four frontend IP addresses: Two IPv4 addresses (public and
private) and two IPv6 addresses (public and private).

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.

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_string" "rg" {


length = 8
upper = false
special = false
}

resource "azurerm_resource_group" "rg" {


name = "101-application-gateway-${random_string.rg.result}"
location = "eastus"
}

resource "azurerm_virtual_network" "vnet" {


name = "myVNet"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
address_space = ["10.21.0.0/16"]
}

resource "azurerm_subnet" "frontend" {


name = "myAGSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.21.0.0/24"]
}

resource "azurerm_subnet" "backend" {


name = "myBackendSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.21.1.0/24"]
}

resource "azurerm_public_ip" "pip" {


name = "myAGPublicIPAddress"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_application_gateway" "main" {


name = "myAppGateway"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku {
name = "Standard_v2"
tier = "Standard_v2"
capacity = 2
}

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" "nic" {


count = 2
name = "nic-${count.index+1}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
ip_configuration {
name = "nic-ipconfig-${count.index+1}"
subnet_id = azurerm_subnet.backend.id
private_ip_address_allocation = "Dynamic"
}
}

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
}

resource "random_password" "password" {


length = 16
special = true
lower = true
upper = true
numeric = true
}

resource "azurerm_windows_virtual_machine" "vm" {


count = 2
name = "myVM${count.index+1}"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
size = "Standard_DS1_v2"
admin_username = "azureadmin"
admin_password = random_password.password.result

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"
}
}

resource "azurerm_virtual_machine_extension" "vm-extensions" {


count = 2
name = "vm${count.index+1}-ext"
virtual_machine_id =
azurerm_windows_virtual_machine.vm[count.index].id
publisher = "Microsoft.Compute"
type = "CustomScriptExtension"
type_handler_version = "1.10"

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 .

4. Create a file named variables.tf and insert the following code:

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"
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. When you apply the execution plan, Terraform displays the frontend public IP
address. If you've cleared the screen, you can retrieve that value with the following
Terraform command:

Console

echo $(terraform output -raw gateway_frontend_ip)

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:

1. Run terraform plan and specify the destroy flag.

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "ddos_protection_plan" {


length = 13
upper = false
numeric = false
special = false
}

resource "azurerm_network_ddos_protection_plan" "ddos" {


name = random_string.ddos_protection_plan.result
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
}

resource "random_string" "virtual_network_name" {


length = 13
upper = false
numeric = false
special = false
}

resource "azurerm_virtual_network" "vnet" {


name = random_string.virtual_network_name.result
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
address_space = [var.vnet_address_prefix]

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
}
}

4. Create a file named variables.tf and insert the following code:

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
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.
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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console
resource_group_name=$(terraform output -raw resource_group_name)

2. Get the DDoS protection plan name.

Console

ddos_protection_plan_name=$(terraform output -raw


ddos_protection_plan_name)

3. Run az network ddos-protection show to display information about the new


DDoS protection plan.

Azure CLI

az network ddos-protection show \


--resource-group $resource_group_name \
--name $ddos_protection_plan_name

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

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 .
2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

Implement the Terraform code

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_dns_zone_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_dns_zone" "zone" {


name = (
var.dns_zone_name != null ?
var.dns_zone_name :

"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
}

4. Create a file named variables.tf and insert the following code:

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."
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .
Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the DNS zone name.

Console

dns_zone_name=$(terraform output -raw dns_zone_name)

3. Run az network dns zone show to display information about the new DNS
zone.

Azure CLI

az network dns zone show \


--resource-group $resource_group_name \
--name $dns_zone_name
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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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.

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"
}
azapi = {
source = "azure/azapi"
version = "~>1.5"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named ssh.tf and insert the following code:

Terraform

resource "random_pet" "ssh_key_name" {


prefix = "ssh"
separator = ""
}

resource "azapi_resource_action" "ssh_public_key_gen" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
resource_id = azapi_resource.ssh_public_key.id
action = "generateKeyPair"
method = "POST"

response_export_values = ["publicKey", "privateKey"]


}

resource "azapi_resource" "ssh_public_key" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
name = random_pet.ssh_key_name.id
location = azurerm_resource_group.rg.location
parent_id = azurerm_resource_group.rg.id
}

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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "random_string" "storage_account_name" {


length = 8
lower = true
numeric = false
special = false
upper = false
}

resource "random_password" "password" {


length = 20
min_lower = 1
min_upper = 1
min_numeric = 1
min_special = 1
special = true
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "azurerm_public_ip" "pip_azfw" {


name = "pip-azfw"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_storage_account" "sa" {


name = random_string.storage_account_name.result
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"
}

resource "azurerm_firewall_policy" "azfw_policy" {


name = "azfw-policy"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = var.firewall_sku_tier
threat_intelligence_mode = "Alert"
}

resource "azurerm_firewall_policy_rule_collection_group" "prcg" {


name = "prcg"
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
priority = 300
application_rule_collection {
name = "app-rule-collection-1"
priority = 101
action = "Allow"
rule {
name = "someAppRule"
protocols {
type = "Https"
port = 443
}
destination_fqdns = ["*bing.com"]
source_ip_groups = [azurerm_ip_group.ip_group_1.id]
}
}
network_rule_collection {
name = "net-rule-collection-1"
priority = 200
action = "Allow"
rule {
name = "someNetRule"
protocols = ["TCP", "UDP", "ICMP"]
source_ip_groups = [azurerm_ip_group.ip_group_1.id]
destination_ip_groups = [azurerm_ip_group.ip_group_2.id]
destination_ports = ["90"]
}
}
}

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
}
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
}

resource "azurerm_ip_group" "ip_group_1" {


name = "ip-group_1"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
cidrs = ["13.73.64.64/26", "13.73.208.128/25",
"52.126.194.0/23"]
}
resource "azurerm_ip_group" "ip_group_2" {
name = "ip_group_2"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
cidrs = ["12.0.0.0/24", "13.9.0.0/24"]
}

resource "azurerm_virtual_network" "azfw_vnet" {


name = "azfw-vnet"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
address_space = ["10.10.0.0/16"]
}

resource "azurerm_subnet" "azfw_subnet" {


name = "AzureFirewallSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.0.0/26"]
}

resource "azurerm_subnet" "server_subnet" {


name = "subnet-server"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.1.0/24"]
}

resource "azurerm_subnet" "jump_subnet" {


name = "subnet-jump"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.2.0/24"]
}

resource "azurerm_public_ip" "vm_jump_pip" {


name = "pip-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_network_interface" "vm_server_nic" {


name = "nic-server"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

ip_configuration {
name = "ipconfig-workload"
subnet_id = azurerm_subnet.server_subnet.id
private_ip_address_allocation = "Dynamic"
}
}

resource "azurerm_network_interface" "vm_jump_nic" {


name = "nic-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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_security_group" "vm_server_nsg" {


name = "nsg-server"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}

resource "azurerm_network_security_group" "vm_jump_nsg" {


name = "nsg-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
security_rule {
name = "Allow-SSH"
priority = 1000
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

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_linux_virtual_machine" "vm_server" {


name = "server-vm"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
size = var.virtual_machine_size
admin_username = var.admin_username
admin_ssh_key {
username = var.admin_username
public_key =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
network_interface_ids = [azurerm_network_interface.vm_server_nic.id]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "18.04-LTS"
version = "latest"
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.sa.primary_blob_endpoint
}
}

resource "azurerm_linux_virtual_machine" "vm_jump" {


name = "jump-vm"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
size = var.virtual_machine_size
network_interface_ids = [azurerm_network_interface.vm_jump_nic.id]
admin_username = var.admin_username
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
admin_ssh_key {
username = var.admin_username
public_key =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "18.04-LTS"
version = "latest"
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.sa.primary_blob_endpoint
}
computer_name = "JumpBox"

resource "azurerm_route_table" "rt" {


name = "rt-azfw-eus"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
disable_bgp_route_propagation = false
route {
name = "azfwDefaultRoute"
address_prefix = "0.0.0.0/0"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address =
azurerm_firewall.fw.ip_configuration[0].private_ip_address
}
}

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
}

5. Create a file named variables.tf and insert the following code:

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"
}

6. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Run az network ip-group list to display the two new IP Groups.

Azure CLI

az network ip-group list --resource-group $resource_group_name

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

For more information about Azure Firewall with multiple public IP addresses, see Deploy
an Azure Firewall with multiple public IP addresses using Azure PowerShell.

In this article, you learn how to:

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

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.

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 {
virtual_machine {
delete_os_disk_on_deletion = true
skip_shutdown_and_force_delete = true
}
}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "random_password" "password" {


count = 2
length = 20
min_lower = 1
min_upper = 1
min_numeric = 1
min_special = 1
special = true
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "azurerm_public_ip_prefix" "pip_prefix" {


name = "pip-prefix"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku = "Standard"
prefix_length = 31
}

resource "azurerm_public_ip" "pip_azfw" {


name = "pip-azfw"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku = "Standard"
allocation_method = "Static"
public_ip_prefix_id = azurerm_public_ip_prefix.pip_prefix.id
}

resource "azurerm_public_ip" "pip_azfw_2" {


name = "pip-azfw-1"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku = "Standard"
allocation_method = "Static"
public_ip_prefix_id = azurerm_public_ip_prefix.pip_prefix.id
}
resource "azurerm_virtual_network" "azfw_vnet" {
name = "azfw-vnet"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
address_space = ["10.10.0.0/16"]
}

resource "azurerm_subnet" "azfw_subnet" {


name = "AzureFirewallSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.0.0/26"]
}

resource "azurerm_subnet" "backend_subnet" {


name = "subnet-backend"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.1.0/24"]
}

resource "azurerm_network_interface" "backend_nic" {


count = 2
name = "nic-backend-${count.index + 1}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

ip_configuration {
name = "ipconfig-backend-${count.index +
1}"
subnet_id = azurerm_subnet.backend_subnet.id
private_ip_address_allocation = "Dynamic"
}
}

resource "azurerm_network_security_group" "backend_nsg" {


name = "nsg-backend"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
security_rule {
name = "RDP"
priority = 300
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "3389"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

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_windows_virtual_machine" "vm_backend" {


count = 2
name = "vm-backend-${count.index + 1}"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
size = var.virtual_machine_size
admin_username = var.admin_username
admin_password = random_password.password[count.index].result
network_interface_ids =
[azurerm_network_interface.backend_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"
}
}

resource "azurerm_firewall_policy" "azfw_policy" {


name = "azfw-policy"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = var.firewall_sku_tier
threat_intelligence_mode = "Alert"
}

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_route_table" "rt" {


name = "rt-azfw-eus"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
disable_bgp_route_propagation = false
route {
name = "azfw"
address_prefix = "0.0.0.0/0"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address = "10.10.0.4"
}
}

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
}

4. Create a file named variables.tf and insert the following code:

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"
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Run az network ip-group list to display the two new IP Groups.

Azure CLI

az network ip-group list --resource-group $resource_group_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan


Troubleshoot Terraform on Azure
Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" 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

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.

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "random_string" "storage_account_name" {


length = 8
lower = true
numeric = false
special = false
upper = false
}

resource "random_password" "password" {


length = 20
min_lower = 1
min_upper = 1
min_numeric = 1
min_special = 1
special = true
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "azurerm_public_ip" "pip_azfw" {


name = "pip-azfw"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
zones = ["1", "2", "3"]
}

resource "azurerm_storage_account" "sa" {


name = random_string.storage_account_name.result
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"
}

resource "azurerm_virtual_network" "azfw_vnet" {


name = "azfw-vnet"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
address_space = ["10.10.0.0/16"]
}

resource "azurerm_subnet" "azfw_subnet" {


name = "AzureFirewallSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.0.0/26"]
}

resource "azurerm_subnet" "server_subnet" {


name = "subnet-server"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.1.0/24"]
}

resource "azurerm_subnet" "jump_subnet" {


name = "subnet-jump"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.2.0/24"]
}

resource "azurerm_public_ip" "vm_jump_pip" {


name = "pip-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_network_interface" "vm_server_nic" {


name = "nic-server"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

ip_configuration {
name = "ipconfig-workload"
subnet_id = azurerm_subnet.server_subnet.id
private_ip_address_allocation = "Dynamic"
}
}

resource "azurerm_network_interface" "vm_jump_nic" {


name = "nic-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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_security_group" "vm_server_nsg" {


name = "nsg-server"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}

resource "azurerm_network_security_group" "vm_jump_nsg" {


name = "nsg-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
security_rule {
name = "Allow-TCP"
priority = 1000
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "3389"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

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_windows_virtual_machine" "vm_server" {


name = "server-vm"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
computer_name = "server"
size = var.virtual_machine_size
admin_username = var.admin_username
admin_password = random_password.password.result
network_interface_ids = [azurerm_network_interface.vm_server_nic.id]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
disk_size_gb = "128"
}
source_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2019-Datacenter"
version = "latest"
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.sa.primary_blob_endpoint
}
}

resource "azurerm_windows_virtual_machine" "vm_jump" {


name = "jump-vm"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
computer_name = "jumpbox"
size = var.virtual_machine_size
admin_username = var.admin_username
admin_password = random_password.password.result
network_interface_ids = [azurerm_network_interface.vm_jump_nic.id]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
disk_size_gb = "128"
}
source_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2019-Datacenter"
version = "latest"
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.sa.primary_blob_endpoint
}
}

resource "azurerm_firewall_policy" "azfw_policy" {


name = "azfw-policy"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = var.firewall_sku_tier
threat_intelligence_mode = "Alert"
}
resource "azurerm_firewall_policy_rule_collection_group" "prcg" {
name = "prcg"
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
priority = 300
application_rule_collection {
name = "appRc1"
priority = 101
action = "Allow"
rule {
name = "appRule1"
protocols {
type = "Http"
port = 80
}
protocols {
type = "Https"
port = 443
}
destination_fqdns = ["www.microsoft.com"]
source_addresses = ["10.10.1.0/24"]
}
}
network_rule_collection {
name = "netRc1"
priority = 200
action = "Allow"
rule {
name = "netRule1"
protocols = ["TCP"]
source_addresses = ["10.10.1.0/24"]
destination_addresses = ["*"]
destination_ports = ["8000", "8999"]
}
}
}

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
zones = ["1", "2", "3"]
ip_configuration {
name = "azfw-ipconfig"
subnet_id = azurerm_subnet.azfw_subnet.id
public_ip_address_id = azurerm_public_ip.pip_azfw.id
}
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
}

resource "azurerm_route_table" "rt" {


name = "rt-azfw-eus"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
disable_bgp_route_propagation = false
route {
name = "azfwDefaultRoute"
address_prefix = "0.0.0.0/0"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address =
azurerm_firewall.fw.ip_configuration[0].private_ip_address
}
}

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
}

4. Create a file named variables.tf and insert the following code:

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"
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the firewall name.

Console

firewall_name=$(terraform output -raw firewall_name)


3. Run az network firewall show with a JMESPath query to display the availability
zones for the firewall.

Azure CLI

az network firewall show --name $firewall_name --resource-group


$resource_group_name --query "{Zones:zones"}

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure
Next steps
Next, you can monitor the Azure Firewall logs.

Tutorial: Monitor Azure Firewall logs


Quickstart: Create an Azure Front Door
(classic) using Terraform
Article • 03/27/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

) 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.

In this article, you learn how to:

" 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.

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.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg-name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg-name.id
location = var.resource_group_location
}

resource "random_id" "front_door_name" {


byte_length = 8
}

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"
}

resource "azurerm_frontdoor" "main" {


name = local.front_door_name
resource_group_name = azurerm_resource_group.rg.name

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
}
}
}

4. Create a file named variables.tf and insert the following code:

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. Get the Front Door endpoint:

Console

terraform output -raw frontDoorEndpointHostName

2. Paste the endpoint into a browser.

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

In this article, you learn how to:

" 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.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg-name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg-name.id
location = var.resource_group_location
}
resource "random_id" "front_door_endpoint_name" {
byte_length = 8
}

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"
}

resource "azurerm_cdn_frontdoor_profile" "my_front_door" {


name = local.front_door_profile_name
resource_group_name = azurerm_resource_group.rg.name
sku_name = var.front_door_sku_name
}

resource "azurerm_cdn_frontdoor_endpoint" "my_endpoint" {


name = local.front_door_endpoint_name
cdn_frontdoor_profile_id =
azurerm_cdn_frontdoor_profile.my_front_door.id
}

resource "azurerm_cdn_frontdoor_origin_group" "my_origin_group" {


name = local.front_door_origin_group_name
cdn_frontdoor_profile_id =
azurerm_cdn_frontdoor_profile.my_front_door.id
session_affinity_enabled = true

load_balancing {
sample_size = 4
successful_samples_required = 3
}

health_probe {
path = "/"
request_type = "HEAD"
protocol = "Https"
interval_in_seconds = 100
}
}

resource "azurerm_cdn_frontdoor_origin" "my_app_service_origin" {


name = local.front_door_origin_name
cdn_frontdoor_origin_group_id =
azurerm_cdn_frontdoor_origin_group.my_origin_group.id

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
}

resource "azurerm_cdn_frontdoor_route" "my_route" {


name = local.front_door_route_name
cdn_frontdoor_endpoint_id =
azurerm_cdn_frontdoor_endpoint.my_endpoint.id
cdn_frontdoor_origin_group_id =
azurerm_cdn_frontdoor_origin_group.my_origin_group.id
cdn_frontdoor_origin_ids =
[azurerm_cdn_frontdoor_origin.my_app_service_origin.id]

supported_protocols = ["Http", "Https"]


patterns_to_match = ["/*"]
forwarding_protocol = "HttpsOnly"
link_to_default_domain = true
https_redirect_enabled = true
}

4. Create a file named app-service.tf and insert the following code:

Terraform

resource "random_id" "app_name" {


byte_length = 8
}

locals {
app_name = "myapp-${lower(random_id.app_name.hex)}"
app_service_plan_name = "AppServicePlan"
}

resource "azurerm_service_plan" "app_service_plan" {


name = local.app_service_plan_name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

sku_name = var.app_service_plan_sku_name
os_type = "Windows"
worker_count = var.app_service_plan_capacity
}

resource "azurerm_windows_web_app" "app" {


name = local.app_name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
service_plan_id = azurerm_service_plan.app_service_plan.id

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"
}
}
}

5. Create a file named variables.tf and insert the following code:

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."
}
}

6. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. Get the Front Door endpoint:

Console

terraform output -raw frontDoorEndpointHostName

2. Paste the endpoint into a browser.

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

Implement the Terraform code


This code sample will implement Azure Virtual Network Manager at the management
group scope.

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 providers.tf and insert the following code:

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform
# Create the Resource Group

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


location = var.resource_group_location
name = random_pet.rg_name.id
}

# Create three virtual networks


resource "random_string" "prefix" {
length = 4
special = false
upper = false
}

resource "random_pet" "virtual_network_name" {


prefix = "vnet-${random_string.prefix.result}"
}
resource "azurerm_virtual_network" "vnet" {
count = 3

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"]
}

# Add a subnet to each virtual network

resource "azurerm_subnet" "subnet_vnet" {


count = 3

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"]
}

data "azurerm_subscription" "current" {


}

# Create a Management Group

resource "random_pet" "management_group_name" {


prefix = "AVNM-management-group"
}

resource "azurerm_management_group" "mg" {


display_name = random_pet.management_group_name.id
subscription_ids = [
data.azurerm_subscription.current.subscription_id,
]
}

data "azurerm_client_config" "this" {}

resource "azurerm_role_assignment" "management_group_owner" {


principal_id = coalesce(var.msi_id,
data.azurerm_client_config.this.object_id)
scope = azurerm_management_group.mg.id
role_definition_name = "Contributor"
}

# register Microsoft.Network to the Management Group

resource "null_resource" "register_rp_to_mg" {


provisioner "local-exec" {
command = "az provider register --namespace Microsoft.Network -m
${azurerm_management_group.mg.name}"
}
depends_on = [azurerm_role_assignment.management_group_owner]
}

resource "time_sleep" "wait_5_seconds" {


create_duration = "5s"
depends_on = [null_resource.register_rp_to_mg]
}

# Create a Virtual Network Manager instance

resource "azurerm_network_manager" "network_manager_instance" {


name = "network-manager"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
scope_accesses = ["Connectivity"]
description = "example network manager"
scope {
management_group_ids = [azurerm_management_group.mg.id]
}
depends_on = [time_sleep.wait_5_seconds]
}

# Create a network group

resource "azurerm_network_manager_network_group" "network_group" {


name = "network-group"
network_manager_id =
azurerm_network_manager.network_manager_instance.id
}

# Add three virtual networks to a network group as dynamic members with


Azure Policy

resource "random_pet" "network_group_policy_name" {


prefix = "network-group-policy"
}

resource "azurerm_policy_definition" "network_group_policy" {


name = random_pet.network_group_policy_name.id
policy_type = "Custom"
mode = "Microsoft.Network.Data"
display_name = "Policy Definition for Network Group"

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
}

# Create a connectivity configuration


resource "azurerm_network_manager_connectivity_configuration"
"connectivity_config" {
name = "connectivity-config"
network_manager_id =
azurerm_network_manager.network_manager_instance.id
connectivity_topology = "Mesh"
applies_to_group {
group_connectivity = "None"
network_group_id =
azurerm_network_manager_network_group.network_group.id
}
}

# Commit deployment

resource "azurerm_network_manager_deployment" "commit_deployment" {


network_manager_id =
azurerm_network_manager.network_manager_instance.id
location = azurerm_resource_group.rg.location
scope_access = "Connectivity"
configuration_ids =
[azurerm_network_manager_connectivity_configuration.connectivity_config
.id]
}

4. 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
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
}

5. Create a file named outputs.tf and insert the following code:


Terraform

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.
Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the virtual network names.

Console

terraform output virtual_network_names

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

az network manager list-effective-connectivity-config \


--resource-group $resource_group_name \
--vnet-name <virtual_network_name>

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Provide product feedback


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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "aazurerm_cdn_profile_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_cdn_profile" "profile" {


name =
"profile-${random_string.azurerm_cdn_endpoint_name.result}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku = var.cdn_sku
}

resource "random_string" "azurerm_cdn_endpoint_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_cdn_endpoint" "endpoint" {


name =
"endpoint-${random_string.azurerm_cdn_endpoint_name.result}"
profile_name = azurerm_cdn_profile.profile.name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
is_http_allowed = true
is_https_allowed = true
querystring_caching_behaviour = "IgnoreQueryString"
is_compression_enabled = true
content_types_to_compress = [
"application/eot",
"application/font",
"application/font-sfnt",
"application/javascript",
"application/json",
"application/opentype",
"application/otf",
"application/pkcs7-mime",
"application/truetype",
"application/ttf",
"application/vnd.ms-fontobject",
"application/xhtml+xml",
"application/xml",
"application/xml+rss",
"application/x-font-opentype",
"application/x-font-truetype",
"application/x-font-ttf",
"application/x-httpd-cgi",
"application/x-javascript",
"application/x-mpegurl",
"application/x-opentype",
"application/x-otf",
"application/x-perl",
"application/x-ttf",
"font/eot",
"font/ttf",
"font/otf",
"font/opentype",
"image/svg+xml",
"text/css",
"text/csv",
"text/html",
"text/javascript",
"text/js",
"text/plain",
"text/richtext",
"text/tab-separated-values",
"text/xml",
"text/x-script",
"text/x-component",
"text/x-java-source",
]

origin {
name = "origin1"
host_name = var.origin_url
}
}

3. Create a file named outputs.tf and insert the following code:

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
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name in which the Azure CDN profile and
endpoint were created.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the CDN profile name.

Console
cdn_profile_name=$(terraform output -raw cdn_profile_name)

3. Get the CDN endpoint name.

Console

cdn_endpoint_endpoint_name=$(terraform output -raw


cdn_endpoint_endpoint_name)

4. Run az cdn custom-domain show to show details of the custom domain you
created in this article.

Azure CLI

az cdn endpoint show --resource-group $resource_group_name \


--profile-name $cdn_profile_name \
--name $cdn_endpoint_endpoint_name

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

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.

2. Run terraform apply to apply the execution plan.


Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_traffic_manager_profile_name" {


length = 25
upper = false
numeric = false
special = false
}

resource "random_string"
"azurerm_traffic_manager_profile_dns_config_relative_name" {
length = 10
upper = false
numeric = false
special = false
}

resource "azurerm_traffic_manager_profile" "profile" {


name =
random_string.azurerm_traffic_manager_profile_name.result
resource_group_name = azurerm_resource_group.rg.name
traffic_routing_method = "Performance"
dns_config {
relative_name =
random_string.azurerm_traffic_manager_profile_dns_config_relative_name.
result
ttl = 30
}

monitor_config {
protocol = "HTTPS"
port = 443
path = "/"
expected_status_code_ranges = ["200-202", "301-302"]
}
}

resource "azurerm_traffic_manager_external_endpoint" "endpoint1" {


profile_id = azurerm_traffic_manager_profile.profile.id
name = "endpoint1"
target = "www.contoso.com"
endpoint_location = "eastus"
weight = 50
}

resource "azurerm_traffic_manager_external_endpoint" "endpoint2" {


profile_id = azurerm_traffic_manager_profile.profile.id
name = "endpoint2"
target = "www.fabrikam.com"
endpoint_location = "westus"
weight = 50
}

4. Create a file named variables.tf and insert the following code:

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"
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the Traffic Manager profile name.

Console
traffic_manager_profile_name=$(terraform output -raw
azurerm_traffic_manager_profile_name)

3. Run az network traffic-manager profile show to display information about the


new Traffic Manager profile.

Azure CLI

az network traffic-manager profile show \


--resource-group $resource_group_name \
--name $traffic_manager_profile_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan


Troubleshoot Terraform on Azure
Troubleshoot common problems when using Terraform on Azure

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.

The script creates the following 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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

Prerequisites
An Azure account with an active subscription. You can create an account for free .

Installation and configuration of Terraform.

Implement the Terraform code


7 Note

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.

2. Create a file named main.tf and insert the following code:

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"]
}

resource "random_pet" "prefix" {


prefix = var.resource_group_name_prefix
length = 1
}

3. Create a file named outputs.tf and insert the following code:

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
}

4. 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 {}
}

5. 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."
}

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name:

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the virtual network name:

Console

virtual_network_name=$(terraform output -raw virtual_network_name)

3. Use az network vnet show to display the details of your newly created virtual
network:
Azure CLI

az network vnet show \


--resource-group $resource_group_name \
--name $virtual_network_name

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


For information about troubleshooting Terraform, see Troubleshoot common problems
when using Terraform on Azure.
Next steps
Learn more about using Terraform on Azure
Quickstart: Create an Azure NAT
Gateway using Terraform
Article • 02/22/2024

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

Prerequisites
An Azure account with an active subscription. You can create an account for free .
Install and configure Terraform.

Implement the Terraform code

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.

2. Create a file named main.tf and insert the following code:

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"]
}

# Public IP address for NAT gateway


resource "azurerm_public_ip" "my_public_ip" {
name = "public-ip-nat"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}
# NAT Gateway
resource "azurerm_nat_gateway" "my_nat_gateway" {
name = "nat-gateway"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}

# Associate NAT Gateway with Public IP


resource "azurerm_nat_gateway_public_ip_association" "example" {
nat_gateway_id = azurerm_nat_gateway.my_nat_gateway.id
public_ip_address_id = azurerm_public_ip.my_public_ip.id
}

# Associate NAT Gateway with Subnet


resource "azurerm_subnet_nat_gateway_association" "example" {
subnet_id = azurerm_subnet.my_terraform_subnet_1.id
nat_gateway_id = azurerm_nat_gateway.my_nat_gateway.id
}

# Create public IP for virtual machine


resource "azurerm_public_ip" "my_public_ip_vm" {
name = "public-ip-vm"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}

# Create Network Security Group and rule


resource "azurerm_network_security_group" "my_terraform_nsg" {
name = "nsg-1"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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 = "*"
}
}

# Create network interface


resource "azurerm_network_interface" "my_terraform_nic" {
name = "nic-1"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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
}
}

# Connect the security group to the network interface


resource "azurerm_network_interface_security_group_association"
"example" {
network_interface_id =
azurerm_network_interface.my_terraform_nic.id
network_security_group_id =
azurerm_network_security_group.my_terraform_nsg.id
}

# Generate random text for a unique storage account name


resource "random_id" "random_id" {
keepers = {
# Generate a new ID only when a new resource group is defined
resource_group = azurerm_resource_group.rg.name
}

byte_length = 8
}

# Create storage account for boot diagnostics


resource "azurerm_storage_account" "my_storage_account" {
name = "diag${random_id.random_id.hex}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
account_tier = "Standard"
account_replication_type = "LRS"
}

# Create virtual machine


resource "azurerm_linux_virtual_machine" "my_terraform_vm" {
name = "vm-1"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
network_interface_ids =
[azurerm_network_interface.my_terraform_nic.id]
size = "Standard_DS1_v2"

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
}
}

resource "random_pet" "prefix" {


prefix = var.resource_group_name_prefix
length = 1
}

3. Create a file named outputs.tf and insert the following code:

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
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named ssh.tf and insert the following code:

Terraform

resource "random_pet" "ssh_key_name" {


prefix = "ssh"
separator = ""
}

resource "azapi_resource_action" "ssh_public_key_gen" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
resource_id = azapi_resource.ssh_public_key.id
action = "generateKeyPair"
method = "POST"

response_export_values = ["publicKey", "privateKey"]


}

resource "azapi_resource" "ssh_public_key" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
name = random_pet.ssh_key_name.id
location = azurerm_resource_group.rg.location
parent_id = azurerm_resource_group.rg.id
}

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

1. Get the NAT gateway ID.


Console

nat_gateway=$(terraform output -raw nat_gateway)

1. Run az network nat gateway show to display the details about the NAT
gateway.

Azure CLI

az network nat gateway show \


--resource-group $resource_group_name \
--ids $nat_gateway

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan


Troubleshoot Terraform on Azure
Troubleshoot common problems when using Terraform on Azure.

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

Prerequisites
You need an Azure account with an active subscription. Create an account for
free .

Install and configure Terraform.

Implement the Terraform code


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.

2. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "prefix" {


prefix = var.resource_group_name_prefix
length = 1
}

# 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"]
}

# Public IP address for NAT gateway


resource "azurerm_public_ip" "my_public_ip" {
name = "public-ip-nat"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}
# NAT Gateway
resource "azurerm_nat_gateway" "my_nat_gateway" {
name = "nat-gateway"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}

# Associate NAT Gateway with Public IP


resource "azurerm_nat_gateway_public_ip_association" "example" {
nat_gateway_id = azurerm_nat_gateway.my_nat_gateway.id
public_ip_address_id = azurerm_public_ip.my_public_ip.id
}

# Associate NAT Gateway with Subnet


resource "azurerm_subnet_nat_gateway_association" "example" {
subnet_id = azurerm_subnet.my_terraform_subnet_1.id
nat_gateway_id = azurerm_nat_gateway.my_nat_gateway.id
}

# Create public IP for virtual machine


resource "azurerm_public_ip" "my_public_ip_vm" {
name = "public-ip-vm"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}

# Create Network Security Group and rule


resource "azurerm_network_security_group" "my_terraform_nsg" {
name = "nsg-1"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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 = "*"
}
}

# Create network interface


resource "azurerm_network_interface" "my_terraform_nic" {
name = "nic-1"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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
}
}

# Connect the security group to the network interface


resource "azurerm_network_interface_security_group_association"
"example" {
network_interface_id =
azurerm_network_interface.my_terraform_nic.id
network_security_group_id =
azurerm_network_security_group.my_terraform_nsg.id
}

# Generate random text for a unique storage account name


resource "random_id" "random_id" {
keepers = {
# Generate a new ID only when a new resource group is defined
resource_group = azurerm_resource_group.rg.name
}

byte_length = 8
}

# Create storage account for boot diagnostics


resource "azurerm_storage_account" "my_storage_account" {
name = "diag${random_id.random_id.hex}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
account_tier = "Standard"
account_replication_type = "LRS"
}

# Create virtual machine


resource "azurerm_linux_virtual_machine" "my_terraform_vm" {
name = "vm-1"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
network_interface_ids =
[azurerm_network_interface.my_terraform_nic.id]
size = "Standard_DS1_v2"

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
}
}

# Create SQL server name


resource "random_pet" "azurerm_mssql_server_name" {
prefix = "sql"
}

# Random password for SQL server


resource "random_password" "admin_password" {
count = var.admin_password == null ? 1 : 0
length = 20
special = true
min_numeric = 1
min_upper = 1
min_lower = 1
min_special = 1
}

locals {
admin_password = try(random_password.admin_password[0].result,
var.admin_password)
}

# Create SQL server


resource "azurerm_mssql_server" "server" {
name =
random_pet.azurerm_mssql_server_name.id
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
administrator_login = var.admin_username
administrator_login_password = local.admin_password
version = "12.0"
}

# Create SQL database


resource "azurerm_mssql_database" "db" {
name = var.sql_db_name
server_id = azurerm_mssql_server.server.id
}
# Create private endpoint for SQL server
resource "azurerm_private_endpoint" "my_terraform_endpoint" {
name = "private-endpoint-sql"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
subnet_id = azurerm_subnet.my_terraform_subnet_1.id

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]
}
}

# Create private DNS zone


resource "azurerm_private_dns_zone" "my_terraform_dns_zone" {
name = "privatelink.database.windows.net"
resource_group_name = azurerm_resource_group.rg.name
}

# Create virtual network link


resource "azurerm_private_dns_zone_virtual_network_link"
"my_terraform_vnet_link" {
name = "vnet-link"
resource_group_name = azurerm_resource_group.rg.name
private_dns_zone_name =
azurerm_private_dns_zone.my_terraform_dns_zone.name
virtual_network_id =
azurerm_virtual_network.my_terraform_network.id
}

3. Create a file named outputs.tf and insert the following code:

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
}

4. Create a file named provider.tf and insert the following code:

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
}
}
}

5. Create a file named ssh.tf and insert the following code:

Terraform
resource "random_pet" "ssh_key_name" {
prefix = "ssh"
separator = ""
}

resource "azapi_resource_action" "ssh_public_key_gen" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
resource_id = azapi_resource.ssh_public_key.id
action = "generateKeyPair"
method = "POST"

response_export_values = ["publicKey", "privateKey"]


}

resource "azapi_resource" "ssh_public_key" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
name = random_pet.ssh_key_name.id
location = azurerm_resource_group.rg.location
parent_id = azurerm_resource_group.rg.id
}

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"
}

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the SQL Server name.

Console

sql_server=$(terraform output -raw sql_server)


3. Run az sql server show to display the details about the SQL Server private
endpoint.

Azure CLI

az sql server show \


--resource-group $resource_group_name \
--name $sql_server --query privateEndpointConnections \
--output tsv

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure.

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

" 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 an Azure public IP using azurerm_public_ip
" Create an Azure Application Gateway using azurerm_application_gateway
" Create an Azure network interface using azurerm_network_interface
" Create an Azure network interface application gateway backend address pool
association using
azurerm_network_interface_application_gateway_backend_address_pool_association
" Create an Azure Windows Virtual Machine using azurerm_windows_virtual_machine
" Create an Azure Virtual Machine Extension using
azurerm_virtual_machine_extension
7 Note

Application Gateway frontend now supports dual-stack IP addresses (Preview). You


can now create up to four frontend IP addresses: Two IPv4 addresses (public and
private) and two IPv6 addresses (public and private).

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.

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_string" "rg" {


length = 8
upper = false
special = false
}

resource "azurerm_resource_group" "rg" {


name = "101-application-gateway-${random_string.rg.result}"
location = "eastus"
}

resource "azurerm_virtual_network" "vnet" {


name = "myVNet"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
address_space = ["10.21.0.0/16"]
}

resource "azurerm_subnet" "frontend" {


name = "myAGSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.21.0.0/24"]
}

resource "azurerm_subnet" "backend" {


name = "myBackendSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.21.1.0/24"]
}

resource "azurerm_public_ip" "pip" {


name = "myAGPublicIPAddress"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_application_gateway" "main" {


name = "myAppGateway"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku {
name = "Standard_v2"
tier = "Standard_v2"
capacity = 2
}

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" "nic" {


count = 2
name = "nic-${count.index+1}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
ip_configuration {
name = "nic-ipconfig-${count.index+1}"
subnet_id = azurerm_subnet.backend.id
private_ip_address_allocation = "Dynamic"
}
}

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
}

resource "random_password" "password" {


length = 16
special = true
lower = true
upper = true
numeric = true
}

resource "azurerm_windows_virtual_machine" "vm" {


count = 2
name = "myVM${count.index+1}"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
size = "Standard_DS1_v2"
admin_username = "azureadmin"
admin_password = random_password.password.result

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"
}
}

resource "azurerm_virtual_machine_extension" "vm-extensions" {


count = 2
name = "vm${count.index+1}-ext"
virtual_machine_id =
azurerm_windows_virtual_machine.vm[count.index].id
publisher = "Microsoft.Compute"
type = "CustomScriptExtension"
type_handler_version = "1.10"

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 .

4. Create a file named variables.tf and insert the following code:

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"
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. When you apply the execution plan, Terraform displays the frontend public IP
address. If you've cleared the screen, you can retrieve that value with the following
Terraform command:

Console

echo $(terraform output -raw gateway_frontend_ip)

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:

1. Run terraform plan and specify the destroy flag.

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Microsoft Azure Attestation is a solution for attesting Trusted Execution Environments


(TEEs). This quickstart focuses on the process of creating a Microsoft Azure Attestation
policy using Terraform.

In this article, you learn how to:

" 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.

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.
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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


location = var.resource_group_location
name = random_pet.rg_name.id
}

locals {
create_signing_cert = try(!fileexists(var.cert_path), true)
}

resource "tls_private_key" "signing_cert" {


count = local.create_signing_cert ? 1 : 0

algorithm = "RSA"
rsa_bits = 4096
}

resource "tls_self_signed_cert" "attestation" {


count = local.create_signing_cert ? 1 : 0

private_key_pem = tls_private_key.signing_cert[0].private_key_pem
validity_period_hours = 12
allowed_uses = [
"cert_signing",
]
}

resource "random_string" "attestation_suffix" {


length = 8
numeric = false
special = false
upper = false
}

resource "azurerm_attestation_provider" "corp_attestation" {


location = azurerm_resource_group.rg.location
name =
"${var.attestation_provider_name}${random_string.attestation_suffix.res
ult}"
resource_group_name = azurerm_resource_group.rg.name
policy_signing_certificate_data =
try(tls_self_signed_cert.attestation[0].cert_pem, file(var.cert_path))
}

4. Create a file named variables.tf and insert the following code:

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:

Adjust the policy_file field as needed to point to your PEM file.


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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.
Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Run az attestation list to list the providers for the specified resource group
name.

Azure CLI

az attestation list --resource-group $resource_group_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "ddos_protection_plan" {


length = 13
upper = false
numeric = false
special = false
}

resource "azurerm_network_ddos_protection_plan" "ddos" {


name = random_string.ddos_protection_plan.result
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
}

resource "random_string" "virtual_network_name" {


length = 13
upper = false
numeric = false
special = false
}

resource "azurerm_virtual_network" "vnet" {


name = random_string.virtual_network_name.result
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
address_space = [var.vnet_address_prefix]

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
}
}

4. Create a file named variables.tf and insert the following code:

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
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.
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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console
resource_group_name=$(terraform output -raw resource_group_name)

2. Get the DDoS protection plan name.

Console

ddos_protection_plan_name=$(terraform output -raw


ddos_protection_plan_name)

3. Run az network ddos-protection show to display information about the new


DDoS protection plan.

Azure CLI

az network ddos-protection show \


--resource-group $resource_group_name \
--name $ddos_protection_plan_name

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

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 .
2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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.

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"
}
azapi = {
source = "azure/azapi"
version = "~>1.5"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named ssh.tf and insert the following code:

Terraform

resource "random_pet" "ssh_key_name" {


prefix = "ssh"
separator = ""
}

resource "azapi_resource_action" "ssh_public_key_gen" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
resource_id = azapi_resource.ssh_public_key.id
action = "generateKeyPair"
method = "POST"

response_export_values = ["publicKey", "privateKey"]


}

resource "azapi_resource" "ssh_public_key" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
name = random_pet.ssh_key_name.id
location = azurerm_resource_group.rg.location
parent_id = azurerm_resource_group.rg.id
}

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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "random_string" "storage_account_name" {


length = 8
lower = true
numeric = false
special = false
upper = false
}

resource "random_password" "password" {


length = 20
min_lower = 1
min_upper = 1
min_numeric = 1
min_special = 1
special = true
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "azurerm_public_ip" "pip_azfw" {


name = "pip-azfw"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_storage_account" "sa" {


name = random_string.storage_account_name.result
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"
}

resource "azurerm_firewall_policy" "azfw_policy" {


name = "azfw-policy"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = var.firewall_sku_tier
threat_intelligence_mode = "Alert"
}

resource "azurerm_firewall_policy_rule_collection_group" "prcg" {


name = "prcg"
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
priority = 300
application_rule_collection {
name = "app-rule-collection-1"
priority = 101
action = "Allow"
rule {
name = "someAppRule"
protocols {
type = "Https"
port = 443
}
destination_fqdns = ["*bing.com"]
source_ip_groups = [azurerm_ip_group.ip_group_1.id]
}
}
network_rule_collection {
name = "net-rule-collection-1"
priority = 200
action = "Allow"
rule {
name = "someNetRule"
protocols = ["TCP", "UDP", "ICMP"]
source_ip_groups = [azurerm_ip_group.ip_group_1.id]
destination_ip_groups = [azurerm_ip_group.ip_group_2.id]
destination_ports = ["90"]
}
}
}

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
}
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
}

resource "azurerm_ip_group" "ip_group_1" {


name = "ip-group_1"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
cidrs = ["13.73.64.64/26", "13.73.208.128/25",
"52.126.194.0/23"]
}
resource "azurerm_ip_group" "ip_group_2" {
name = "ip_group_2"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
cidrs = ["12.0.0.0/24", "13.9.0.0/24"]
}

resource "azurerm_virtual_network" "azfw_vnet" {


name = "azfw-vnet"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
address_space = ["10.10.0.0/16"]
}

resource "azurerm_subnet" "azfw_subnet" {


name = "AzureFirewallSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.0.0/26"]
}

resource "azurerm_subnet" "server_subnet" {


name = "subnet-server"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.1.0/24"]
}

resource "azurerm_subnet" "jump_subnet" {


name = "subnet-jump"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.2.0/24"]
}

resource "azurerm_public_ip" "vm_jump_pip" {


name = "pip-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_network_interface" "vm_server_nic" {


name = "nic-server"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

ip_configuration {
name = "ipconfig-workload"
subnet_id = azurerm_subnet.server_subnet.id
private_ip_address_allocation = "Dynamic"
}
}

resource "azurerm_network_interface" "vm_jump_nic" {


name = "nic-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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_security_group" "vm_server_nsg" {


name = "nsg-server"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}

resource "azurerm_network_security_group" "vm_jump_nsg" {


name = "nsg-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
security_rule {
name = "Allow-SSH"
priority = 1000
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

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_linux_virtual_machine" "vm_server" {


name = "server-vm"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
size = var.virtual_machine_size
admin_username = var.admin_username
admin_ssh_key {
username = var.admin_username
public_key =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
network_interface_ids = [azurerm_network_interface.vm_server_nic.id]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "18.04-LTS"
version = "latest"
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.sa.primary_blob_endpoint
}
}

resource "azurerm_linux_virtual_machine" "vm_jump" {


name = "jump-vm"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
size = var.virtual_machine_size
network_interface_ids = [azurerm_network_interface.vm_jump_nic.id]
admin_username = var.admin_username
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
admin_ssh_key {
username = var.admin_username
public_key =
jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "18.04-LTS"
version = "latest"
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.sa.primary_blob_endpoint
}
computer_name = "JumpBox"

resource "azurerm_route_table" "rt" {


name = "rt-azfw-eus"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
disable_bgp_route_propagation = false
route {
name = "azfwDefaultRoute"
address_prefix = "0.0.0.0/0"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address =
azurerm_firewall.fw.ip_configuration[0].private_ip_address
}
}

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
}

5. Create a file named variables.tf and insert the following code:

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"
}

6. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Run az network ip-group list to display the two new IP Groups.

Azure CLI

az network ip-group list --resource-group $resource_group_name

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

For more information about Azure Firewall with multiple public IP addresses, see Deploy
an Azure Firewall with multiple public IP addresses using Azure PowerShell.

In this article, you learn how to:

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

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.

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 {
virtual_machine {
delete_os_disk_on_deletion = true
skip_shutdown_and_force_delete = true
}
}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "random_password" "password" {


count = 2
length = 20
min_lower = 1
min_upper = 1
min_numeric = 1
min_special = 1
special = true
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "azurerm_public_ip_prefix" "pip_prefix" {


name = "pip-prefix"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku = "Standard"
prefix_length = 31
}

resource "azurerm_public_ip" "pip_azfw" {


name = "pip-azfw"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku = "Standard"
allocation_method = "Static"
public_ip_prefix_id = azurerm_public_ip_prefix.pip_prefix.id
}

resource "azurerm_public_ip" "pip_azfw_2" {


name = "pip-azfw-1"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku = "Standard"
allocation_method = "Static"
public_ip_prefix_id = azurerm_public_ip_prefix.pip_prefix.id
}
resource "azurerm_virtual_network" "azfw_vnet" {
name = "azfw-vnet"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
address_space = ["10.10.0.0/16"]
}

resource "azurerm_subnet" "azfw_subnet" {


name = "AzureFirewallSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.0.0/26"]
}

resource "azurerm_subnet" "backend_subnet" {


name = "subnet-backend"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.1.0/24"]
}

resource "azurerm_network_interface" "backend_nic" {


count = 2
name = "nic-backend-${count.index + 1}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

ip_configuration {
name = "ipconfig-backend-${count.index +
1}"
subnet_id = azurerm_subnet.backend_subnet.id
private_ip_address_allocation = "Dynamic"
}
}

resource "azurerm_network_security_group" "backend_nsg" {


name = "nsg-backend"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
security_rule {
name = "RDP"
priority = 300
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "3389"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

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_windows_virtual_machine" "vm_backend" {


count = 2
name = "vm-backend-${count.index + 1}"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
size = var.virtual_machine_size
admin_username = var.admin_username
admin_password = random_password.password[count.index].result
network_interface_ids =
[azurerm_network_interface.backend_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"
}
}

resource "azurerm_firewall_policy" "azfw_policy" {


name = "azfw-policy"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = var.firewall_sku_tier
threat_intelligence_mode = "Alert"
}

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_route_table" "rt" {


name = "rt-azfw-eus"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
disable_bgp_route_propagation = false
route {
name = "azfw"
address_prefix = "0.0.0.0/0"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address = "10.10.0.4"
}
}

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
}

4. Create a file named variables.tf and insert the following code:

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"
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Run az network ip-group list to display the two new IP Groups.

Azure CLI

az network ip-group list --resource-group $resource_group_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan


Troubleshoot Terraform on Azure
Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" 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

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.

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "random_string" "storage_account_name" {


length = 8
lower = true
numeric = false
special = false
upper = false
}

resource "random_password" "password" {


length = 20
min_lower = 1
min_upper = 1
min_numeric = 1
min_special = 1
special = true
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "azurerm_public_ip" "pip_azfw" {


name = "pip-azfw"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
zones = ["1", "2", "3"]
}

resource "azurerm_storage_account" "sa" {


name = random_string.storage_account_name.result
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"
}

resource "azurerm_virtual_network" "azfw_vnet" {


name = "azfw-vnet"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
address_space = ["10.10.0.0/16"]
}

resource "azurerm_subnet" "azfw_subnet" {


name = "AzureFirewallSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.0.0/26"]
}

resource "azurerm_subnet" "server_subnet" {


name = "subnet-server"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.1.0/24"]
}

resource "azurerm_subnet" "jump_subnet" {


name = "subnet-jump"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.azfw_vnet.name
address_prefixes = ["10.10.2.0/24"]
}

resource "azurerm_public_ip" "vm_jump_pip" {


name = "pip-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_network_interface" "vm_server_nic" {


name = "nic-server"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

ip_configuration {
name = "ipconfig-workload"
subnet_id = azurerm_subnet.server_subnet.id
private_ip_address_allocation = "Dynamic"
}
}

resource "azurerm_network_interface" "vm_jump_nic" {


name = "nic-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

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_security_group" "vm_server_nsg" {


name = "nsg-server"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}

resource "azurerm_network_security_group" "vm_jump_nsg" {


name = "nsg-jump"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
security_rule {
name = "Allow-TCP"
priority = 1000
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "3389"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

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_windows_virtual_machine" "vm_server" {


name = "server-vm"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
computer_name = "server"
size = var.virtual_machine_size
admin_username = var.admin_username
admin_password = random_password.password.result
network_interface_ids = [azurerm_network_interface.vm_server_nic.id]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
disk_size_gb = "128"
}
source_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2019-Datacenter"
version = "latest"
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.sa.primary_blob_endpoint
}
}

resource "azurerm_windows_virtual_machine" "vm_jump" {


name = "jump-vm"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
computer_name = "jumpbox"
size = var.virtual_machine_size
admin_username = var.admin_username
admin_password = random_password.password.result
network_interface_ids = [azurerm_network_interface.vm_jump_nic.id]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
disk_size_gb = "128"
}
source_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2019-Datacenter"
version = "latest"
}
boot_diagnostics {
storage_account_uri =
azurerm_storage_account.sa.primary_blob_endpoint
}
}

resource "azurerm_firewall_policy" "azfw_policy" {


name = "azfw-policy"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = var.firewall_sku_tier
threat_intelligence_mode = "Alert"
}
resource "azurerm_firewall_policy_rule_collection_group" "prcg" {
name = "prcg"
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
priority = 300
application_rule_collection {
name = "appRc1"
priority = 101
action = "Allow"
rule {
name = "appRule1"
protocols {
type = "Http"
port = 80
}
protocols {
type = "Https"
port = 443
}
destination_fqdns = ["www.microsoft.com"]
source_addresses = ["10.10.1.0/24"]
}
}
network_rule_collection {
name = "netRc1"
priority = 200
action = "Allow"
rule {
name = "netRule1"
protocols = ["TCP"]
source_addresses = ["10.10.1.0/24"]
destination_addresses = ["*"]
destination_ports = ["8000", "8999"]
}
}
}

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
zones = ["1", "2", "3"]
ip_configuration {
name = "azfw-ipconfig"
subnet_id = azurerm_subnet.azfw_subnet.id
public_ip_address_id = azurerm_public_ip.pip_azfw.id
}
firewall_policy_id = azurerm_firewall_policy.azfw_policy.id
}

resource "azurerm_route_table" "rt" {


name = "rt-azfw-eus"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
disable_bgp_route_propagation = false
route {
name = "azfwDefaultRoute"
address_prefix = "0.0.0.0/0"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address =
azurerm_firewall.fw.ip_configuration[0].private_ip_address
}
}

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
}

4. Create a file named variables.tf and insert the following code:

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"
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the firewall name.

Console

firewall_name=$(terraform output -raw firewall_name)


3. Run az network firewall show with a JMESPath query to display the availability
zones for the firewall.

Azure CLI

az network firewall show --name $firewall_name --resource-group


$resource_group_name --query "{Zones:zones"}

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure
Next steps
Next, you can monitor the Azure Firewall logs.

Tutorial: Monitor Azure Firewall logs


Quickstart: Create an Azure Front Door
(classic) using Terraform
Article • 03/27/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

) 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.

In this article, you learn how to:

" 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.

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.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg-name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg-name.id
location = var.resource_group_location
}

resource "random_id" "front_door_name" {


byte_length = 8
}

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"
}

resource "azurerm_frontdoor" "main" {


name = local.front_door_name
resource_group_name = azurerm_resource_group.rg.name

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
}
}
}

4. Create a file named variables.tf and insert the following code:

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. Get the Front Door endpoint:

Console

terraform output -raw frontDoorEndpointHostName

2. Paste the endpoint into a browser.

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

In this article, you learn how to:

" 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.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg-name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg-name.id
location = var.resource_group_location
}
resource "random_id" "front_door_endpoint_name" {
byte_length = 8
}

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"
}

resource "azurerm_cdn_frontdoor_profile" "my_front_door" {


name = local.front_door_profile_name
resource_group_name = azurerm_resource_group.rg.name
sku_name = var.front_door_sku_name
}

resource "azurerm_cdn_frontdoor_endpoint" "my_endpoint" {


name = local.front_door_endpoint_name
cdn_frontdoor_profile_id =
azurerm_cdn_frontdoor_profile.my_front_door.id
}

resource "azurerm_cdn_frontdoor_origin_group" "my_origin_group" {


name = local.front_door_origin_group_name
cdn_frontdoor_profile_id =
azurerm_cdn_frontdoor_profile.my_front_door.id
session_affinity_enabled = true

load_balancing {
sample_size = 4
successful_samples_required = 3
}

health_probe {
path = "/"
request_type = "HEAD"
protocol = "Https"
interval_in_seconds = 100
}
}

resource "azurerm_cdn_frontdoor_origin" "my_app_service_origin" {


name = local.front_door_origin_name
cdn_frontdoor_origin_group_id =
azurerm_cdn_frontdoor_origin_group.my_origin_group.id

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
}

resource "azurerm_cdn_frontdoor_route" "my_route" {


name = local.front_door_route_name
cdn_frontdoor_endpoint_id =
azurerm_cdn_frontdoor_endpoint.my_endpoint.id
cdn_frontdoor_origin_group_id =
azurerm_cdn_frontdoor_origin_group.my_origin_group.id
cdn_frontdoor_origin_ids =
[azurerm_cdn_frontdoor_origin.my_app_service_origin.id]

supported_protocols = ["Http", "Https"]


patterns_to_match = ["/*"]
forwarding_protocol = "HttpsOnly"
link_to_default_domain = true
https_redirect_enabled = true
}

4. Create a file named app-service.tf and insert the following code:

Terraform

resource "random_id" "app_name" {


byte_length = 8
}

locals {
app_name = "myapp-${lower(random_id.app_name.hex)}"
app_service_plan_name = "AppServicePlan"
}

resource "azurerm_service_plan" "app_service_plan" {


name = local.app_service_plan_name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

sku_name = var.app_service_plan_sku_name
os_type = "Windows"
worker_count = var.app_service_plan_capacity
}

resource "azurerm_windows_web_app" "app" {


name = local.app_name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
service_plan_id = azurerm_service_plan.app_service_plan.id

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"
}
}
}

5. Create a file named variables.tf and insert the following code:

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."
}
}

6. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. Get the Front Door endpoint:

Console

terraform output -raw frontDoorEndpointHostName

2. Paste the endpoint into a browser.

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

data "azurerm_client_config" "current" {}

resource "random_string" "azurerm_key_vault_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}
locals {
current_user_id = coalesce(var.msi_id,
data.azurerm_client_config.current.object_id)
}

resource "azurerm_key_vault" "vault" {


name = coalesce(var.vault_name,
"vault-${random_string.azurerm_key_vault_name.result}")
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
tenant_id =
data.azurerm_client_config.current.tenant_id
sku_name = var.sku_name
soft_delete_retention_days = 7

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
}
}

resource "random_string" "azurerm_key_vault_key_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_key_vault_key" "key" {


name = coalesce(var.key_name,
"key-${random_string.azurerm_key_vault_key_name.result}")

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"
}
}

4. Create a file named variables.tf and insert the following code:


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 "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
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure key vault name.

Console

azurerm_key_vault_name=$(terraform output -raw


azurerm_key_vault_name)

2. Run az keyvault key list to display information about the key vault's keys.

Azure CLI

az keyvault key list --vault-name $azurerm_key_vault_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


location = var.resource_group_location
name = random_pet.rg_name.id
}
resource "random_string" "azurerm_virtual_network_name" {
length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_virtual_network" "example" {


name = coalesce(var.virtual_network_name,
"vnet-${random_string.azurerm_virtual_network_name.result}")
resource_group_name = azurerm_resource_group.rg.name
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.rg.location
}

resource "random_string" "azurerm_subnet_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_subnet" "example" {


name = coalesce(var.subnet_name,
"subnet-${random_string.azurerm_subnet_name.result}")
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes = ["10.0.2.0/24"]
}

resource "random_string" "azurerm_amlfs_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_managed_lustre_file_system" "example" {


name = coalesce(var.amlfs_name,
"amlfs-${random_string.azurerm_amlfs_name.result}")
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku_name = var.amlfs_sku_name
subnet_id = azurerm_subnet.example.id
storage_capacity_in_tb = var.amlfs_storage_capacity_in_tb
zones = ["1"]
maintenance_window {
day_of_week = var.amlfs_maintenance_day_of_week
time_of_day_in_utc = var.amlfs_maintenance_time_of_day
}
}
4. Create a file named variables.tf and insert the following code:

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."
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the Managed Lustre file system name.

Console

managed_lustre_file_system_name=$(terraform output -raw


managed_lustre_file_system_name)

3. Run az amlfs show to display the Managed Lustre file system name.

Azure CLI

az amlfs show --resource-group $resource_group_name \


--name $managed_lustre_file_system_name \

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Next, you can explore more about Azure Managed Lustre.

Learn 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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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.

2. Create a file named providers.tf and insert the following code:

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 {}
}

3. Create a file named main.tf and insert the following code:

Terraform

data "azurerm_client_config" "current" {}

# Generate random resource group name


resource "random_pet" "rg_name" {
prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


location = var.resource_group_location
name = random_pet.rg_name.id
}

# Generate random value for the storage account name


resource "random_string" "storage_account_name" {
length = 8
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_storage_account" "storage_account" {


resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location

name = random_string.storage_account_name.result

account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"

static_website {
index_document = "index.html"
}
}

resource "azurerm_storage_blob" "example" {


name = "index.html"
storage_account_name = azurerm_storage_account.storage_account.name
storage_container_name = "$web"
type = "Block"
content_type = "text/html"
source = "index.html"
}

4. Create a file named variables.tf and insert the following code:

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"
}

5. Create a file named outputs.tf and insert the following code:

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
}

6. Create a file named index.html and insert the following code:

HTML

<h1> This is a static website example <h1>

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the URL to the static web site.

Console

primary_web_host=$(terraform output -raw primary_web_host)

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:

1. Run terraform plan and specify the destroy flag.

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Introduction to Azure Blob Storage
Quickstart: Create an Azure API
Management instance using Terraform
Article • 03/21/2024

APPLIES TO: Developer | Standard | Premium

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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.

Install and configure Terraform

For Azure CLI:


Use the Bash environment in Azure Cloud Shell. For more information, see
Quickstart for Bash in Azure Cloud Shell.

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.

For Azure PowerShell:


If you choose to use Azure PowerShell locally:
Install the latest version of the Az PowerShell module.
Connect to your Azure account using the Connect-AzAccount cmdlet.
If you choose to use Azure Cloud Shell:
See Overview of Azure Cloud Shell for more information.

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_api_management_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_api_management" "api" {


name =
"apiservice${random_string.azurerm_api_management_name.result}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
publisher_email = var.publisher_email
publisher_name = var.publisher_name
sku_name = "${var.sku}_${var.sku_count}"
}

3. Create a file named outputs.tf and insert the following code:

Terraform

output "resource_group_name" {
value = azurerm_resource_group.rg.name
}

output "api_management_service_name" {
value = azurerm_api_management.api.name
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the service name.

Console
api_management_service_name=$(terraform output -raw
api_management_service_name)

3. Run az apim show to display information about the new service.

Azure CLI

az apim show --resource-group $resource_group_name \


--name $api_management_service_name

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

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure
Next steps
Tutorial: Import and publish your first API

) Note: The author created this article with assistance from AI. Learn more

Feedback
Was this page helpful?  Yes  No

Provide product feedback


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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

Implement the Terraform code

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.

2. Create a file named main.tf and insert the following code:


Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_search_service_name" {


length = 25
upper = false
numeric = false
special = false
}

resource "azurerm_search_service" "search" {


name =
random_string.azurerm_search_service_name.result
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = var.sku
replica_count = var.replica_count
partition_count = var.partition_count
}

3. Create a file named outputs.tf and insert the following code:

Terraform

output "resource_group_name" {
value = azurerm_resource_group.rg.name
}

output "azurerm_search_service_name" {
value = azurerm_search_service.search.name
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


1. Get the Azure resource name in which the Azure AI Search service was created.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the Azure AI Search service name.

Console

azurerm_search_service_name=$(terraform output -raw


azurerm_search_service_name)

3. Run az search service show to show the Azure AI Search service you created in this
article.

Azure CLI

az search service show --name $azurerm_search_service_name \


--resource-group $resource_group_name

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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 article applies to: ❌ Basic ✔️Standard ✔️Enterprise

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.

The Enterprise deployment plan includes the following Tanzu components:

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.

Review the Terraform plan


The configuration file used in this quickstart is from the Azure Spring Apps reference
architecture.

Enterprise plan
HashiCorp Configuration Language

# Azure provider version

terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "= 3.21.1"
}
}
}

provider "azurerm" {
features {}
}

### Create Resource group


resource "azurerm_resource_group" "sc_corp_rg" {
name = var.resource_group_name
location = var.location
}

### Create Application Insights


resource "azurerm_application_insights" "sc_app_insights" {
name = var.app_insights_name
location = var.location
resource_group_name = var.resource_group_name
application_type = "web"
workspace_id =
"/subscriptions/${var.subscription}/resourceGroups/${var.azurespringclou
dvnetrg}/providers/Microsoft.OperationalInsights/workspaces/${var.sc_law
_id}"

depends_on = [azurerm_resource_group.sc_corp_rg]
}

### Create Spring Cloud Service


resource "azurerm_spring_cloud_service" "sc" {
name = var.sc_service_name
resource_group_name = var.resource_group_name
location = var.location
sku_name = "E0"

# Tanzu service registry - Set to true if Enterprise Tier


service_registry_enabled = true
build_agent_pool_size = "S1"

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

### Update Diags setting for Spring Cloud Service

resource "azurerm_monitor_diagnostic_setting" "sc_diag" {


name = "monitoring"
target_resource_id = azurerm_spring_cloud_service.sc.id
log_analytics_workspace_id =
"/subscriptions/${var.subscription}/resourceGroups/${var.azurespringclou
dvnetrg}/providers/Microsoft.OperationalInsights/workspaces/${var.sc_law
_id}"

log {
category = "ApplicationConsole"
enabled = true

retention_policy {
enabled = false
}
}

metric {
category = "AllMetrics"

retention_policy {
enabled = false
}
}
}

# Begin Tanzu Components

resource "azurerm_spring_cloud_build_pack_binding" "appinsights-binding"


{
name = "appins-binding"
spring_cloud_builder_id =
"${azurerm_spring_cloud_service.sc.id}/buildServices/default/builders/de
fault"
binding_type = "ApplicationInsights"
launch {
properties = {
sampling_percentage = "10"
}

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
}

resource "azurerm_spring_cloud_api_portal" "apiportal" {


name = "default"
spring_cloud_service_id = azurerm_spring_cloud_service.sc.id
gateway_ids =
[azurerm_spring_cloud_gateway.scgateway.id]
https_only_enabled = false
public_network_access_enabled = true
instance_count = 1
}

Apply the Terraform plan


To apply the Terraform plan, follow these steps:

1. Save the variables.tf file for the Standard plan or the Enterprise plan locally,
then open it in an editor.

2. Edit the file to add the following values:

The subscription ID of the Azure account you'll be deploying to.


A deployment location from the regions where Azure Spring Apps is
available, as shown in Products available by region . You'll need the short
form of the location name. To get this value, use the following command to
generate a list of Azure locations, then look up the Name value for the region
you selected.

Azure CLI

az account list-locations --output table

3. Edit the file to add the following new deployment information:

The name of the resource group you'll deploy to.


A name of your choice for the Azure Spring Apps Deployment.
A name of your choice for the Application Insights resource.
Three CIDR ranges (at least /16) which are used to host the Azure Spring
Apps backend infrastructure. The CIDR ranges must not overlap with any
existing CIDR ranges in the target Subnet
The key/value pairs to be applied as tags on all resources that support tags.
For more information, see Use tags to organize your Azure resources and
management hierarchy

4. Edit the file to add the following existing infrastructure information:

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.

5. Run the following command to initialize the Terraform modules:

Bash

terraform init

6. Run the following command to create the Terraform deployment plan:

Bash

terraform plan -out=springcloud.plan


7. Run the following command to apply the Terraform deployment plan:

Bash

terraform apply springcloud.plan

Review deployed resources


You can either use the Azure portal to check the deployed resources, or use Azure CLI or
Azure PowerShell script to list the deployed resources.

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

terraform destroy -auto-approve

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "aazurerm_cdn_profile_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_cdn_profile" "profile" {


name =
"profile-${random_string.azurerm_cdn_endpoint_name.result}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku = var.cdn_sku
}

resource "random_string" "azurerm_cdn_endpoint_name" {


length = 13
lower = true
numeric = false
special = false
upper = false
}

resource "azurerm_cdn_endpoint" "endpoint" {


name =
"endpoint-${random_string.azurerm_cdn_endpoint_name.result}"
profile_name = azurerm_cdn_profile.profile.name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
is_http_allowed = true
is_https_allowed = true
querystring_caching_behaviour = "IgnoreQueryString"
is_compression_enabled = true
content_types_to_compress = [
"application/eot",
"application/font",
"application/font-sfnt",
"application/javascript",
"application/json",
"application/opentype",
"application/otf",
"application/pkcs7-mime",
"application/truetype",
"application/ttf",
"application/vnd.ms-fontobject",
"application/xhtml+xml",
"application/xml",
"application/xml+rss",
"application/x-font-opentype",
"application/x-font-truetype",
"application/x-font-ttf",
"application/x-httpd-cgi",
"application/x-javascript",
"application/x-mpegurl",
"application/x-opentype",
"application/x-otf",
"application/x-perl",
"application/x-ttf",
"font/eot",
"font/ttf",
"font/otf",
"font/opentype",
"image/svg+xml",
"text/css",
"text/csv",
"text/html",
"text/javascript",
"text/js",
"text/plain",
"text/richtext",
"text/tab-separated-values",
"text/xml",
"text/x-script",
"text/x-component",
"text/x-java-source",
]

origin {
name = "origin1"
host_name = var.origin_url
}
}

3. Create a file named outputs.tf and insert the following code:

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
}

4. Create a file named providers.tf and insert the following code:

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 {}
}

5. Create a file named variables.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name in which the Azure CDN profile and
endpoint were created.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the CDN profile name.

Console
cdn_profile_name=$(terraform output -raw cdn_profile_name)

3. Get the CDN endpoint name.

Console

cdn_endpoint_endpoint_name=$(terraform output -raw


cdn_endpoint_endpoint_name)

4. Run az cdn custom-domain show to show details of the custom domain you
created in this article.

Azure CLI

az cdn endpoint show --resource-group $resource_group_name \


--profile-name $cdn_profile_name \
--name $cdn_endpoint_endpoint_name

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

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.

2. Run terraform apply to apply the execution plan.


Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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.

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

In this article, you learn how to:

" 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

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 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.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "random_pet" "rg_name" {


prefix = var.resource_group_name_prefix
}

resource "azurerm_resource_group" "rg" {


name = random_pet.rg_name.id
location = var.resource_group_location
}

resource "random_string" "azurerm_notification_hub_namespace_name" {


length = 25
upper = false
numeric = false
special = false
}

resource "azurerm_notification_hub_namespace" "namespace" {


name =
"hubns-${random_string.azurerm_notification_hub_namespace_name.result}"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
namespace_type = "NotificationHub"
sku_name = "Free"
}

resource "random_string" "azurerm_notification_hub_name" {


length = 25
upper = false
numeric = false
special = false
}

resource "azurerm_notification_hub" "hub" {


name =
"hub-${random_string.azurerm_notification_hub_name.result}"
resource_group_name = azurerm_resource_group.rg.name
namespace_name =
azurerm_notification_hub_namespace.namespace.name
location = azurerm_resource_group.rg.location
}

4. Create a file named variables.tf and insert the following code:

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."
}

5. Create a file named outputs.tf and insert the following code:

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

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.

Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Verify the results


Azure CLI

1. Get the Azure resource group name.

Console

resource_group_name=$(terraform output -raw resource_group_name)

2. Get the namespace name.

Console

notification_hub_namespace_name=$(terraform output -raw


notification_hub_namespace_name)

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:

1. Run terraform plan and specify the destroy flag.

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Set up push notifications in Azure Notification Hubs
Testing Terraform code
Article • 05/27/2022

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

Implement integration testing


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:

Static code analysis tools such as lint and format.


Run terraform validate to verify the syntax of the configuration file.
Run terraform plan to ensure the configuration will work as expected.

Learn more about integration testing

Implement unit testing


Unit tests ensure a specific part or function of a program behave correctly. Unit tests are
written by the developer of the functionality. Sometimes called test-driven development,
or TDD, this type of testing involves continuous short development cycles. In the context
of Terraform projects, unit testing can take the form of using terraform plan to ensure
that the actual values available in the generated plan equal the expected values.

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.

Implement compliance testing


Compliance testing is used to ensure the configuration follows the policies you've
defined for the project. For example, you might define geopolitical naming conventions
for your Azure resources. Or you might want virtual machines to be created from a
defined subset of images. Compliance testing would be used to enforce these rules.

Compliance testing is also typically defined as part of the continuous integration


process.

Learn more about compliance testing

Implement end-to-end (E2E) testing


E2E tests validate a program works before deploying to production. An example
scenario might be a Terraform module deploying two virtual machines into a virtual
network. You might want to prevent the two machines from pinging each other. In this
example, you could define a test to verify the intended outcome before deployment.

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).

Learn more about end-to-end Testing


Comparing Terraform and Bicep
Article • 03/30/2023

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.

State and backend


Both Terraform and Bicep are desired state configuration (DSC) which makes it easy
to manage IT and development infrastructure as code. Terraform stores state about
your managed infrastructure and configuration. Terraform uses this information to
map real-world resources to your configuration, track metadata, and improve the
performance of larger infrastructures. State is stored in a local file named
terraform.tfstate , but can also be stored remotely. It's critical to back up and

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.

If your goal is to automate deployments to any of the following environments,


Terraform is likely the better option:
Virtualization environments
Multicloud scenarios - such as Azure and other cloud(s)
On-premises workloads

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:

az bicep : The az bicep commands allow you to perform such tasks as


installing Bicep, and building and publishing Bicep files.
az deployment : The article How to deploy resources with Bicep and Azure CLI
explains how to use Azure CLI with Bicep files to deploy your resources to
Azure.

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.

Thus, if an environment involves frequent out-of-band changes, Bicep is more user-


friendly. When you use Terraform, you should minimize out-of-band changes.

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Create an App Service


" Create an App Service slot
" Swap in and out of the example deployment slots

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

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.

3. Change directories to the clouddrive directory.

Bash

cd clouddrive

4. Create a directory named deploy .

Bash

mkdir deploy

5. Create a directory named swap .

Bash

mkdir swap

6. Use the ls bash command to verify that you successfully created both directories.

7. Change directories to the deploy directory.


Bash

cd deploy

8. In Cloud Shell, create a file named deploy.tf .

Bash

code deploy.tf

9. Insert the following code into the editor:

HashiCorp Configuration Language

# Configure the Azure provider


provider "azurerm" {
# The "feature" block is required for AzureRM provider 2.x.
# If you're using version 1.x, the "features" block is not allowed.
version = "~>2.0"
features {}
}

resource "azurerm_resource_group" "slotDemo" {


name = "slotDemoResourceGroup"
location = "westus2"
}

resource "azurerm_app_service_plan" "slotDemo" {


name = "slotAppServicePlan"
location = azurerm_resource_group.slotDemo.location
resource_group_name = azurerm_resource_group.slotDemo.name
sku {
tier = "Standard"
size = "S1"
}
}

resource "azurerm_app_service" "slotDemo" {


name = "slotAppService"
location = azurerm_resource_group.slotDemo.location
resource_group_name = azurerm_resource_group.slotDemo.name
app_service_plan_id = azurerm_app_service_plan.slotDemo.id
}

resource "azurerm_app_service_slot" "slotDemo" {


name = "slotAppServiceSlotOne"
location = azurerm_resource_group.slotDemo.location
resource_group_name = azurerm_resource_group.slotDemo.name
app_service_plan_id = azurerm_app_service_plan.slotDemo.id
app_service_name = azurerm_app_service.slotDemo.name
}

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

12. Initialize Terraform.

Bash

terraform init

13. Create the Terraform plan.

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

15. Close the Cloud Shell window.

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.

3. Fork the test project


Before you can test the creation and swapping in and out of the deployment slots, you
need to fork the test project from GitHub.

1. Browse to the awesome-terraform repo on GitHub .

2. Fork the awesome-terraform repo.

3. Follow any prompts to fork to your environment.

4. Deploy from GitHub to your deployment


slots
After you fork the test project repo, configure the deployment slots via the following
steps:

1. On the main menu of the Azure portal, select Resource groups.

2. Select slotDemoResourceGroup.

3. Select slotAppService.

4. Select Deployment options.


5. On the Deployment option tab, select Choose Source, and then select GitHub.
6. After Azure makes the connection and displays all the options, select
Authorization.

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.

9. Select Choose your organization and select your organization.

10. Select Choose project.

11. On the Choose project tab, select the awesome-terraform project.


12. Select Choose branch.

13. On the Choose branch tab, select master.


14. On the Deployment option tab, select OK.

At this point, you've deployed the production slot. To deploy the staging slot, do the
previous steps with the following modifications:

In step 3, select the slotAppServiceSlotOne resource.

In step 13, select the working branch.


5. Test the app deployments
In the previous sections, you set up two slots--slotAppService and
slotAppServiceSlotOne--to deploy from different branches in GitHub. Let's preview the
web apps to validate that they were successfully deployed.

1. On the main menu of the Azure portal, select Resource groups.

2. Select slotDemoResourceGroup.

3. Select either slotAppService or slotAppServiceSlotOne.

4. On the overview page, select URL.


5. Depending on the selected app, you see the following results:

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.

6. Swap the two deployment slots


To test swapping the two deployment slots, do the following steps:

1. Switch to the browser tab that's running slotAppService (the app with the blue
page).

2. Return to the Azure portal on a separate tab.

3. Open Cloud Shell.

4. Change directories to the clouddrive/swap directory.

Bash

cd clouddrive/swap

5. In Cloud Shell, create a file named swap.tf .

Bash

code swap.tf
6. Insert the following code into the editor:

HashiCorp Configuration Language

# Configure the Azure provider


provider "azurerm" {
# The "feature" block is required for AzureRM provider 2.x.
# If you're using version 1.x, the "features" block is not allowed.
version = "~>2.0"
features {}
}

# Swap the production slot and the staging slot


resource "azurerm_app_service_active_slot" "slotDemoActiveSlot" {
resource_group_name = "slotDemoResourceGroup"
app_service_name = "slotAppService"
app_service_slot_name = "slotappServiceSlotOne"
}

7. Save the file (<Ctrl>S) and exit the editor (<Ctrl>Q).

8. Initialize Terraform.

Bash

terraform init

9. Create the Terraform plan.

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

After the app is swapped, you see the original configuration.

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article provides an overview of how to use Terraform to deploy an ARM Azure
Virtual Desktop environment, not AVD Classic.

There are several pre-requisites requirements for Azure Virtual Desktop

New to Azure Virtual Desktop? Start with What is Azure Virtual Desktop?

It is assumed that an appropriate platform foundation is already setup which may or


may not be the Enterprise Scale Landing Zone platform foundation.

In this article, you learn how to:

" Use Terraform to create an Azure Virtual Desktop workspace


" Use Terraform to create an Azure Virtual Desktop host pool
" Use Terraform to create an Azure Desktop Application Group
" Associate a Workspace and a Desktop Application Group

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

# Resource group name is output when execution plan is applied.


resource "azurerm_resource_group" "sh" {
name = var.rg_name
location = var.resource_group_location
}

# Create AVD workspace


resource "azurerm_virtual_desktop_workspace" "workspace" {
name = var.workspace
resource_group_name = azurerm_resource_group.sh.name
location = azurerm_resource_group.sh.location
friendly_name = "${var.prefix} Workspace"
description = "${var.prefix} Workspace"
}

# Create AVD host pool


resource "azurerm_virtual_desktop_host_pool" "hostpool" {
resource_group_name = azurerm_resource_group.sh.name
location = azurerm_resource_group.sh.location
name = var.hostpool
friendly_name = var.hostpool
validate_environment = true
custom_rdp_properties = "audiocapturemode:i:1;audiomode:i:0;"
description = "${var.prefix} Terraform HostPool"
type = "Pooled"
maximum_sessions_allowed = 16
load_balancer_type = "DepthFirst" #[BreadthFirst DepthFirst]
}

resource "azurerm_virtual_desktop_host_pool_registration_info"
"registrationinfo" {
hostpool_id = azurerm_virtual_desktop_host_pool.hostpool.id
expiration_date = var.rfc3339
}

# Create AVD DAG


resource "azurerm_virtual_desktop_application_group" "dag" {
resource_group_name = azurerm_resource_group.sh.name
host_pool_id = azurerm_virtual_desktop_host_pool.hostpool.id
location = azurerm_resource_group.sh.location
type = "Desktop"
name = "${var.prefix}-dag"
friendly_name = "Desktop AppGroup"
description = "AVD application group"
depends_on = [azurerm_virtual_desktop_host_pool.hostpool,
azurerm_virtual_desktop_workspace.workspace]
}

# Associate Workspace and DAG


resource
"azurerm_virtual_desktop_workspace_application_group_association" "ws-
dag" {
application_group_id =
azurerm_virtual_desktop_application_group.dag.id
workspace_id = azurerm_virtual_desktop_workspace.workspace.id
}

4. Create a file named variables.tf and insert the following code:

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)"
}

5. Create a file named output.tf and insert the following code:

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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Verify the results


1. On the Azure portal, Select Azure Virtual Desktop.
2. Select Host pools and then the Name of the pool created resource.
3. Select Session hosts and then verify the session host is listed.

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Learn more about using Terraform in Azure

In this article, you learn how to:

" Use Terraform to create NIC for each session host


" Use Terraform to create VM for session host
" Join VM to domain
" Register VM with Azure Virtual Desktop
" Use variables file

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

Key points:

Use count to indicate how many resources will be created


References resources that were created when the infrastructure was built -
such as azurerm_subnet.subnet.id and
azurerm_virtual_desktop_host_pool.hostpool.name . If you changed the name

of these resources from that section, you also need to update the references
here.

3. Create a file named main.tf and insert the following code:

Terraform

locals {
registration_token =
azurerm_virtual_desktop_host_pool_registration_info.registrationinfo.to
ken
}

resource "random_string" "AVD_local_password" {


count = var.rdsh_count
length = 16
special = true
min_special = 2
override_special = "*!@#?"
}

resource "azurerm_resource_group" "rg" {


name = var.rg
location = var.resource_group_location
}
resource "azurerm_network_interface" "avd_vm_nic" {
count = var.rdsh_count
name = "${var.prefix}-${count.index + 1}-nic"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location

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
]
}

resource "azurerm_windows_virtual_machine" "avd_vm" {


count = var.rdsh_count
name = "${var.prefix}-${count.index + 1}"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
size = var.vm_size
network_interface_ids =
["${azurerm_network_interface.avd_vm_nic.*.id[count.index]}"]
provision_vm_agent = true
admin_username = var.local_admin_username
admin_password = var.local_admin_password

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
]
}

resource "azurerm_virtual_machine_extension" "domain_join" {


count = var.rdsh_count
name = "${var.prefix}-${count.index + 1}-
domainJoin"
virtual_machine_id =
azurerm_windows_virtual_machine.avd_vm.*.id[count.index]
publisher = "Microsoft.Compute"
type = "JsonADDomainExtension"
type_handler_version = "1.3"
auto_upgrade_minor_version = true

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
]
}

resource "azurerm_virtual_machine_extension" "vmext_dsc" {


count = var.rdsh_count
name = "${var.prefix}${count.index + 1}-
avd_dsc"
virtual_machine_id =
azurerm_windows_virtual_machine.avd_vm.*.id[count.index]
publisher = "Microsoft.Powershell"
type = "DSC"
type_handler_version = "2.73"
auto_upgrade_minor_version = true

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
]
}

4. Create a file named variables.tf and insert the following code:

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
}

1. Create a file named output.tf and insert the following code:

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

deploy_location = "west europe"


rg_name = "avd-resources-rg"
prefix = "avdtf"
local_admin_username = "localadm"
local_admin_password = "ChangeMe123$"
vnet_range = ["10.1.0.0/16"]
subnet_range = ["10.1.0.0/24"]
dns_servers = ["10.0.1.4", "168.63.129.16"]
aad_group_name = "AVDUsers"
domain_name = "infra.local"
domain_user_upn = "admin" # do not include domain name as this
is appended
domain_password = "ChangeMe123!"
ad_vnet = "infra-network"
ad_rg = "infra-rg"
avd_users = [
"[email protected]",
"[email protected]"
]

3. 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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Verify the results


1. On the Azure portal, Select Azure Virtual Desktop.
2. Select Host pools and then the Name of the pool created resource.
3. Select Session hosts and then verify the session host is listed.

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Use Terraform to read Microsoft Entra existing users


" Use Terraform to create Microsoft Entra group
" Role assignment for Azure Virtual Desktop

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

data "azuread_user" "aad_user" {


for_each = toset(var.avd_users)
user_principal_name = format("%s", each.key)
}

data "azurerm_role_definition" "role" { # access an existing built-in


role
name = "Desktop Virtualization User"
}

resource "azuread_group" "aad_group" {


display_name = var.aad_group_name
security_enabled = true
}

resource "azuread_group_member" "aad_group_member" {


for_each = data.azuread_user.aad_user
group_object_id = azuread_group.aad_group.id
member_object_id = each.value["id"]
}

resource "azurerm_role_assignment" "role" {


scope = azurerm_virtual_desktop_application_group.dag.id
role_definition_id = data.azurerm_role_definition.role.id
principal_id = azuread_group.aad_group.id
}

4. Create a file named variables.tf and insert the following code:

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"
}

1. Create a file named output.tf and insert the following code:

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

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.
7. Create a Terraform execution plan
Run terraform plan to create an execution plan.

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 .

8. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

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:

1. Run terraform plan and specify the destroy flag.

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article provides an overview of how to use Terraform to configure the network
settings for Azure Virtual Desktop.

In this article, you learn how to:

" Use Terraform to create a virtual network


" Use Terraform to create a subnet
" Use Terraform to create an NSG
" Peering the Azure Virtual Desktop vnet with hub vnet

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "azurerm_virtual_network" "vnet" {


name = "${var.prefix}-VNet"
address_space = var.vnet_range
dns_servers = var.dns_servers
location = var.deploy_location
resource_group_name = var.rg_name
depends_on = [azurerm_resource_group.rg]
}

resource "azurerm_subnet" "subnet" {


name = "default"
resource_group_name = var.rg_name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = var.subnet_range
depends_on = [azurerm_resource_group.rg]
}

resource "azurerm_network_security_group" "nsg" {


name = "${var.prefix}-NSG"
location = var.deploy_location
resource_group_name = var.rg_name
security_rule {
name = "HTTPS"
priority = 1001
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "443"
source_address_prefix = "*"
destination_address_prefix = "*"
}
depends_on = [azurerm_resource_group.rg]
}

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
}

data "azurerm_virtual_network" "ad_vnet_data" {


name = var.ad_vnet
resource_group_name = var.ad_rg
}

resource "azurerm_virtual_network_peering" "peer1" {


name = "peer_avdspoke_ad"
resource_group_name = var.rg_name
virtual_network_name = azurerm_virtual_network.vnet.name
remote_virtual_network_id =
data.azurerm_virtual_network.ad_vnet_data.id
}
resource "azurerm_virtual_network_peering" "peer2" {
name = "peer_ad_avdspoke"
resource_group_name = var.ad_rg
virtual_network_name = var.ad_vnet
remote_virtual_network_id = azurerm_virtual_network.vnet.id
}

4. Create a file named variables.tf and insert the following code:

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)"
}

1. Create a file named output.tf and insert the following code:

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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .
5. Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Verify the results


1. On the Azure portal, Select Azure Virtual Desktop.
2. Select Host pools and then the Name of the pool created resource.
3. Select Session hosts and then verify the session host is listed.

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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

In this article, you learn how to:

" Use Terraform to Azure File Storage account


" Use Terraform to configure File Share
" Use Terraform to configure RBAC permission on Azure File Storage

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

## Create a Resource Group for Storage


resource "azurerm_resource_group" "rg_storage" {
location = var.deploy_location
name = var.rg_stor
}

# generate a random string (consisting of four characters)


#
https://registry.terraform.io/providers/hashicorp/random/latest/docs/re
sources/string
resource "random_string" "random" {
length = 4
upper = false
special = false
}

## Azure Storage Accounts requires a globally unique names


## https://docs.microsoft.com/en-us/azure/storage/common/storage-
account-overview
## Create a File Storage Account
resource "azurerm_storage_account" "storage" {
name = "stor${random_string.random.id}"
resource_group_name = azurerm_resource_group.rg_storage.name
location = azurerm_resource_group.rg_storage.location
account_tier = "Premium"
account_replication_type = "LRS"
account_kind = "FileStorage"
}

resource "azurerm_storage_share" "FSShare" {


name = "fslogix"
storage_account_name = azurerm_storage_account.storage.name
depends_on = [azurerm_storage_account.storage]
}

## Azure built-in roles


## https://docs.microsoft.com/en-us/azure/role-based-access-
control/built-in-roles
data "azurerm_role_definition" "storage_role" {
name = "Storage File Data SMB Share Contributor"
}

resource "azurerm_role_assignment" "af_role" {


scope = azurerm_storage_account.storage.id
role_definition_id = data.azurerm_role_definition.storage_role.id
principal_id = azuread_group.aad_group.id
}

4. Create a file named variables.tf and insert the following code:

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"
}

2. Create a file named output.tf and insert the following code:

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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. 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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Learn more about using Terraform in Azure
Configure Azure Compute Gallery with
Terraform
Article • 10/26/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article shows you how to configure Azure Compute Gallery.

In this article, you learn how to:

" Use Terraform to configure Azure Compute Gallery (formerly Shared Image Gallery)

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "azurerm_resource_group" "sigrg" {


location = var.deploy_location
name = var.rg_shared_name
}

# generate a random string (consisting of four characters)


#
https://registry.terraform.io/providers/hashicorp/random/latest/docs/re
sources/string
resource "random_string" "rando" {
length = 4
upper = false
special = false
}

# Creates Shared Image Gallery


#
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/r
esources/shared_image_gallery
resource "azurerm_shared_image_gallery" "sig" {
name = "sig${random_string.random.id}"
resource_group_name = azurerm_resource_group.sigrg.name
location = azurerm_resource_group.sigrg.location
description = "Shared images"

tags = {
Environment = "Demo"
Tech = "Terraform"
}
}

#Creates image definition


#
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/r
esources/shared_image
resource "azurerm_shared_image" "example" {
name = "avd-image"
gallery_name = azurerm_shared_image_gallery.sig.name
resource_group_name = azurerm_resource_group.sigrg.name
location = azurerm_resource_group.sigrg.location
os_type = "Windows"

identifier {
publisher = "MicrosoftWindowsDesktop"
offer = "office-365"
sku = "20h2-evd-o365pp"
}
}

4. Create a file named variables.tf and insert the following code:

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"
}

1. Create a file named output.tf and insert the following code:

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
}

3. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

4. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

5. 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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Use Terraform to configure Azure Log Analytics Workspace

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "azurerm_resource_group" "log" {


name = var.rg_shared_name
location = var.deploy_location
}

# Creates Log Anaylytics Workspace


#
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/r
esources/log_analytics_workspace
resource "azurerm_log_analytics_workspace" "law" {
name = "log${random_string.random.id}"
location = azurerm_resource_group.log.location
resource_group_name = azurerm_resource_group.log.name
sku = "PerGB2018"
retention_in_days = 30
}

4. Create a file named variables.tf and insert the following code:

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"
}

1. Create a file named output.tf and insert the following code:

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

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.

5. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

6. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Learn more about using Terraform in Azure
Create an Azure virtual machine scale
set using Terraform
Article • 10/26/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Set up a Terraform deployment


" Use variables and outputs for Terraform deployment
" Create and deploy network infrastructure
" Create and deploy a virtual machine scale set and attach it to the network
" Create and deploy a jumpbox to connect to the VMs via SSH

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

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.

2. Implement the Terraform code


1. Create a directory in which to test the sample Terraform code and make it the
current directory.

2. Create a file named main.tf and insert the following code:

Terraform

terraform {
required_version = ">=0.12"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
}
}

provider "azurerm" {
features {}
}

resource "azurerm_resource_group" "vmss" {


name = var.resource_group_name
location = var.location
tags = var.tags
}

resource "random_string" "fqdn" {


length = 6
special = false
upper = false
number = false
}

resource "azurerm_virtual_network" "vmss" {


name = "vmss-vnet"
address_space = ["10.0.0.0/16"]
location = var.location
resource_group_name = azurerm_resource_group.vmss.name
tags = var.tags
}

resource "azurerm_subnet" "vmss" {


name = "vmss-subnet"
resource_group_name = azurerm_resource_group.vmss.name
virtual_network_name = azurerm_virtual_network.vmss.name
address_prefixes = ["10.0.2.0/24"]
}

resource "azurerm_public_ip" "vmss" {


name = "vmss-public-ip"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name
allocation_method = "Static"
domain_name_label = random_string.fqdn.result
tags = var.tags
}

resource "azurerm_lb" "vmss" {


name = "vmss-lb"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name

frontend_ip_configuration {
name = "PublicIPAddress"
public_ip_address_id = azurerm_public_ip.vmss.id
}

tags = var.tags
}

resource "azurerm_lb_backend_address_pool" "bpepool" {


loadbalancer_id = azurerm_lb.vmss.id
name = "BackEndAddressPool"
}

resource "azurerm_lb_probe" "vmss" {


resource_group_name = azurerm_resource_group.vmss.name
loadbalancer_id = azurerm_lb.vmss.id
name = "ssh-running-probe"
port = var.application_port
}

resource "azurerm_lb_rule" "lbnatrule" {


resource_group_name = azurerm_resource_group.vmss.name
loadbalancer_id = azurerm_lb.vmss.id
name = "http"
protocol = "Tcp"
frontend_port = var.application_port
backend_port = var.application_port
backend_address_pool_id =
azurerm_lb_backend_address_pool.bpepool.id
frontend_ip_configuration_name = "PublicIPAddress"
probe_id = azurerm_lb_probe.vmss.id
}

resource "azurerm_virtual_machine_scale_set" "vmss" {


name = "vmscaleset"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name
upgrade_policy_mode = "Manual"

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
}

resource "azurerm_public_ip" "jumpbox" {


name = "jumpbox-public-ip"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name
allocation_method = "Static"
domain_name_label = "${random_string.fqdn.result}-ssh"
tags = var.tags
}

resource "azurerm_network_interface" "jumpbox" {


name = "jumpbox-nic"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name

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
}

resource "azurerm_virtual_machine" "jumpbox" {


name = "jumpbox"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name
network_interface_ids = [azurerm_network_interface.jumpbox.id]
vm_size = "Standard_DS1_v2"

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
}

5. Create a file named web.conf and insert the following code:

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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Verify the results


1. From the output of the terraform apply command, you see values for the
following:

Virtual machine FQDN


Jumpbox FQDN
Jumpbox IP address

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Set up your Terraform deployment


" Use variables and outputs for Terraform deployment
" Create and deploy a network infrastructure
" Create a custom virtual machine image by using Packer
" Create and deploy a virtual machine scale set by using the custom image
" Create and deploy a jumpbox

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

2. Create a Packer image


1. Install Packer .

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

az group create -n myPackerImages -l eastus

3. Run az ad sp create-for-rbac to enable Packer to authenticate to Azure using a


service principal.

Azure CLI

az ad sp create-for-rbac --role Contributor --scopes


/subscriptions/<subscription_id> --query "{ client_id: appId,
client_secret: password, tenant_id: tenant }"

Key points:

Make note of the output values ( appId , client_secret , tenant_id ).

4. Run az account show to display the current Azure subscription.

Azure CLI

az account show --query "{ subscription_id: id }"

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"
}

source "azure-arm" "builder" {


client_id = var.client_id
client_secret = var.client_secret
image_offer = "UbuntuServer"
image_publisher = "canonical"
image_sku = "16.04-LTS"
location = var.location
managed_image_name = "myPackerImage"
managed_image_resource_group_name = var.image_resource_group_name
os_type = "Linux"
subscription_id = var.subscription_id
tenant_id = var.tenant_id
vm_size = "Standard_DS2_v2"
azure_tags = {
"dept" : "Engineering",
"task" : "Image deployment",
}
}

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:

Set the client_id , client_secret , and tenant_id fields to the respective


values from your service principal.
Set the subscription_id field to your Azure subscription ID.

6. Build the Packer image.

Console

packer build ubuntu.json

3. Implement the Terraform code


1. Create a directory in which to test the sample Terraform code and make it the
current directory.

2. Create a file named main.tf and insert the following code:

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 {}
}

resource "random_pet" "id" {}

resource "azurerm_resource_group" "vmss" {


name = coalesce(var.resource_group_name, "201-vmss-packer-
jumpbox-${random_pet.id.id}")
location = var.location
tags = var.tags
}

resource "random_string" "fqdn" {


length = 6
special = false
upper = false
numeric = false
}

resource "azurerm_virtual_network" "vmss" {


name = "vmss-vnet"
address_space = ["10.0.0.0/16"]
location = var.location
resource_group_name = azurerm_resource_group.vmss.name
tags = var.tags
}

resource "azurerm_subnet" "vmss" {


name = "vmss-subnet"
resource_group_name = azurerm_resource_group.vmss.name
virtual_network_name = azurerm_virtual_network.vmss.name
address_prefixes = ["10.0.2.0/24"]
}

resource "azurerm_public_ip" "vmss" {


name = "vmss-public-ip"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name
allocation_method = "Static"
domain_name_label = random_string.fqdn.result
tags = var.tags
}
resource "azurerm_lb" "vmss" {
name = "vmss-lb"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name

frontend_ip_configuration {
name = "PublicIPAddress"
public_ip_address_id = azurerm_public_ip.vmss.id
}

tags = var.tags
}

resource "azurerm_lb_backend_address_pool" "bpepool" {


loadbalancer_id = azurerm_lb.vmss.id
name = "BackEndAddressPool"
}

resource "azurerm_lb_probe" "vmss" {


resource_group_name = azurerm_resource_group.vmss.name
loadbalancer_id = azurerm_lb.vmss.id
name = "ssh-running-probe"
port = var.application_port
}

resource "azurerm_lb_rule" "lbnatrule" {


resource_group_name = azurerm_resource_group.vmss.name
loadbalancer_id = azurerm_lb.vmss.id
name = "http"
protocol = "Tcp"
frontend_port = var.application_port
backend_port = var.application_port
backend_address_pool_id =
azurerm_lb_backend_address_pool.bpepool.id
frontend_ip_configuration_name = "PublicIPAddress"
probe_id = azurerm_lb_probe.vmss.id
}

data "azurerm_resource_group" "image" {


name = var.packer_resource_group_name
}

data "azurerm_image" "image" {


name = var.packer_image_name
resource_group_name = data.azurerm_resource_group.image.name
}

resource "azapi_resource" "ssh_public_key" {


type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
name = random_pet.id.id
location = azurerm_resource_group.vmss.location
parent_id = azurerm_resource_group.vmss.id
}
resource "azapi_resource_action" "ssh_public_key_gen" {
type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
resource_id = azapi_resource.ssh_public_key.id
action = "generateKeyPair"
method = "POST"

response_export_values = ["publicKey", "privateKey"]


}

resource "random_password" "password" {


count = var.admin_password == null ? 1 : 0
length = 20
}

locals {
admin_password = try(random_password.password[0].result,
var.admin_password)
}

resource "azurerm_virtual_machine_scale_set" "vmss" {


name = "vmscaleset"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name
upgrade_policy_mode = "Manual"

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
}

resource "azurerm_public_ip" "jumpbox" {


name = "jumpbox-public-ip"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name
allocation_method = "Static"
domain_name_label = "${random_string.fqdn.result}-ssh"
tags = var.tags
}

resource "azurerm_network_interface" "jumpbox" {


name = "jumpbox-nic"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name

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
}

resource "azurerm_virtual_machine" "jumpbox" {


name = "jumpbox"
location = var.location
resource_group_name = azurerm_resource_group.vmss.name
network_interface_ids = [azurerm_network_interface.jumpbox.id]
vm_size = "Standard_DS1_v2"

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

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.

5. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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.

6. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

7. Verify the results


1. From the output of the terraform apply command, you see values for the
following:

Virtual machine FQDN


Jumpbox FQDN
Jumpbox IP address

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

Delete virtual machine scale set


When you no longer need the resources created via Terraform, do the following steps:

1. Run terraform plan and specify the destroy flag.

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.

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Delete Packer image and resource group


Run az group delete to delete the resource group used to contain the Packer image. The
Packer image is also deleted.

Azure CLI

az group delete --name myPackerImages --yes

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article shows how to deploy a PostgreSQL Flexible Server Database using Terraform.

In this article, you learn how to:

" Create an Azure resource group using azurerm_resource_group


" Create an Azure virtual network (VNet) using azurerm_virtual_network
" Create an Azure Network Security Group (NSG) using
azurerm_network_security_group
" Create an Azure subnet azurerm_subnet
" Create an Azure subnet Network Security Group (NSG) using
azurerm_subnet_network_security_group_association
" Define a private DNS zone within an Azure DNS using azurerm_private_dns_zone
" Define a private DNS zone VNet link using using
azurerm_private_dns_zone_virtual_network_link
" Deploy an Azure PostgreSQL Flexible Server on which the database runs using
azurerm_postgresql_flexible_server
" Instantiate an Azure PostgreSQL database using
azurerm_postgresql_flexible_server_database

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

2. Implement the Terraform code


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.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
}

resource "azurerm_resource_group" "default" {


name = random_pet.name_prefix.id
location = var.location
}

resource "azurerm_virtual_network" "default" {


name = "${random_pet.name_prefix.id}-vnet"
location = azurerm_resource_group.default.location
resource_group_name = azurerm_resource_group.default.name
address_space = ["10.0.0.0/16"]
}

resource "azurerm_network_security_group" "default" {


name = "${random_pet.name_prefix.id}-nsg"
location = azurerm_resource_group.default.location
resource_group_name = azurerm_resource_group.default.name

security_rule {
name = "test123"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

resource "azurerm_subnet" "default" {


name = "${random_pet.name_prefix.id}-subnet"
virtual_network_name = azurerm_virtual_network.default.name
resource_group_name = azurerm_resource_group.default.name
address_prefixes = ["10.0.2.0/24"]
service_endpoints = ["Microsoft.Storage"]

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
}

resource "azurerm_private_dns_zone" "default" {


name = "${random_pet.name_prefix.id}-
pdz.postgres.database.azure.com"
resource_group_name = azurerm_resource_group.default.name

depends_on =
[azurerm_subnet_network_security_group_association.default]
}

resource "azurerm_private_dns_zone_virtual_network_link" "default" {


name = "${random_pet.name_prefix.id}-
pdzvnetlink.com"
private_dns_zone_name = azurerm_private_dns_zone.default.name
virtual_network_id = azurerm_virtual_network.default.id
resource_group_name = azurerm_resource_group.default.name
}

resource "random_password" "pass" {


length = 20
}

resource "azurerm_postgresql_flexible_server" "default" {


name = "${random_pet.name_prefix.id}-server"
resource_group_name = azurerm_resource_group.default.name
location = azurerm_resource_group.default.location
version = "13"
delegated_subnet_id = azurerm_subnet.default.id
private_dns_zone_id = azurerm_private_dns_zone.default.id
administrator_login = "adminTerraform"
administrator_password = random_password.pass.result
zone = "1"
storage_mb = 32768
sku_name = "GP_Standard_D2s_v3"
backup_retention_days = 7

depends_on = [azurerm_private_dns_zone_virtual_network_link.default]
}

4. Create a file named postgresql-fs-db.tf and insert the following code to


instantiate the database:

Terraform

resource "azurerm_postgresql_flexible_server_database" "default" {


name = "${random_pet.name_prefix.id}-db"
server_id = azurerm_postgresql_flexible_server.default.id
collation = "en_US.UTF8"
charset = "UTF8"
}

5. Create a file named variables.tf and insert the following code:

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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Verify the results


Azure CLI

Run az postgres flexible-server db show to display the Azure PostgreSQL database.

Azure CLI

az postgres flexible-server db show --resource-group


<resource_group_name> --server-name <server_name> --database-name
<database_name>

Key points:

The values for the <resource_group_name> , <server_name> , and


<database_name> are displayed in the terraform apply output.

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article shows how to deploy a PostgreSQL Flexible Server Database using Terraform.

In this article, you learn how to:

" Create an Azure resource group using azurerm_resource_group


" Create an Azure virtual network (VNet) using azurerm_virtual_network
" Create an Azure Network Security Group (NSG) using
azurerm_network_security_group
" Create an Azure subnet azurerm_subnet
" Create an Azure subnet Network Security Group (NSG) using
azurerm_subnet_network_security_group_association
" Define a private DNS zone within an Azure DNS using azurerm_private_dns_zone
" Define a private DNS zone VNet link using using
azurerm_private_dns_zone_virtual_network_link
" Deploy an Azure PostgreSQL Flexible Server on which the database runs using
azurerm_postgresql_flexible_server
" Instantiate an Azure PostgreSQL database using
azurerm_postgresql_flexible_server_database

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

2. Implement the Terraform code


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.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
}

resource "azurerm_resource_group" "default" {


name = random_pet.name_prefix.id
location = var.location
}

resource "azurerm_virtual_network" "default" {


name = "${random_pet.name_prefix.id}-vnet"
location = azurerm_resource_group.default.location
resource_group_name = azurerm_resource_group.default.name
address_space = ["10.0.0.0/16"]
}

resource "azurerm_network_security_group" "default" {


name = "${random_pet.name_prefix.id}-nsg"
location = azurerm_resource_group.default.location
resource_group_name = azurerm_resource_group.default.name

security_rule {
name = "test123"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

resource "azurerm_subnet" "default" {


name = "${random_pet.name_prefix.id}-subnet"
virtual_network_name = azurerm_virtual_network.default.name
resource_group_name = azurerm_resource_group.default.name
address_prefixes = ["10.0.2.0/24"]
service_endpoints = ["Microsoft.Storage"]

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
}

resource "azurerm_private_dns_zone" "default" {


name = "${random_pet.name_prefix.id}-
pdz.postgres.database.azure.com"
resource_group_name = azurerm_resource_group.default.name

depends_on =
[azurerm_subnet_network_security_group_association.default]
}

resource "azurerm_private_dns_zone_virtual_network_link" "default" {


name = "${random_pet.name_prefix.id}-
pdzvnetlink.com"
private_dns_zone_name = azurerm_private_dns_zone.default.name
virtual_network_id = azurerm_virtual_network.default.id
resource_group_name = azurerm_resource_group.default.name
}

resource "random_password" "pass" {


length = 20
}

resource "azurerm_postgresql_flexible_server" "default" {


name = "${random_pet.name_prefix.id}-server"
resource_group_name = azurerm_resource_group.default.name
location = azurerm_resource_group.default.location
version = "13"
delegated_subnet_id = azurerm_subnet.default.id
private_dns_zone_id = azurerm_private_dns_zone.default.id
administrator_login = "adminTerraform"
administrator_password = random_password.pass.result
zone = "1"
storage_mb = 32768
sku_name = "GP_Standard_D2s_v3"
backup_retention_days = 7

depends_on = [azurerm_private_dns_zone_virtual_network_link.default]
}

4. Create a file named postgresql-fs-db.tf and insert the following code to


instantiate the database:

Terraform

resource "azurerm_postgresql_flexible_server_database" "default" {


name = "${random_pet.name_prefix.id}-db"
server_id = azurerm_postgresql_flexible_server.default.id
collation = "en_US.UTF8"
charset = "UTF8"
}

5. Create a file named variables.tf and insert the following code:

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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Verify the results


Azure CLI

Run az postgres flexible-server db show to display the Azure PostgreSQL database.

Azure CLI

az postgres flexible-server db show --resource-group


<resource_group_name> --server-name <server_name> --database-name
<database_name>

Key points:

The values for the <resource_group_name> , <server_name> , and


<database_name> are displayed in the terraform apply output.

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Learn more about PostgreSQL Flexible Server
Configure an Azure Network Watcher
Connection using Terraform
Article • 10/26/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article shows example Terraform code for setting up Network Watcher on Azure to
monitor the network health for a Network Security Group.

In this article, you learn how to:

" Configure an Azure Network Watcher and flow logs

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

2. Configure an Azure Network Watcher and


flow logs
1. Create a directory in which to test the sample Terraform code and make it the
current directory.

2. Create a file named main.tf and insert the following code:

HashiCorp Configuration Language


provider azurerm {
version = "~>2.0"

features {}
}

resource "azurerm_resource_group" "application1" {


name = "app1_rg"
location = "northcentralus"
}

# Networking components to be monitored


resource "azurerm_network_security_group" "application1" {
name = "application1"
location = azurerm_resource_group.application1.location
resource_group_name = azurerm_resource_group.application1.name

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 = "*"
}
}

# Log collection components


resource "azurerm_storage_account" "network_log_data" {
name = "app1logdata"
resource_group_name = azurerm_resource_group.application1.name
location =
azurerm_resource_group.application1.location

account_tier = "Standard"
account_replication_type = "GRS"
min_tls_version = "TLS1_2"
}

resource "azurerm_log_analytics_workspace" "traffic_analytics" {


name = "app007-traffic-analytics"
location = azurerm_resource_group.application1.location
resource_group_name = azurerm_resource_group.application1.name
retention_in_days = 90
daily_quota_gb = 10
}

# The Network Watcher Instance & network log flow


# There can only be one Network Watcher per subscription and region

resource "azurerm_network_watcher" "app1_traffic" {


name = "NetworkWatcher_northcentralus"
location = azurerm_resource_group.application1.location
resource_group_name = azurerm_resource_group.application1.name
}

resource "azurerm_network_watcher_flow_log" "app1_network_logs" {


network_watcher_name = azurerm_network_watcher.app1_traffic.name
resource_group_name =
azurerm_network_watcher.app1_traffic.resource_group_name

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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Network security group flow logging
Provision infrastructure with Azure
deployment slots using Terraform
Article • 10/26/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Create an App Service


" Create an App Service slot
" Swap in and out of the example deployment slots

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

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.

3. Change directories to the clouddrive directory.

Bash

cd clouddrive

4. Create a directory named deploy .

Bash

mkdir deploy

5. Create a directory named swap .

Bash

mkdir swap

6. Use the ls bash command to verify that you successfully created both directories.

7. Change directories to the deploy directory.


Bash

cd deploy

8. In Cloud Shell, create a file named deploy.tf .

Bash

code deploy.tf

9. Insert the following code into the editor:

HashiCorp Configuration Language

# Configure the Azure provider


provider "azurerm" {
# The "feature" block is required for AzureRM provider 2.x.
# If you're using version 1.x, the "features" block is not allowed.
version = "~>2.0"
features {}
}

resource "azurerm_resource_group" "slotDemo" {


name = "slotDemoResourceGroup"
location = "westus2"
}

resource "azurerm_app_service_plan" "slotDemo" {


name = "slotAppServicePlan"
location = azurerm_resource_group.slotDemo.location
resource_group_name = azurerm_resource_group.slotDemo.name
sku {
tier = "Standard"
size = "S1"
}
}

resource "azurerm_app_service" "slotDemo" {


name = "slotAppService"
location = azurerm_resource_group.slotDemo.location
resource_group_name = azurerm_resource_group.slotDemo.name
app_service_plan_id = azurerm_app_service_plan.slotDemo.id
}

resource "azurerm_app_service_slot" "slotDemo" {


name = "slotAppServiceSlotOne"
location = azurerm_resource_group.slotDemo.location
resource_group_name = azurerm_resource_group.slotDemo.name
app_service_plan_id = azurerm_app_service_plan.slotDemo.id
app_service_name = azurerm_app_service.slotDemo.name
}

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

12. Initialize Terraform.

Bash

terraform init

13. Create the Terraform plan.

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

15. Close the Cloud Shell window.

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.

3. Fork the test project


Before you can test the creation and swapping in and out of the deployment slots, you
need to fork the test project from GitHub.

1. Browse to the awesome-terraform repo on GitHub .

2. Fork the awesome-terraform repo.

3. Follow any prompts to fork to your environment.

4. Deploy from GitHub to your deployment


slots
After you fork the test project repo, configure the deployment slots via the following
steps:

1. On the main menu of the Azure portal, select Resource groups.

2. Select slotDemoResourceGroup.

3. Select slotAppService.

4. Select Deployment options.


5. On the Deployment option tab, select Choose Source, and then select GitHub.
6. After Azure makes the connection and displays all the options, select
Authorization.

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.

9. Select Choose your organization and select your organization.

10. Select Choose project.

11. On the Choose project tab, select the awesome-terraform project.


12. Select Choose branch.

13. On the Choose branch tab, select master.


14. On the Deployment option tab, select OK.

At this point, you've deployed the production slot. To deploy the staging slot, do the
previous steps with the following modifications:

In step 3, select the slotAppServiceSlotOne resource.

In step 13, select the working branch.


5. Test the app deployments
In the previous sections, you set up two slots--slotAppService and
slotAppServiceSlotOne--to deploy from different branches in GitHub. Let's preview the
web apps to validate that they were successfully deployed.

1. On the main menu of the Azure portal, select Resource groups.

2. Select slotDemoResourceGroup.

3. Select either slotAppService or slotAppServiceSlotOne.

4. On the overview page, select URL.


5. Depending on the selected app, you see the following results:

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.

6. Swap the two deployment slots


To test swapping the two deployment slots, do the following steps:

1. Switch to the browser tab that's running slotAppService (the app with the blue
page).

2. Return to the Azure portal on a separate tab.

3. Open Cloud Shell.

4. Change directories to the clouddrive/swap directory.

Bash

cd clouddrive/swap

5. In Cloud Shell, create a file named swap.tf .

Bash

code swap.tf
6. Insert the following code into the editor:

HashiCorp Configuration Language

# Configure the Azure provider


provider "azurerm" {
# The "feature" block is required for AzureRM provider 2.x.
# If you're using version 1.x, the "features" block is not allowed.
version = "~>2.0"
features {}
}

# Swap the production slot and the staging slot


resource "azurerm_app_service_active_slot" "slotDemoActiveSlot" {
resource_group_name = "slotDemoResourceGroup"
app_service_name = "slotAppService"
app_service_slot_name = "slotappServiceSlotOne"
}

7. Save the file (<Ctrl>S) and exit the editor (<Ctrl>Q).

8. Initialize Terraform.

Bash

terraform init

9. Create the Terraform plan.

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

After the app is swapped, you see the original configuration.

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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).

How does it work?


Application Gateway for Containers is made up of three components:

Application Gateway for Containers resource


Frontends
Associations

The following dependencies are also referenced in an Application Gateway for


Containers deployment:

Private IP address
Subnet Delegation
User-assigned Managed Identity

The architecture of Application Gateway for Containers is summarized in the following


figure:
For details about how Application Gateway for Containers accepts incoming requests
and routes them to a backend target, see Application Gateway for Containers
components.

Features and benefits


Application Gateway for Containers offers some entirely new features at release, such as:

Traffic splitting / Weighted round robin


Mutual authentication to the backend target
Kubernetes support for Ingress and Gateway API
Flexible deployment strategies
Increased performance, offering near real-time updates to add or move pods,
routes, and probes

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.

Load balancing features


Application Gateway for Containers supports the following features for traffic
management:

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

Implementation of Gateway API


ALB Controller implements version v1 of the Gateway API .

ノ Expand table

Gateway API Support Comments


Resource

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

ReferenceGrant Yes Currently supports version v1alpha1 of this API

Implementation of Ingress API


ALB Controller implements support for Ingress .

ノ Expand table

Ingress API Resource Support Comments

Ingress Yes Support for HTTP and HTTPS protocol on the listener.

Report issues and provide feedback


For feedback, post a new idea in feedback.azure.com For issues, raise a support
request via the Azure portal on your Application Gateway for Containers resource.

Pricing and SLA


For Application Gateway for Containers pricing information, see Application Gateway
pricing .

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

Provide product feedback


Migrate Azure Firewall Standard to
Premium using Terraform
Article • 10/26/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Deploy a standard Azure Firewall with classic rules using Terraform


" Import the firewall rules into a premium firewall policy
" Edit the Terraform configuration file to migrate the firewall

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

2. Implement the Terraform code


1. Create a directory in which to test the sample Terraform code and make it the
current directory.

2. Create a file named main.tf and insert the following code:


Terraform

resource "azurerm_resource_group" "rg" {


name = "${random_pet.prefix.id}-rg"
location = var.resource_group_location
}

resource "azurerm_virtual_network" "vnet" {


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
}

resource "azurerm_subnet" "subnet" {


name = "AzureFirewallSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.0.1.0/24"]
}

resource "azurerm_public_ip" "pip" {


name = "${random_pet.prefix.id}-pip"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_firewall" "main" {


name = "${random_pet.prefix.id}-fw"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku_name = "AZFW_VNet"
sku_tier = "Standard"

ip_configuration {
name = "configuration"
subnet_id = azurerm_subnet.subnet.id
public_ip_address_id = azurerm_public_ip.pip.id
}
}

resource "azurerm_firewall_application_rule_collection" "app-rc" {


name = "${random_pet.prefix.id}-app-rc"
azure_firewall_name = azurerm_firewall.main.name
resource_group_name = azurerm_resource_group.rg.name
priority = 100
action = "Allow"

rule {
name = "testrule"

source_addresses = [
"10.0.0.0/16",
]

target_fqdns = [
"*.google.com",
]

protocol {
port = "443"
type = "Https"
}
}
}

resource "azurerm_firewall_network_rule_collection" "net-rc" {


name = "${random_pet.prefix.id}-net-rc"
azure_firewall_name = azurerm_firewall.main.name
resource_group_name = azurerm_resource_group.rg.name
priority = 100
action = "Allow"

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",
]
}
}

resource "random_pet" "prefix" {


prefix = var.prefix
length = 1
}

3. 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 "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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Import the firewall rules into a premium


policy
Now you have a standard firewall with classic rules. Next, create a premium Firewall
Policy and import the rules from the firewall.

1. On the Azure portal, select Create a resource.


2. Search for firewall policy and select it.
3. Select Create.
4. For Resource group select test-resources .
5. For Name, type prem-pol.
6. For Region, select East US.
7. For Policy tier, select Premium.
8. Select Next: DNS Settings, and continue until you reach the Rules page.
9. On the Rules page, select Import rules from an Azure Firewall.
10. Select testfirewall, and then select Import.
11. Select Review + create.
12. Select Create.
7. Edit the Terraform configuration file to
migrate the firewall
Open the main.tf file, and make the following changes:

1. Add the following 'data' section:

Terraform

data "azurerm_firewall_policy" "prem-pol" {


name = "prem-pol"
resource_group_name = azurerm_resource_group.rg.name
}

2. Modify the firewall resource:

Terraform

resource "azurerm_firewall" "fw" {


name = "testfirewall"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
firewall_policy_id = data.azurerm_firewall_policy.prem-pol.id
sku_tier = "Premium"

ip_configuration {
name = "configuration"
subnet_id = azurerm_subnet.subnet.id
public_ip_address_id = azurerm_public_ip.pip.id
}
}

3. Delete the classic rule collections:

Terraform

resource "azurerm_firewall_application_rule_collection" "app-rc" {


name = "apptestcollection"
azure_firewall_name = azurerm_firewall.fw.name
resource_group_name = azurerm_resource_group.rg.name
priority = 100
action = "Allow"

rule {
name = "testrule"

source_addresses = [
"10.0.0.0/16",
]
target_fqdns = [
"*.google.com",
]

protocol {
port = "443"
type = "Https"
}
}
}

resource "azurerm_firewall_network_rule_collection" "net-rc" {


name = "nettestcollection"
azure_firewall_name = azurerm_firewall.fw.name
resource_group_name = azurerm_resource_group.rg.name
priority = 100
action = "Allow"

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",
]
}
}

8. Apply the modified Terraform execution plan


1. terraform plan -out main.tfplan
2. terraform apply main.tfplan

9. Verify the results


1. Select the test-resources resource group.
2. Select the testfirewall resource.
3. Verify the Firewall sku is Premium.
4. Verify the firewall is using the prem-pol firewall policy.

10. 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

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 .

2. Run terraform apply to apply the execution plan.

Console
terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" 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

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

2. Understand hub and spoke topology


architecture
In the hub and spoke topology, the hub is a VNet. The VNet acts as a central point of
connectivity to your on-premises network. The spokes are VNets that peer with the hub,
and can be used to isolate workloads. Traffic flows between the on-premises datacenter
and the hub through an ExpressRoute or VPN gateway connection. The following image
demonstrates the components in a hub and spoke topology:

Benefits of the hub and spoke topology


A hub and spoke network topology is a way to isolate workloads while sharing common
services. These services include identity and security. The hub is a 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. Here are some benefits of the hub and spoke network
topology:

Cost savings by centralizing services in a single location that can be shared by


multiple workloads. These workloads include network virtual appliances and DNS
servers.
Overcome subscriptions limits by peering VNets from different subscriptions to
the central hub.
Separation of concerns between central IT (SecOps, InfraOps) and workloads
(DevOps).

Typical uses for the hub and spoke architecture


Some of the typical uses for a hub and spoke architecture include:

Many customers have workloads that are deployed in different environments.


These environments include development, testing, and production. Many times,
these workloads need to share services such as DNS, IDS, NTP, or AD DS. These
shared services can be placed in the hub VNet. That way, each environment is
deployed to a spoke to maintain isolation.
Workloads that don't require connectivity to each other, but require access to
shared services.
Enterprises that require central control over security aspects.
Enterprises that require segregated management for the workloads in each spoke.

3. Preview the demo components


As you work through each article in this series, various components are defined in
distinct Terraform scripts. The demo architecture created and deployed consists of the
following components:

On-premises network. A private local-area network running with an organization.


For hub and spoke reference architecture, a VNet in Azure is used to simulate an
on-premises network.

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.

4. Implement the Terraform code


1. Create a directory to contain the example code for the entire multi-article series.

2. Create a file named main.tf and insert the following code:

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.

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform 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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Implement an on-premises VNet in hub-spoke topology


" Create hub network appliance resources
" Create on-premises virtual machine
" Create on-premises virtual private network gateway

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

Create a hub and spoke hybrid network topology with Terraform in Azure.

2. Implement the Terraform code


1. Make the example directory created in the first article of this series the current
directory.

2. Create a file named on-prem.tf and insert the following code:

Terraform

locals {
onprem-location = "eastus"
onprem-resource-group = "onprem-vnet-rg"
prefix-onprem = "onprem"
}

resource "azurerm_resource_group" "onprem-vnet-rg" {


name = local.onprem-resource-group
location = local.onprem-location
}

resource "azurerm_virtual_network" "onprem-vnet" {


name = "onprem-vnet"
location = azurerm_resource_group.onprem-vnet-
rg.location
resource_group_name = azurerm_resource_group.onprem-vnet-rg.name
address_space = ["192.168.0.0/16"]

tags = {
environment = local.prefix-onprem
}
}

resource "azurerm_subnet" "onprem-gateway-subnet" {


name = "GatewaySubnet"
resource_group_name = azurerm_resource_group.onprem-vnet-rg.name
virtual_network_name = azurerm_virtual_network.onprem-vnet.name
address_prefixes = ["192.168.255.224/27"]
}

resource "azurerm_subnet" "onprem-mgmt" {


name = "mgmt"
resource_group_name = azurerm_resource_group.onprem-vnet-rg.name
virtual_network_name = azurerm_virtual_network.onprem-vnet.name
address_prefixes = ["192.168.1.128/25"]
}

resource "azurerm_public_ip" "onprem-pip" {


name = "${local.prefix-onprem}-pip"
location = azurerm_resource_group.onprem-vnet-
rg.location
resource_group_name = azurerm_resource_group.onprem-vnet-rg.name
allocation_method = "Dynamic"

tags = {
environment = local.prefix-onprem
}
}

resource "azurerm_network_interface" "onprem-nic" {


name = "${local.prefix-onprem}-nic"
location = azurerm_resource_group.onprem-vnet-
rg.location
resource_group_name = azurerm_resource_group.onprem-vnet-rg.name
enable_ip_forwarding = true

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
}
}

# Create Network Security Group and rule


resource "azurerm_network_security_group" "onprem-nsg" {
name = "${local.prefix-onprem}-nsg"
location = azurerm_resource_group.onprem-vnet-
rg.location
resource_group_name = azurerm_resource_group.onprem-vnet-rg.name

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"
}
}

resource "azurerm_subnet_network_security_group_association" "mgmt-nsg-


association" {
subnet_id = azurerm_subnet.onprem-mgmt.id
network_security_group_id = azurerm_network_security_group.onprem-
nsg.id
}

resource "azurerm_virtual_machine" "onprem-vm" {


name = "${local.prefix-onprem}-vm"
location = azurerm_resource_group.onprem-vnet-
rg.location
resource_group_name = azurerm_resource_group.onprem-vnet-rg.name
network_interface_ids = [azurerm_network_interface.onprem-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-onprem}-vm"
admin_username = var.username
admin_password = var.password
}

os_profile_linux_config {
disable_password_authentication = false
}

tags = {
environment = local.prefix-onprem
}
}

resource "azurerm_public_ip" "onprem-vpn-gateway1-pip" {


name = "${local.prefix-onprem}-vpn-gateway1-pip"
location = azurerm_resource_group.onprem-vnet-
rg.location
resource_group_name = azurerm_resource_group.onprem-vnet-rg.name

allocation_method = "Dynamic"
}

resource "azurerm_virtual_network_gateway" "onprem-vpn-gateway" {


name = "onprem-vpn-gateway1"
location = azurerm_resource_group.onprem-vnet-
rg.location
resource_group_name = azurerm_resource_group.onprem-vnet-rg.name

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]

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Implement the hub virtual network in a hub-and-spoke topology.


" Create a hub jumpbox virtual machine.
" Create a hub virtual private network gateway.
" Create hub and on-premises gateway connections.

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

Create a hub-and-spoke hybrid network topology with Terraform in Azure.

Create an on-premises virtual network with Terraform in Azure.


2. Implement the Terraform code
The hub network consists of the following components:

A hub virtual network


A hub virtual network gateway
Hub gateway connections

1. Make the example directory created in the first article of this series the current
directory.

2. In the example directory, create a file named hub-vnet.tf .

3. Insert the following code:

Terraform

locals {
prefix-hub = "hub"
hub-location = "eastus"
hub-resource-group = "hub-vnet-rg"
shared-key = "4-v3ry-53cr37-1p53c-5h4r3d-k3y"
}

resource "azurerm_resource_group" "hub-vnet-rg" {


name = local.hub-resource-group
location = local.hub-location
}

resource "azurerm_virtual_network" "hub-vnet" {


name = "${local.prefix-hub}-vnet"
location = azurerm_resource_group.hub-vnet-rg.location
resource_group_name = azurerm_resource_group.hub-vnet-rg.name
address_space = ["10.0.0.0/16"]

tags = {
environment = "hub-spoke"
}
}

resource "azurerm_subnet" "hub-gateway-subnet" {


name = "GatewaySubnet"
resource_group_name = azurerm_resource_group.hub-vnet-rg.name
virtual_network_name = azurerm_virtual_network.hub-vnet.name
address_prefixes = ["10.0.255.224/27"]
}

resource "azurerm_subnet" "hub-mgmt" {


name = "mgmt"
resource_group_name = azurerm_resource_group.hub-vnet-rg.name
virtual_network_name = azurerm_virtual_network.hub-vnet.name
address_prefixes = ["10.0.0.64/27"]
}

resource "azurerm_subnet" "hub-dmz" {


name = "dmz"
resource_group_name = azurerm_resource_group.hub-vnet-rg.name
virtual_network_name = azurerm_virtual_network.hub-vnet.name
address_prefixes = ["10.0.0.32/27"]
}

resource "azurerm_network_interface" "hub-nic" {


name = "${local.prefix-hub}-nic"
location = azurerm_resource_group.hub-vnet-rg.location
resource_group_name = azurerm_resource_group.hub-vnet-rg.name
enable_ip_forwarding = true

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
}
}

# Virtual Network Gateway


resource "azurerm_public_ip" "hub-vpn-gateway1-pip" {
name = "hub-vpn-gateway1-pip"
location = azurerm_resource_group.hub-vnet-rg.location
resource_group_name = azurerm_resource_group.hub-vnet-rg.name

allocation_method = "Dynamic"
}

resource "azurerm_virtual_network_gateway" "hub-vnet-gateway" {


name = "hub-vpn-gateway1"
location = azurerm_resource_group.hub-vnet-rg.location
resource_group_name = azurerm_resource_group.hub-vnet-rg.name

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]
}

resource "azurerm_virtual_network_gateway_connection" "hub-onprem-conn"


{
name = "hub-onprem-conn"
location = azurerm_resource_group.hub-vnet-rg.location
resource_group_name = azurerm_resource_group.hub-vnet-rg.name

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
}

resource "azurerm_virtual_network_gateway_connection" "onprem-hub-conn"


{
name = "onprem-hub-conn"
location = azurerm_resource_group.onprem-vnet-
rg.location
resource_group_name = azurerm_resource_group.onprem-vnet-rg.name
type = "Vnet2Vnet"
routing_weight = 1
virtual_network_gateway_id =
azurerm_virtual_network_gateway.onprem-vpn-gateway.id
peer_virtual_network_gateway_id =
azurerm_virtual_network_gateway.hub-vnet-gateway.id

shared_key = local.shared-key
}

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

A VPN device is a device that provides external connectivity to an on-premises network.


The VPN device may be a hardware device or a software solution. One example of a
software solution is Routing and Remote Access Service (RRAS) in Windows Server 2012.
For more information about VPN appliances, see About VPN devices for Site-to-Site
VPN Gateway connections.

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 .

In this article, you learn how to:

" Implement the Hub VNet in hub-spoke topology


" Create Hub Network Virtual Machine which acts as appliance
" Enable routes using CustomScript extensions
" Create Hub and Spoke gateway route tables

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
Create a hub and spoke hybrid network topology with Terraform in Azure.

Create on-premises virtual network with Terraform in Azure.

Create a hub virtual network with Terraform in Azure.

2. Implement the Terraform code


1. Make the example directory created in the first article of this series the current
directory.

2. Create a file named hub-nva.tf and insert the following code:

Terraform

locals {
prefix-hub-nva = "hub-nva"
hub-nva-location = "eastus"
hub-nva-resource-group = "hub-nva-rg"
}

resource "azurerm_resource_group" "hub-nva-rg" {


name = "${local.prefix-hub-nva}-rg"
location = local.hub-nva-location

tags = {
environment = local.prefix-hub-nva
}
}

resource "azurerm_network_interface" "hub-nva-nic" {


name = "${local.prefix-hub-nva}-nic"
location = azurerm_resource_group.hub-nva-rg.location
resource_group_name = azurerm_resource_group.hub-nva-rg.name
enable_ip_forwarding = true

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
}
}

resource "azurerm_virtual_machine" "hub-nva-vm" {


name = "${local.prefix-hub-nva}-vm"
location = azurerm_resource_group.hub-nva-rg.location
resource_group_name = azurerm_resource_group.hub-nva-rg.name
network_interface_ids = [azurerm_network_interface.hub-nva-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-nva}-vm"
admin_username = var.username
admin_password = var.password
}

os_profile_linux_config {
disable_password_authentication = false
}

tags = {
environment = local.prefix-hub-nva
}
}

resource "azurerm_virtual_machine_extension" "enable-routes" {


name = "enable-iptables-routes"
virtual_machine_id = azurerm_virtual_machine.hub-nva-vm.id
publisher = "Microsoft.Azure.Extensions"
type = "CustomScript"
type_handler_version = "2.0"

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
}
}

resource "azurerm_subnet_route_table_association" "hub-gateway-rt-hub-


vnet-gateway-subnet" {
subnet_id = azurerm_subnet.hub-gateway-subnet.id
route_table_id = azurerm_route_table.hub-gateway-rt.id
depends_on = [azurerm_subnet.hub-gateway-subnet]
}

resource "azurerm_route_table" "spoke1-rt" {


name = "spoke1-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 = "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
}
}

resource "azurerm_subnet_route_table_association" "spoke1-rt-spoke1-


vnet-mgmt" {
subnet_id = azurerm_subnet.spoke1-mgmt.id
route_table_id = azurerm_route_table.spoke1-rt.id
depends_on = [azurerm_subnet.spoke1-mgmt]
}

resource "azurerm_subnet_route_table_association" "spoke1-rt-spoke1-


vnet-workload" {
subnet_id = azurerm_subnet.spoke1-workload.id
route_table_id = azurerm_route_table.spoke1-rt.id
depends_on = [azurerm_subnet.spoke1-workload]
}

resource "azurerm_route_table" "spoke2-rt" {


name = "spoke2-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 = "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
}
}

resource "azurerm_subnet_route_table_association" "spoke2-rt-spoke2-


vnet-mgmt" {
subnet_id = azurerm_subnet.spoke2-mgmt.id
route_table_id = azurerm_route_table.spoke2-rt.id
depends_on = [azurerm_subnet.spoke2-mgmt]
}

resource "azurerm_subnet_route_table_association" "spoke2-rt-spoke2-


vnet-workload" {
subnet_id = azurerm_subnet.spoke2-workload.id
route_table_id = azurerm_route_table.spoke2-rt.id
depends_on = [azurerm_subnet.spoke2-workload]
}

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Create a spoke virtual networks with Terraform in Azure
Create a spoke network in Azure using
Terraform
Article • 10/26/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Implement the Spoke VNets in hub-spoke topology


" Create Virtual machines in the spoke networks
" Establish virtual network peerings with the hub networks

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

Create a hub and spoke hybrid network topology with Terraform in Azure.

Create on-premises virtual network with Terraform in Azure.

Create a hub virtual network with Terraform in Azure.


Create a hub virtual network appliance with Terraform in Azure.

2. Implement the Terraform code


Two spoke scripts are created in this section. Each script defines a spoke virtual network
and a virtual machine for the workload. A peered virtual network from hub to spoke is
then created.

1. Make the example directory created in the first article of this series the current
directory.

2. Create a file named spoke1.tf and insert the following code:

Terraform

locals {
spoke1-location = "eastus"
spoke1-resource-group = "spoke1-vnet-rg"
prefix-spoke1 = "spoke1"
}

resource "azurerm_resource_group" "spoke1-vnet-rg" {


name = local.spoke1-resource-group
location = local.spoke1-location
}

resource "azurerm_virtual_network" "spoke1-vnet" {


name = "spoke1-vnet"
location = azurerm_resource_group.spoke1-vnet-
rg.location
resource_group_name = azurerm_resource_group.spoke1-vnet-rg.name
address_space = ["10.1.0.0/16"]

tags = {
environment = local.prefix-spoke1
}
}

resource "azurerm_subnet" "spoke1-mgmt" {


name = "mgmt"
resource_group_name = azurerm_resource_group.spoke1-vnet-rg.name
virtual_network_name = azurerm_virtual_network.spoke1-vnet.name
address_prefixes = ["10.1.0.64/27"]
}

resource "azurerm_subnet" "spoke1-workload" {


name = "workload"
resource_group_name = azurerm_resource_group.spoke1-vnet-rg.name
virtual_network_name = azurerm_virtual_network.spoke1-vnet.name
address_prefixes = ["10.1.1.0/24"]
}
resource "azurerm_virtual_network_peering" "spoke1-hub-peer" {
name = "spoke1-hub-peer"
resource_group_name = azurerm_resource_group.spoke1-vnet-
rg.name
virtual_network_name = azurerm_virtual_network.spoke1-
vnet.name
remote_virtual_network_id = azurerm_virtual_network.hub-vnet.id

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]
}

resource "azurerm_network_interface" "spoke1-nic" {


name = "${local.prefix-spoke1}-nic"
location = azurerm_resource_group.spoke1-vnet-
rg.location
resource_group_name = azurerm_resource_group.spoke1-vnet-rg.name
enable_ip_forwarding = true

ip_configuration {
name = local.prefix-spoke1
subnet_id = azurerm_subnet.spoke1-mgmt.id
private_ip_address_allocation = "Dynamic"
}
}

resource "azurerm_virtual_machine" "spoke1-vm" {


name = "${local.prefix-spoke1}-vm"
location = azurerm_resource_group.spoke1-vnet-
rg.location
resource_group_name = azurerm_resource_group.spoke1-vnet-rg.name
network_interface_ids = [azurerm_network_interface.spoke1-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-spoke1}-vm"
admin_username = var.username
admin_password = var.password
}

os_profile_linux_config {
disable_password_authentication = false
}

tags = {
environment = local.prefix-spoke1
}
}

resource "azurerm_virtual_network_peering" "hub-spoke1-peer" {


name = "hub-spoke1-peer"
resource_group_name = azurerm_resource_group.hub-vnet-rg.name
virtual_network_name = azurerm_virtual_network.hub-vnet.name
remote_virtual_network_id = azurerm_virtual_network.spoke1-vnet.id
allow_virtual_network_access = true
allow_forwarded_traffic = true
allow_gateway_transit = true
use_remote_gateways = false
depends_on = [azurerm_virtual_network.spoke1-vnet,
azurerm_virtual_network.hub-vnet, azurerm_virtual_network_gateway.hub-
vnet-gateway]
}

3. Create a file named spoke2.tf and insert the following code:

Terraform

locals {
spoke2-location = "eastus"
spoke2-resource-group = "spoke2-vnet-rg"
prefix-spoke2 = "spoke2"
}

resource "azurerm_resource_group" "spoke2-vnet-rg" {


name = local.spoke2-resource-group
location = local.spoke2-location
}

resource "azurerm_virtual_network" "spoke2-vnet" {


name = "${local.prefix-spoke2}-vnet"
location = azurerm_resource_group.spoke2-vnet-
rg.location
resource_group_name = azurerm_resource_group.spoke2-vnet-rg.name
address_space = ["10.2.0.0/16"]

tags = {
environment = local.prefix-spoke2
}
}

resource "azurerm_subnet" "spoke2-mgmt" {


name = "mgmt"
resource_group_name = azurerm_resource_group.spoke2-vnet-rg.name
virtual_network_name = azurerm_virtual_network.spoke2-vnet.name
address_prefixes = ["10.2.0.64/27"]
}

resource "azurerm_subnet" "spoke2-workload" {


name = "workload"
resource_group_name = azurerm_resource_group.spoke2-vnet-rg.name
virtual_network_name = azurerm_virtual_network.spoke2-vnet.name
address_prefixes = ["10.2.1.0/24"]
}

resource "azurerm_virtual_network_peering" "spoke2-hub-peer" {


name = "${local.prefix-spoke2}-hub-peer"
resource_group_name = azurerm_resource_group.spoke2-vnet-
rg.name
virtual_network_name = azurerm_virtual_network.spoke2-
vnet.name
remote_virtual_network_id = azurerm_virtual_network.hub-vnet.id

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]
}

resource "azurerm_network_interface" "spoke2-nic" {


name = "${local.prefix-spoke2}-nic"
location = azurerm_resource_group.spoke2-vnet-
rg.location
resource_group_name = azurerm_resource_group.spoke2-vnet-rg.name
enable_ip_forwarding = true

ip_configuration {
name = local.prefix-spoke2
subnet_id = azurerm_subnet.spoke2-mgmt.id
private_ip_address_allocation = "Dynamic"
}

tags = {
environment = local.prefix-spoke2
}
}

resource "azurerm_virtual_machine" "spoke2-vm" {


name = "${local.prefix-spoke2}-vm"
location = azurerm_resource_group.spoke2-vnet-
rg.location
resource_group_name = azurerm_resource_group.spoke2-vnet-rg.name
network_interface_ids = [azurerm_network_interface.spoke2-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-spoke2}-vm"
admin_username = var.username
admin_password = var.password
}

os_profile_linux_config {
disable_password_authentication = false
}

tags = {
environment = local.prefix-spoke2
}
}

resource "azurerm_virtual_network_peering" "hub-spoke2-peer" {


name = "hub-spoke2-peer"
resource_group_name = azurerm_resource_group.hub-vnet-rg.name
virtual_network_name = azurerm_virtual_network.hub-vnet.name
remote_virtual_network_id = azurerm_virtual_network.spoke2-vnet.id
allow_virtual_network_access = true
allow_forwarded_traffic = true
allow_gateway_transit = true
use_remote_gateways = false
depends_on = [azurerm_virtual_network.spoke2-vnet,
azurerm_virtual_network.hub-vnet, azurerm_virtual_network_gateway.hub-
vnet-gateway]
}

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure
Next steps
Validate a hub and spoke network with Terraform in Azure
Validate a hub and spoke network in
Azure using Terraform
Article • 10/26/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Implement the Hub VNet in hub-spoke topology


" Verify the resources to be deployed
" Create the resources in Azure
" Verify the connectivity between different networks

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

Create a hub and spoke hybrid network topology with Terraform in Azure

Create on-premises virtual network with Terraform in Azure

Create a hub virtual network with Terraform in Azure

Create a hub virtual network appliance with Terraform in Azure


Create a spoke virtual networks with Terraform in Azure

2. Verify your configuration


In the example directory, verify that all the files created in this article series are present:

File name Article in which file is created

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

on-prem.tf Create on-premises virtual network with Terraform in Azure

hub-vnet.tf Create a hub virtual network with Terraform in Azure

hub-nva.tf Create a hub virtual network appliance with Terraform in Azure

spoke1.tf Create a spoke virtual networks with Terraform in Azure

spoke2.tf Create a spoke virtual networks 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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Verify the results


This section shows how to test connectivity from the simulated on-premises
environment to the hub VNet.

1. Browse to the Azure portal .

2. In the Azure portal, browse to the onprem-vnet-rg resource group.

3. In the onprem-vnet-rg tab, select the VM named onprem-vm.

4. Note the Public IP Address value.


5. Return to the command line and run ssh to connect to the simulated on-premises
environment.

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:

1. Run terraform plan and specify the destroy flag.

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Learn more about using Terraform in Azure
Configure an Azure Network Watcher
Connection using Terraform
Article • 10/26/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article shows example Terraform code for setting up Network Watcher on Azure to
monitor the network health for a Network Security Group.

In this article, you learn how to:

" Configure an Azure Network Watcher and flow logs

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

2. Configure an Azure Network Watcher and


flow logs
1. Create a directory in which to test the sample Terraform code and make it the
current directory.

2. Create a file named main.tf and insert the following code:

HashiCorp Configuration Language


provider azurerm {
version = "~>2.0"

features {}
}

resource "azurerm_resource_group" "application1" {


name = "app1_rg"
location = "northcentralus"
}

# Networking components to be monitored


resource "azurerm_network_security_group" "application1" {
name = "application1"
location = azurerm_resource_group.application1.location
resource_group_name = azurerm_resource_group.application1.name

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 = "*"
}
}

# Log collection components


resource "azurerm_storage_account" "network_log_data" {
name = "app1logdata"
resource_group_name = azurerm_resource_group.application1.name
location =
azurerm_resource_group.application1.location

account_tier = "Standard"
account_replication_type = "GRS"
min_tls_version = "TLS1_2"
}

resource "azurerm_log_analytics_workspace" "traffic_analytics" {


name = "app007-traffic-analytics"
location = azurerm_resource_group.application1.location
resource_group_name = azurerm_resource_group.application1.name
retention_in_days = 90
daily_quota_gb = 10
}

# The Network Watcher Instance & network log flow


# There can only be one Network Watcher per subscription and region

resource "azurerm_network_watcher" "app1_traffic" {


name = "NetworkWatcher_northcentralus"
location = azurerm_resource_group.application1.location
resource_group_name = azurerm_resource_group.application1.name
}

resource "azurerm_network_watcher_flow_log" "app1_network_logs" {


network_watcher_name = azurerm_network_watcher.app1_traffic.name
resource_group_name =
azurerm_network_watcher.app1_traffic.resource_group_name

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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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).

How does it work?


Application Gateway for Containers is made up of three components:

Application Gateway for Containers resource


Frontends
Associations

The following dependencies are also referenced in an Application Gateway for


Containers deployment:

Private IP address
Subnet Delegation
User-assigned Managed Identity

The architecture of Application Gateway for Containers is summarized in the following


figure:
For details about how Application Gateway for Containers accepts incoming requests
and routes them to a backend target, see Application Gateway for Containers
components.

Features and benefits


Application Gateway for Containers offers some entirely new features at release, such as:

Traffic splitting / Weighted round robin


Mutual authentication to the backend target
Kubernetes support for Ingress and Gateway API
Flexible deployment strategies
Increased performance, offering near real-time updates to add or move pods,
routes, and probes

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.

Load balancing features


Application Gateway for Containers supports the following features for traffic
management:

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

Implementation of Gateway API


ALB Controller implements version v1 of the Gateway API .

ノ Expand table

Gateway API Support Comments


Resource

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

ReferenceGrant Yes Currently supports version v1alpha1 of this API

Implementation of Ingress API


ALB Controller implements support for Ingress .

ノ Expand table

Ingress API Resource Support Comments

Ingress Yes Support for HTTP and HTTPS protocol on the listener.

Report issues and provide feedback


For feedback, post a new idea in feedback.azure.com For issues, raise a support
request via the Azure portal on your Application Gateway for Containers resource.

Pricing and SLA


For Application Gateway for Containers pricing information, see Application Gateway
pricing .

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

Provide product feedback


Migrate Azure Firewall Standard to
Premium using Terraform
Article • 10/26/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Deploy a standard Azure Firewall with classic rules using Terraform


" Import the firewall rules into a premium firewall policy
" Edit the Terraform configuration file to migrate the firewall

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

2. Implement the Terraform code


1. Create a directory in which to test the sample Terraform code and make it the
current directory.

2. Create a file named main.tf and insert the following code:


Terraform

resource "azurerm_resource_group" "rg" {


name = "${random_pet.prefix.id}-rg"
location = var.resource_group_location
}

resource "azurerm_virtual_network" "vnet" {


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
}

resource "azurerm_subnet" "subnet" {


name = "AzureFirewallSubnet"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.0.1.0/24"]
}

resource "azurerm_public_ip" "pip" {


name = "${random_pet.prefix.id}-pip"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_firewall" "main" {


name = "${random_pet.prefix.id}-fw"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku_name = "AZFW_VNet"
sku_tier = "Standard"

ip_configuration {
name = "configuration"
subnet_id = azurerm_subnet.subnet.id
public_ip_address_id = azurerm_public_ip.pip.id
}
}

resource "azurerm_firewall_application_rule_collection" "app-rc" {


name = "${random_pet.prefix.id}-app-rc"
azure_firewall_name = azurerm_firewall.main.name
resource_group_name = azurerm_resource_group.rg.name
priority = 100
action = "Allow"

rule {
name = "testrule"

source_addresses = [
"10.0.0.0/16",
]

target_fqdns = [
"*.google.com",
]

protocol {
port = "443"
type = "Https"
}
}
}

resource "azurerm_firewall_network_rule_collection" "net-rc" {


name = "${random_pet.prefix.id}-net-rc"
azure_firewall_name = azurerm_firewall.main.name
resource_group_name = azurerm_resource_group.rg.name
priority = 100
action = "Allow"

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",
]
}
}

resource "random_pet" "prefix" {


prefix = var.prefix
length = 1
}

3. 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 "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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Import the firewall rules into a premium


policy
Now you have a standard firewall with classic rules. Next, create a premium Firewall
Policy and import the rules from the firewall.

1. On the Azure portal, select Create a resource.


2. Search for firewall policy and select it.
3. Select Create.
4. For Resource group select test-resources .
5. For Name, type prem-pol.
6. For Region, select East US.
7. For Policy tier, select Premium.
8. Select Next: DNS Settings, and continue until you reach the Rules page.
9. On the Rules page, select Import rules from an Azure Firewall.
10. Select testfirewall, and then select Import.
11. Select Review + create.
12. Select Create.
7. Edit the Terraform configuration file to
migrate the firewall
Open the main.tf file, and make the following changes:

1. Add the following 'data' section:

Terraform

data "azurerm_firewall_policy" "prem-pol" {


name = "prem-pol"
resource_group_name = azurerm_resource_group.rg.name
}

2. Modify the firewall resource:

Terraform

resource "azurerm_firewall" "fw" {


name = "testfirewall"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
firewall_policy_id = data.azurerm_firewall_policy.prem-pol.id
sku_tier = "Premium"

ip_configuration {
name = "configuration"
subnet_id = azurerm_subnet.subnet.id
public_ip_address_id = azurerm_public_ip.pip.id
}
}

3. Delete the classic rule collections:

Terraform

resource "azurerm_firewall_application_rule_collection" "app-rc" {


name = "apptestcollection"
azure_firewall_name = azurerm_firewall.fw.name
resource_group_name = azurerm_resource_group.rg.name
priority = 100
action = "Allow"

rule {
name = "testrule"

source_addresses = [
"10.0.0.0/16",
]
target_fqdns = [
"*.google.com",
]

protocol {
port = "443"
type = "Https"
}
}
}

resource "azurerm_firewall_network_rule_collection" "net-rc" {


name = "nettestcollection"
azure_firewall_name = azurerm_firewall.fw.name
resource_group_name = azurerm_resource_group.rg.name
priority = 100
action = "Allow"

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",
]
}
}

8. Apply the modified Terraform execution plan


1. terraform plan -out main.tfplan
2. terraform apply main.tfplan

9. Verify the results


1. Select the test-resources resource group.
2. Select the testfirewall resource.
3. Verify the Firewall sku is Premium.
4. Verify the firewall is using the prem-pol firewall policy.

10. 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

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 .

2. Run terraform apply to apply the execution plan.

Console
terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article provides an overview of how to use Terraform to deploy an ARM Azure
Virtual Desktop environment, not AVD Classic.

There are several pre-requisites requirements for Azure Virtual Desktop

New to Azure Virtual Desktop? Start with What is Azure Virtual Desktop?

It is assumed that an appropriate platform foundation is already setup which may or


may not be the Enterprise Scale Landing Zone platform foundation.

In this article, you learn how to:

" Use Terraform to create an Azure Virtual Desktop workspace


" Use Terraform to create an Azure Virtual Desktop host pool
" Use Terraform to create an Azure Desktop Application Group
" Associate a Workspace and a Desktop Application Group

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

# Resource group name is output when execution plan is applied.


resource "azurerm_resource_group" "sh" {
name = var.rg_name
location = var.resource_group_location
}

# Create AVD workspace


resource "azurerm_virtual_desktop_workspace" "workspace" {
name = var.workspace
resource_group_name = azurerm_resource_group.sh.name
location = azurerm_resource_group.sh.location
friendly_name = "${var.prefix} Workspace"
description = "${var.prefix} Workspace"
}

# Create AVD host pool


resource "azurerm_virtual_desktop_host_pool" "hostpool" {
resource_group_name = azurerm_resource_group.sh.name
location = azurerm_resource_group.sh.location
name = var.hostpool
friendly_name = var.hostpool
validate_environment = true
custom_rdp_properties = "audiocapturemode:i:1;audiomode:i:0;"
description = "${var.prefix} Terraform HostPool"
type = "Pooled"
maximum_sessions_allowed = 16
load_balancer_type = "DepthFirst" #[BreadthFirst DepthFirst]
}

resource "azurerm_virtual_desktop_host_pool_registration_info"
"registrationinfo" {
hostpool_id = azurerm_virtual_desktop_host_pool.hostpool.id
expiration_date = var.rfc3339
}

# Create AVD DAG


resource "azurerm_virtual_desktop_application_group" "dag" {
resource_group_name = azurerm_resource_group.sh.name
host_pool_id = azurerm_virtual_desktop_host_pool.hostpool.id
location = azurerm_resource_group.sh.location
type = "Desktop"
name = "${var.prefix}-dag"
friendly_name = "Desktop AppGroup"
description = "AVD application group"
depends_on = [azurerm_virtual_desktop_host_pool.hostpool,
azurerm_virtual_desktop_workspace.workspace]
}

# Associate Workspace and DAG


resource
"azurerm_virtual_desktop_workspace_application_group_association" "ws-
dag" {
application_group_id =
azurerm_virtual_desktop_application_group.dag.id
workspace_id = azurerm_virtual_desktop_workspace.workspace.id
}

4. Create a file named variables.tf and insert the following code:

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)"
}

5. Create a file named output.tf and insert the following code:

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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Verify the results


1. On the Azure portal, Select Azure Virtual Desktop.
2. Select Host pools and then the Name of the pool created resource.
3. Select Session hosts and then verify the session host is listed.

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Learn more about using Terraform in Azure

In this article, you learn how to:

" Use Terraform to create NIC for each session host


" Use Terraform to create VM for session host
" Join VM to domain
" Register VM with Azure Virtual Desktop
" Use variables file

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

Key points:

Use count to indicate how many resources will be created


References resources that were created when the infrastructure was built -
such as azurerm_subnet.subnet.id and
azurerm_virtual_desktop_host_pool.hostpool.name . If you changed the name

of these resources from that section, you also need to update the references
here.

3. Create a file named main.tf and insert the following code:

Terraform

locals {
registration_token =
azurerm_virtual_desktop_host_pool_registration_info.registrationinfo.to
ken
}

resource "random_string" "AVD_local_password" {


count = var.rdsh_count
length = 16
special = true
min_special = 2
override_special = "*!@#?"
}

resource "azurerm_resource_group" "rg" {


name = var.rg
location = var.resource_group_location
}
resource "azurerm_network_interface" "avd_vm_nic" {
count = var.rdsh_count
name = "${var.prefix}-${count.index + 1}-nic"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location

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
]
}

resource "azurerm_windows_virtual_machine" "avd_vm" {


count = var.rdsh_count
name = "${var.prefix}-${count.index + 1}"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
size = var.vm_size
network_interface_ids =
["${azurerm_network_interface.avd_vm_nic.*.id[count.index]}"]
provision_vm_agent = true
admin_username = var.local_admin_username
admin_password = var.local_admin_password

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
]
}

resource "azurerm_virtual_machine_extension" "domain_join" {


count = var.rdsh_count
name = "${var.prefix}-${count.index + 1}-
domainJoin"
virtual_machine_id =
azurerm_windows_virtual_machine.avd_vm.*.id[count.index]
publisher = "Microsoft.Compute"
type = "JsonADDomainExtension"
type_handler_version = "1.3"
auto_upgrade_minor_version = true

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
]
}

resource "azurerm_virtual_machine_extension" "vmext_dsc" {


count = var.rdsh_count
name = "${var.prefix}${count.index + 1}-
avd_dsc"
virtual_machine_id =
azurerm_windows_virtual_machine.avd_vm.*.id[count.index]
publisher = "Microsoft.Powershell"
type = "DSC"
type_handler_version = "2.73"
auto_upgrade_minor_version = true

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
]
}

4. Create a file named variables.tf and insert the following code:

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
}

1. Create a file named output.tf and insert the following code:

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

deploy_location = "west europe"


rg_name = "avd-resources-rg"
prefix = "avdtf"
local_admin_username = "localadm"
local_admin_password = "ChangeMe123$"
vnet_range = ["10.1.0.0/16"]
subnet_range = ["10.1.0.0/24"]
dns_servers = ["10.0.1.4", "168.63.129.16"]
aad_group_name = "AVDUsers"
domain_name = "infra.local"
domain_user_upn = "admin" # do not include domain name as this
is appended
domain_password = "ChangeMe123!"
ad_vnet = "infra-network"
ad_rg = "infra-rg"
avd_users = [
"[email protected]",
"[email protected]"
]

3. 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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Verify the results


1. On the Azure portal, Select Azure Virtual Desktop.
2. Select Host pools and then the Name of the pool created resource.
3. Select Session hosts and then verify the session host is listed.

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Use Terraform to read Microsoft Entra existing users


" Use Terraform to create Microsoft Entra group
" Role assignment for Azure Virtual Desktop

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

data "azuread_user" "aad_user" {


for_each = toset(var.avd_users)
user_principal_name = format("%s", each.key)
}

data "azurerm_role_definition" "role" { # access an existing built-in


role
name = "Desktop Virtualization User"
}

resource "azuread_group" "aad_group" {


display_name = var.aad_group_name
security_enabled = true
}

resource "azuread_group_member" "aad_group_member" {


for_each = data.azuread_user.aad_user
group_object_id = azuread_group.aad_group.id
member_object_id = each.value["id"]
}

resource "azurerm_role_assignment" "role" {


scope = azurerm_virtual_desktop_application_group.dag.id
role_definition_id = data.azurerm_role_definition.role.id
principal_id = azuread_group.aad_group.id
}

4. Create a file named variables.tf and insert the following code:

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"
}

1. Create a file named output.tf and insert the following code:

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

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.
7. Create a Terraform execution plan
Run terraform plan to create an execution plan.

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 .

8. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

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:

1. Run terraform plan and specify the destroy flag.

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article provides an overview of how to use Terraform to configure the network
settings for Azure Virtual Desktop.

In this article, you learn how to:

" Use Terraform to create a virtual network


" Use Terraform to create a subnet
" Use Terraform to create an NSG
" Peering the Azure Virtual Desktop vnet with hub vnet

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "azurerm_virtual_network" "vnet" {


name = "${var.prefix}-VNet"
address_space = var.vnet_range
dns_servers = var.dns_servers
location = var.deploy_location
resource_group_name = var.rg_name
depends_on = [azurerm_resource_group.rg]
}

resource "azurerm_subnet" "subnet" {


name = "default"
resource_group_name = var.rg_name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = var.subnet_range
depends_on = [azurerm_resource_group.rg]
}

resource "azurerm_network_security_group" "nsg" {


name = "${var.prefix}-NSG"
location = var.deploy_location
resource_group_name = var.rg_name
security_rule {
name = "HTTPS"
priority = 1001
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "443"
source_address_prefix = "*"
destination_address_prefix = "*"
}
depends_on = [azurerm_resource_group.rg]
}

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
}

data "azurerm_virtual_network" "ad_vnet_data" {


name = var.ad_vnet
resource_group_name = var.ad_rg
}

resource "azurerm_virtual_network_peering" "peer1" {


name = "peer_avdspoke_ad"
resource_group_name = var.rg_name
virtual_network_name = azurerm_virtual_network.vnet.name
remote_virtual_network_id =
data.azurerm_virtual_network.ad_vnet_data.id
}
resource "azurerm_virtual_network_peering" "peer2" {
name = "peer_ad_avdspoke"
resource_group_name = var.ad_rg
virtual_network_name = var.ad_vnet
remote_virtual_network_id = azurerm_virtual_network.vnet.id
}

4. Create a file named variables.tf and insert the following code:

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)"
}

1. Create a file named output.tf and insert the following code:

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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .
5. Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. Verify the results


1. On the Azure portal, Select Azure Virtual Desktop.
2. Select Host pools and then the Name of the pool created resource.
3. Select Session hosts and then verify the session host is listed.

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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

In this article, you learn how to:

" Use Terraform to Azure File Storage account


" Use Terraform to configure File Share
" Use Terraform to configure RBAC permission on Azure File Storage

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

## Create a Resource Group for Storage


resource "azurerm_resource_group" "rg_storage" {
location = var.deploy_location
name = var.rg_stor
}

# generate a random string (consisting of four characters)


#
https://registry.terraform.io/providers/hashicorp/random/latest/docs/re
sources/string
resource "random_string" "random" {
length = 4
upper = false
special = false
}

## Azure Storage Accounts requires a globally unique names


## https://docs.microsoft.com/en-us/azure/storage/common/storage-
account-overview
## Create a File Storage Account
resource "azurerm_storage_account" "storage" {
name = "stor${random_string.random.id}"
resource_group_name = azurerm_resource_group.rg_storage.name
location = azurerm_resource_group.rg_storage.location
account_tier = "Premium"
account_replication_type = "LRS"
account_kind = "FileStorage"
}

resource "azurerm_storage_share" "FSShare" {


name = "fslogix"
storage_account_name = azurerm_storage_account.storage.name
depends_on = [azurerm_storage_account.storage]
}

## Azure built-in roles


## https://docs.microsoft.com/en-us/azure/role-based-access-
control/built-in-roles
data "azurerm_role_definition" "storage_role" {
name = "Storage File Data SMB Share Contributor"
}

resource "azurerm_role_assignment" "af_role" {


scope = azurerm_storage_account.storage.id
role_definition_id = data.azurerm_role_definition.storage_role.id
principal_id = azuread_group.aad_group.id
}

4. Create a file named variables.tf and insert the following code:

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"
}

2. Create a file named output.tf and insert the following code:

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

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.

4. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

5. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

6. 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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Learn more about using Terraform in Azure
Configure Azure Compute Gallery with
Terraform
Article • 10/26/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

This article shows you how to configure Azure Compute Gallery.

In this article, you learn how to:

" Use Terraform to configure Azure Compute Gallery (formerly Shared Image Gallery)

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "azurerm_resource_group" "sigrg" {


location = var.deploy_location
name = var.rg_shared_name
}

# generate a random string (consisting of four characters)


#
https://registry.terraform.io/providers/hashicorp/random/latest/docs/re
sources/string
resource "random_string" "rando" {
length = 4
upper = false
special = false
}

# Creates Shared Image Gallery


#
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/r
esources/shared_image_gallery
resource "azurerm_shared_image_gallery" "sig" {
name = "sig${random_string.random.id}"
resource_group_name = azurerm_resource_group.sigrg.name
location = azurerm_resource_group.sigrg.location
description = "Shared images"

tags = {
Environment = "Demo"
Tech = "Terraform"
}
}

#Creates image definition


#
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/r
esources/shared_image
resource "azurerm_shared_image" "example" {
name = "avd-image"
gallery_name = azurerm_shared_image_gallery.sig.name
resource_group_name = azurerm_resource_group.sigrg.name
location = azurerm_resource_group.sigrg.location
os_type = "Windows"

identifier {
publisher = "MicrosoftWindowsDesktop"
offer = "office-365"
sku = "20h2-evd-o365pp"
}
}

4. Create a file named variables.tf and insert the following code:

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"
}

1. Create a file named output.tf and insert the following code:

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
}

3. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

4. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

5. 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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Use Terraform to configure Azure Log Analytics Workspace

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

2. Implement the Terraform code


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 = "~>2.0"
}
azuread = {
source = "hashicorp/azuread"
}
}
}

provider "azurerm" {
features {}
}

3. Create a file named main.tf and insert the following code:

Terraform

resource "azurerm_resource_group" "log" {


name = var.rg_shared_name
location = var.deploy_location
}

# Creates Log Anaylytics Workspace


#
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/r
esources/log_analytics_workspace
resource "azurerm_log_analytics_workspace" "law" {
name = "log${random_string.random.id}"
location = azurerm_resource_group.log.location
resource_group_name = azurerm_resource_group.log.name
sku = "PerGB2018"
retention_in_days = 30
}

4. Create a file named variables.tf and insert the following code:

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"
}

1. Create a file named output.tf and insert the following code:

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

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.

5. Create a Terraform execution plan


Run terraform plan to create an execution plan.

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 .

6. Apply a Terraform execution plan


Run terraform apply to apply the execution plan to your cloud infrastructure.

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.

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

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 .

2. Run terraform apply to apply the execution plan.

Console

terraform apply main.destroy.tfplan

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

Next steps
Learn more about using Terraform in Azure
Provision infrastructure with Azure
deployment slots using Terraform
Article • 10/26/2023

Terraform enables the definition, preview, and deployment of cloud infrastructure.


Using Terraform, you create configuration files using HCL syntax . The HCL syntax
allows you to specify the cloud provider - such as Azure - and the elements that make
up your cloud infrastructure. After you create your configuration files, you create an
execution plan that allows you to preview your infrastructure changes before they're
deployed. Once you verify the changes, you apply the execution plan to deploy the
infrastructure.

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.

In this article, you learn how to:

" Create an App Service


" Create an App Service slot
" Swap in and out of the example deployment slots

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

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.

3. Change directories to the clouddrive directory.

Bash

cd clouddrive

4. Create a directory named deploy .

Bash

mkdir deploy

5. Create a directory named swap .

Bash

mkdir swap

6. Use the ls bash command to verify that you successfully created both directories.

7. Change directories to the deploy directory.


Bash

cd deploy

8. In Cloud Shell, create a file named deploy.tf .

Bash

code deploy.tf

9. Insert the following code into the editor:

HashiCorp Configuration Language

# Configure the Azure provider


provider "azurerm" {
# The "feature" block is required for AzureRM provider 2.x.
# If you're using version 1.x, the "features" block is not allowed.
version = "~>2.0"
features {}
}

resource "azurerm_resource_group" "slotDemo" {


name = "slotDemoResourceGroup"
location = "westus2"
}

resource "azurerm_app_service_plan" "slotDemo" {


name = "slotAppServicePlan"
location = azurerm_resource_group.slotDemo.location
resource_group_name = azurerm_resource_group.slotDemo.name
sku {
tier = "Standard"
size = "S1"
}
}

resource "azurerm_app_service" "slotDemo" {


name = "slotAppService"
location = azurerm_resource_group.slotDemo.location
resource_group_name = azurerm_resource_group.slotDemo.name
app_service_plan_id = azurerm_app_service_plan.slotDemo.id
}

resource "azurerm_app_service_slot" "slotDemo" {


name = "slotAppServiceSlotOne"
location = azurerm_resource_group.slotDemo.location
resource_group_name = azurerm_resource_group.slotDemo.name
app_service_plan_id = azurerm_app_service_plan.slotDemo.id
app_service_name = azurerm_app_service.slotDemo.name
}

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

12. Initialize Terraform.

Bash

terraform init

13. Create the Terraform plan.

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

15. Close the Cloud Shell window.

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.

3. Fork the test project


Before you can test the creation and swapping in and out of the deployment slots, you
need to fork the test project from GitHub.

1. Browse to the awesome-terraform repo on GitHub .

2. Fork the awesome-terraform repo.

3. Follow any prompts to fork to your environment.

4. Deploy from GitHub to your deployment


slots
After you fork the test project repo, configure the deployment slots via the following
steps:

1. On the main menu of the Azure portal, select Resource groups.

2. Select slotDemoResourceGroup.

3. Select slotAppService.

4. Select Deployment options.


5. On the Deployment option tab, select Choose Source, and then select GitHub.
6. After Azure makes the connection and displays all the options, select
Authorization.

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.

9. Select Choose your organization and select your organization.

10. Select Choose project.

11. On the Choose project tab, select the awesome-terraform project.


12. Select Choose branch.

13. On the Choose branch tab, select master.


14. On the Deployment option tab, select OK.

At this point, you've deployed the production slot. To deploy the staging slot, do the
previous steps with the following modifications:

In step 3, select the slotAppServiceSlotOne resource.

In step 13, select the working branch.


5. Test the app deployments
In the previous sections, you set up two slots--slotAppService and
slotAppServiceSlotOne--to deploy from different branches in GitHub. Let's preview the
web apps to validate that they were successfully deployed.

1. On the main menu of the Azure portal, select Resource groups.

2. Select slotDemoResourceGroup.

3. Select either slotAppService or slotAppServiceSlotOne.

4. On the overview page, select URL.


5. Depending on the selected app, you see the following results:

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.

6. Swap the two deployment slots


To test swapping the two deployment slots, do the following steps:

1. Switch to the browser tab that's running slotAppService (the app with the blue
page).

2. Return to the Azure portal on a separate tab.

3. Open Cloud Shell.

4. Change directories to the clouddrive/swap directory.

Bash

cd clouddrive/swap

5. In Cloud Shell, create a file named swap.tf .

Bash

code swap.tf
6. Insert the following code into the editor:

HashiCorp Configuration Language

# Configure the Azure provider


provider "azurerm" {
# The "feature" block is required for AzureRM provider 2.x.
# If you're using version 1.x, the "features" block is not allowed.
version = "~>2.0"
features {}
}

# Swap the production slot and the staging slot


resource "azurerm_app_service_active_slot" "slotDemoActiveSlot" {
resource_group_name = "slotDemoResourceGroup"
app_service_name = "slotAppService"
app_service_slot_name = "slotappServiceSlotOne"
}

7. Save the file (<Ctrl>S) and exit the editor (<Ctrl>Q).

8. Initialize Terraform.

Bash

terraform init

9. Create the Terraform plan.

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

After the app is swapped, you see the original configuration.

Troubleshoot Terraform on Azure


Troubleshoot common problems when using Terraform on Azure

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:

Versions 3.0.0 - current


Versions 2.0.0 - 2.99.0
Versions 1.0.0 - 1.44.0
Versions 0.1.0 - 0.3.3

Versions 3.0.0 - Current

3.109.0 (June 20, 2024)


FEATURES:

New Data Source: azurerm_automation_runbook (#26359 )


New Resource:
azurerm_data_protection_backup_instance_postgresql_flexible_server (#26249 )
New Resource: azurerm_email_communication_service_domain (#26179 )
New Resource: azurerm_system_center_virtual_machine_manager_cloud (#25429 )
New Resource:
azurerm_system_center_virtual_machine_manager_virtual_machine_template

(#25449 )
New Resource: azurerm_system_center_virtual_machine_manager_virtual_network
(#25451 )

ENHANCEMENTS:

Data Source: azurerm_hdinsight_cluster - export the cluster_id attribute


(#26228 )
azurerm_cosmosdb_sql_container - support for the partition_key_kind and

partition_key_paths properties (#26372 )


azurerm_data_protection_backup_instance_blob_storage - support for the
storage_account_container_names property (#26232 )
azurerm_virtual_network_peering - support for the
peer_complete_virtual_networks_enabled , only_ipv6_peering_enabled ,

local_subnet_names , and remote_subnet_names properties (#26229 )


azurerm_virtual_desktop_host_pool - changing the preferred_app_group_type

property no longer creates a new resource (#26333 )


azurerm_maps_account - support for the location , identity , cors and data_store

properties (#26397 )

BUG FIXES:

azurerm_automation_job_schedule - updates azurerm_automation_job_schedule to

use a composite resource id and allows azurerm_automation_runbook to be updated


without causing azurerm_automation_job_schedule to recreate (#22164 )
azurerm_databricks_workspace - correctly allow disabling the default firewall

(#26339 )
azurerm_virtual_hub_* - spliting create and update so lifecycle ignore changes

works correctly (#26310 )

DEPRECATIONS:

Data Source: azurerm_mariadb_server - deprecated since the service is retiring. Use


azurerm_mysql_flexible_server instead (#26354 )
azurerm_mariadb_configuration - deprecated since the service is retiring. Use

azurerm_mysql_flexible_server_configuration instead (#26354 )


azurerm_mariadb_database - deprecated since the service is retiring. Use
azurerm_mysql_flexible_database instead (#26354 )
azurerm_mariadb_firewall_rule - deprecated since the service is retiring. Use
azurerm_mysql_flexible_server_firewall_rule instead (#26354 )
azurerm_mariadb_server - deprecated since the service is retiring. Use
azurerm_mysql_flexible_server instead (#26354 )
azurerm_mariadb_virtual_network_rule - deprecated since the service is retiring

(#26354 )

3.108.0 (June 13, 2024)


FEATURES:

New Data Source: azurerm_role_management_policy (#25900 )


New Resource: azurerm_role_management_policy (#25900 )

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

when running Windows (#26308 )


azurerm_kubernetes_cluster - updating the network_profile.network_policy

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

of this type per subnet (#26006 )

BUG FIXES:

azurerm_express_route_circuit_peering , azurerm_express_route_circuit ,

azurerm_express_route_gateway , azurerm_express_route_port - split create and

update (#26237 )
azurerm_lb_backend_address_pool_address - when using this resource, values are

no longer reset on azurerm_lb_backend_address_pool (#26264 )


azurerm_route_filter - spliting create and update so lifecycle ignore changes

works correctly (#26266 )


azurerm_route_server - spliting create and update so lifecycle ignore changes

works correctly (#26266 )


azurerm_synapse_workspace - updates the client used in all operations of

azurerm_synapse_workspace_sql_aad_admin to prevent this resource from modifying

the same resource as azurerm_synapse_workspace_aad_admin (#26317 )


azurerm_virtual_network - correctly parse network securty group IDs (#26283 )

DEPRECATIONS:

Data Source: azurerm_network_interface - the enable_ip_forwarding and


enable_accelerated_networking properties are deprecated and superseded by the
ip_forwarding_enabled and accelerated_networking_enabled properties

(#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

superseded by the network_data_plane property (#26251 )


azurerm_network_interface - the enable_ip_forwarding and
enable_accelerated_networking properties have been deprecated and superseded

by the ip_forwarding_enabled and accelerated_networking_enabled properties


(#26293 )
azurerm_synapse_workspace - the aad_admin and sql_aad_admin blocks have been

deprecated and superseded by the azurerm_synapse_workspace_aad_admin and


azurerm_synapse_workspace_sql_aad_admin resources (#26317 )

3.107.0 (June 06, 2024)


FEATURES:

New Resource:
azurerm_data_protection_backup_policy_postgresql_flexible_server (#26024 )

ENHANCEMENTS:

dependencies: updating to v0.20240604.1114748 of github.com/hashicorp/go-


azure-sdk (#26216 )
advisor : update API version to 2023-01-01 (#26205 )
keyvault : handling the Resources API returning Key Vaults that have been deleted

when populating the cache (#26199 )


machinelearning : update API version to 2024-04-01 (#26168 )
network/privatelinkservices - update to use hashicorp/go-azure-sdk (#26212 )
network/serviceendpointpolicies - update to use hashicorp/go-azure-sdk

(#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

properties in the secret block (#25969 )


azurerm_kubernetes_cluster - support forthe dns_zone_ids popperty in the

web_app_routing block (#26117 )


azurerm_notification_hub_authorization_rule - support for the

primary_connection_string and secondary_connection_string properties

(#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

when setting the value_from_key_vault property (#26150 )


azurerm_storage_sync_server_endpoint - improve pooling to work around api

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

to fix lifecycle - ignore (#26207 )


azurerm_vpn_site - split create and update function to fix lifecycle - ignore

changes (#26163 )

DEPRECATIONS:

azurerm_kubernetes_cluster - the property dns_zone_id is superseded by the

property dns_zone_ids in the web_app_routing block (#26117 )


azurerm_nginx_deployment - the block configuration is deprecated and

superseded by the resource azurerm_nginx_configuration (#25773 )

3.106.1 (May 31, 2024)


BUG FIXES:

Data Source: azurerm_kubernetes_cluster - fix a crash when reading/setting


upgrade_settings (#26173 )

3.106.0 (May 31, 2024)


UPGRADE NOTES:

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:

New Data Source: azurerm_arc_resource_bridge_appliance (#25731 )


New Data Source: azurerm_elastic_san_volume_group (#26111 )
New Data Source: azurerm_storage_queue (#26087 )
New Data Source: azurerm_storage_table (#26126 )
New Resource: azurerm_container_registry_cache_rule (#26034 )
New Resource: azurerm_virtual_machine_implicit_data_disk_from_source
(#25537 )

ENHANCEMENTS:

Data Source: azurerm_kubernetes_cluster - add support for the


drain_timeout_in_minutes and node_soak_duration_in_minutes properties in the
upgrade_settings block (#26137 )
dependencies: updating to v0.20240529.1155048 of github.com/hashicorp/go-
azure-sdk (#26148 )
containerapps : update API version to 2024-03-01 (#25993 )
expressroute : update to use hashicorp/go-azure-sdk (#26066 )
keyvault : populating the cache using both the Key Vault List and Resources API to

workaround incomplete/stale data being returned (#26070 )


servicenetworking : updating to API Version 2023-11-01 (#26148 )
virtualnetworkpeerings : update to use hashicorp/go-azure-sdk (#26065 )
azurerm_automation_powershell72_module - support for the tags property

(#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

node_soak_duration_in_minutes properties in the upgrade_settings block

(#26137 )
azurerm_kubernetes_cluster_node_pool - support for the drain_timeout_in_minutes

and node_soak_duration_in_minutes properties in the upgrade_settings block


(#26137 )
azurerm_linux_virtual_machine - the hibernation_enabled property can now be

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:

Data Source: azurerm_system_center_virtual_machine_manager_inventory_items -


normalise the resource ID for Intentory Items (#25955 )
azurerm_app_configuration_feature - update polling interval to tolerate eventual

consistency of the API (#26025 )


azurerm_app_configuration_key - update polling interval to tolerate eventual

consistency of the API (#26025 )


azurerm_eventhub_namespace_customer_managed_key - validating that the User

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

health_check_eviction_time_in_min and WEBSITE_HEALTHCHECK_MAXPINGFAILURES

(#26107 )
azurerm_linux_web_app - fix update handling of

health_check_eviction_time_in_min and WEBSITE_HEALTHCHECK_MAXPINGFAILURES

(#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

multiple policy assignments (#26085 )


azurerm_redis_access_cache_policy - add locks to stabilize creation of multiple

policy assignments (#26085 )


azurerm_windows_function_app - fix update handling of
health_check_eviction_time_in_min and WEBSITE_HEALTHCHECK_MAXPINGFAILURES

(#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

health_check_eviction_time_in_min and WEBSITE_HEALTHCHECK_MAXPINGFAILURES

(#26107 )
azurerm_windows_web_app_slot - fix update handling of

health_check_eviction_time_in_min and WEBSITE_HEALTHCHECK_MAXPINGFAILURES

(#26107 )

3.105.0 (May 24, 2024)


BREAKING CHANGE:

azurerm_kubernetes_cluster - the properties

workload_autoscaler_profile.vertical_pod_autoscaler_update_mode and
workload_autoscaler_profile.vertical_pod_autoscaler_controlled_values are no

longer populated since they're not exported in API version 2023-09-02-preview


(#25663 )

FEATURES:

New Resource: azurerm_api_management_policy_fragment (#24968 )

ENHANCEMENTS:

dependencies: updating to v0.20240522.1080424 of github.com/hashicorp/go-


azure-sdk (#26069 )
containerservice : updating to use API Version 2023-09-02-preview (#25663 )
azurerm_application_insights_standard_web_test - http_verb can now be set to
HEAD and OPTIONS (#26077 )
azurerm_cdn_frontdoor_rule - updating the validation for match_values within the
uri_path_condition block to support a forward-slash (#26017 )
azurerm_linux_web_app - normalising the value for virtual_network_subnet_id

(#25885 )
azurerm_machine_learning_compute_cluster - add validation for name (#26060 )
azurerm_machine_learning_compute_cluster - improve validation to allow an empty

subnet_resource_id when the Workspace is using a managed Virtual Network

(#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:

azurerm_container_app_environment_custom_domain : parsing the Log Analytics

Workspace ID insensitively to workaround the API returning this value


inconsistently (#26074 )
azurerm_container_app_job - updating the validation for the name field (#26049 )
azurerm_container_app_job - updating the validation for the name field within the
custom_scale_rule block (#26049 )
azurerm_container_app_job - updating the validation for the name field within the
rules block (#26049 )
azurerm_linux_function_app_slot - fixed panic when planning from a version older

than 3.88.0 (#25838 )


azurerm_pim_active_role_assignment - fix a persistent diff when ticket is not

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

updated to include fewer items (#26083 )


azurerm_windows_function_app_slot - set Server Farm ID in payload when using a

Virtual Network Subnet for the slot (#25634 )


azurerm_windows_web_app_slot - set Server Farm ID in payload when using a Virtual

Network Subnet for the slot (#25634 )

3.104.2 (May 20, 2024)


NOTE: This release is a re-release of v3.104.1 to include missing changes, refer to the
changelog entries for v3.104.1 .
3.104.1 (May 20, 2024)
BUG FIXES:

azurerm_pim_active_role_assignment - fix a regression where roles assignments

could not be created with no expiration (#26029 )


azurerm_pim_eligible_role_assignment - fix a regression where roles assignments

could not be created with no expiration (#26029 )

3.104.0 (May 16, 2024)


FEATURES:

New Data Source: azurerm_elastic_san (#25719 )

ENHANCEMENTS:

New Resource - azurerm_key_vault_managed_hardware_security_module_key


(#25935 )
Data Source - azurerm_kubernetes_service_version - support for the
default_version property (#25953 )
network/applicationgateways - update to use hashicorp/go-azure-sdk (#25844 )
dataprotection - update API version to 2024-04-01 (#25882 )
databasemigration - update API version to 2021-06-30 (#25997 )
network/ips - update to use hashicorp/go-azure-sdk (#25905 )
network/localnetworkgateway - update to use hashicorp/go-azure-sdk (#25905 )
network/natgateway - update to use hashicorp/go-azure-sdk (#25905 )
network/networksecuritygroup - update to use hashicorp/go-azure-sdk (#25971 )
network/publicips - update to use hashicorp/go-azure-sdk (#25971 )
network/virtualwan - update to use hashicorp/go-azure-sdk (#25971 )
network/vpn - update to use hashicorp/go-azure-sdk (#25971 )
azurerm_databricks_workspace - support for the default_storage_firewall_enabled

property (#25919 )
azurerm_key_vault - allow previously existing key vaults to continue to manage the

contact field prior to the v3.93.0 conditional polling change (#25777 )


azurerm_linux_function_app - support for the PowerShell 7.4 (#25980 )
azurerm_log_analytics_cluster - support for the value UserAssigned in the
identity.type property (#25940 )
azurerm_pim_active_role_assignment - remove hard dependency on the
roleAssignmentScheduleRequests API, so that role assignments aren't
unmanageable over time (#25956 )
azurerm_pim_eligible_role_assignment - remove hard dependency on the

roleEligibilityScheduleRequests API, so that role assignments aren't

unmanageable over time (#25956 )


azurerm_windows_function_app - support for the PowerShell 7.4 (#25980 )

BUG FIXES:

azurerm_container_app_job - Allow event_trigger_config.scale.min_executions to

be 0 (#25931 )
azurerm_container_app_job - update validation to allow the replica_retry_limit

property to be set to 0 (#25984 )


azurerm_data_factory_trigger_custom_event - one of subject_begins_with and
subject_ends_with no longer need to be set (#25932 )
azurerm_kubernetes_cluster_node_pool - prevent race condition by checking the

virtual network status when creating a node pool with a subnet ID (#25888 )
azurerm_postgresql_flexible_server - fix for default storage_tier value when

storage_mb field is changed (#25947 )


azurerm_pim_active_role_assignment - resolves several potential crashes

(#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

property is no longer ForceNew (#25688 )


azurerm_storage_sync_server_endpoint - preventing a crashed due to
initial_upload_policy (#25968 )

3.103.1 (May 10, 2024)


BUG FIXES

loadtest - fixing an issue where the SDK Clients weren't registered (#25920 )

3.103.0 (May 09, 2024)


FEATURES:

New Resource: azurerm_container_app_job (#23871 )


New Resource: azurerm_container_app_environment_custom_domain (#24346 )
New Resource: azurerm_data_factory_credential_service_principal (#25805 )
New Resource: azurerm_network_manager_connectivity_configuration (#25746 )
New Resource: azurerm_maintenance_assignment_dynamic_scope (#25467 )
New Resource: azurerm_virtual_machine_gallery_application_assignment
(#22945 )
New Resource: azurerm_virtual_machine_automanage_configuration_assignment
(#25480 )

ENHANCEMENTS:

provider - support for the recover_soft_deleted_backup_protected_vm feature


(#24157 )
dependencies: updating github.com/hashicorp/go-azure-helpers to v0.69.0
(#25903 )
loganalytics - update cluster resource to api version 2022-01-01 (#25686 )
azurerm_bastion_host - support for the kerberos_enabled property (#25823 )
azurerm_container_app - secrets can now be removed (#25743 )
azurerm_container_app_environment - support for the

custom_domain_verification_id property (#24346 )


azurerm_linux_virtual_machine - support for the more capability

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

maximum_surge_instances_enabled property for vmss rolling upgrades (#24914 )


azurerm_storage_account - support for the permanent_delete_enabled property

within retention policies (#25778 )

BUG FIXES:

azurerm_kubernetes_cluster - erase load_balancer_profile when changing

network_profile.outbound_type from loadBalancer to another outbound type

(#25530 )
azurerm_log_analytics_saved_search - the function_parameters property now

repsects the order of elements (#25869 )


azurerm_linux_web_app - fix slow_request with path issue in auto_heal by adding

support for slow_request_with_path block (#20049 )


azurerm_linux_web_app_slot - fix slow_request with path issue in auto_heal by

adding support for slow_request_with_path block (#20049 )


azurerm_monitor_private_link_scoped_service - normalize case of the

linked_resource_id property during reads (#25787 )


azurerm_role_assignment - add addtional retry logic to assist with cross-tenant use

(#25853 )
azurerm_web_pubsub_network_acl - fixing a crash when

networkACL.PublicNetwork.Deny was nil (#25886 )


azurerm_windows_web_app - fix slow_request with path issue in auto_heal by

adding support for slow_request_with_path block (#20049 )


azurerm_windows_web_app_slot - fix slow_request with path issue in auto_heal by

adding support for slow_request_with_path block (#20049 )

DEPRECATIONS:

azurerm_subnet - the private_endpoint_network_policies_enabled property is

deprecated in favour of the private_endpoint_network_policies property


(#25779 )

3.102.0 (May 02, 2024)


FEATURES:

New Resource: azurerm_storage_sync_server_endpoint (#25831 )


New Resource: azurerm_storage_container_immutability_policy (#25804 )

ENHANCEMENTS:

azurerm_load_test - add support for encryption (#25759 )


azurerm_network_connection_monitor - update validation for target_resource_type

and target_resource_id (#25745 )


azurerm_mssql_managed_database - support for a Restorable Database ID to be used

as the source_database_id for point in time restore (#25568 )


azurerm_storage_account - support for the managed_hsm_key_id property

(#25088 )
azurerm_storage_account_customer_managed_key - support for the

managed_hsm_key_id property (#25088 )


BUG FIXES:

azurerm_linux_function_app - now sets docker registry url in linux_fx_version by

default (#23911 )
azurerm_resource_group - work around sporadic eventual consistency errors

(#25758 )

DEPRECATIONS:

azurerm_key_vault_managed_hardware_security_module_role_assignment - the

vault_base_url property is deprecated in favour of the managed_hsm_id property

(#25601 )

3.101.0 (April 25, 2024)


ENHANCEMENTS:

dependencies: updating to v0.20240424.1114424 of github.com/hashicorp/go-


azure-sdk (#25749 )
dependencies: updating to v0.27.0 of github.com/tombuildsstuff/giovanni
(#25702 )
dependencies: updating golang.org/x/net to 0.23.0
azurerm_cognitive_account - the kind property now supports

ConversationalLanguageUnderstanding (#25735 )
azurerm_container_app_custom_domain - support the ability to use Azure Managed

Certificates (#25356 )

BUG FIXES:

Data Source: azurerm_application_insights - set correct AppID in data source


(#25687 )
azurerm_virtual_network - suppress diff in ordering for address_space due to

inconsistent API response (#23793 )


azurerm_storage_data_lake_gen2_filesystem - add context deadline for import

(#25712 )
azurerm_virtual_network_gateway - preserve existing nat_rules on updates

(#25690 )

3.100.0 (April 18, 2024)


ENHANCEMENTS:
dependencies: updating hashicorp/go-azure-sdk to v0.20240417.1084633
(#25659 )
compute - update Virtual Machine and Virtual Machine Scale Set resources and

data sources to use hashicorp/go-azure-sdk (#25533 )


machine_learning - Add new machine_learning block that supports

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

property now accepts an IP address as valid input (#25609 )


azurerm_container_group - the identity block can now be updated (#25543 )
azurerm_express_route_connection - support for the
private_link_fast_path_enabled property (#25596 )
azurerm_hdinsight_hadoop_cluster - support for the private_link_configuration

block (#25629 )
azurerm_hdinsight_hbase_cluster - support for the private_link_configuration

block (#25629 )
azurerm_hdinsight_interactive_query_cluster - support for the

private_link_configuration block (#25629 )


azurerm_hdinsight_kafka_cluster - support for the private_link_configuration
block (#25629 )
azurerm_hdinsight_spark_cluster - support for the private_link_configuration

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

private_link_fast_path_enabled property (#25650 )


azurerm_windows_web_app - support for the handler_mapping block (#25631 )
azurerm_windows_web_app_slot - support for the handler_mapping block (#25631 )

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

of Application Insights resources (#25628 )


azurerm_function_app_hybrid_connection - can now use relay resources created in

a different resource group (#25541 )


azurerm_kubernetes_cluster_node_pool - prevent plan diff when the

windows_profile.outbound_nat_enabled property is unset (#25644 )


azurerm_machine_learning_compute_cluster - fix location to point to parent

resource for computes (#25643 )


azurerm_machine_learning_compute_instance - fix location to point to parent

resource for computes (#25643 )


azurerm_storage_account - check replication type when evaluating support level

for shares and queues for V1 storage accounts (#25581 )


azurerm_storage_account - added a sanity check for dns_endpoint_type and

blob_properties.restore_policy (#25450 )
azurerm_web_app_hybrid_connection - can now use relay resources created in a

different resource group (#25541 )


azurerm_windows_web_app - prevent removal of
site_config.application_stack.node_version when app_settings are updated

(#25488 )
azurerm_windows_web_app_slot - prevent removal of

site_config.application_stack.node_version when app_settings are updated

(#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

deprecated in v4.0 of the provider (#25643 )


azurerm_kubernetes_cluster - the following properties have been deprecated since

the API no longer supports cluster creation with legacy Azure Entra integration:
client_app_id , server_app_id , server_app_secret and managed (#25200 )

3.99.0 (April 11, 2024)


BREAKING CHANGE:

azurerm_linux_web_app - site_config.0.application_stack.0.java_version must

be specified with java_server and java_server_version (#25553 )

ENHANCEMENTS:

dependencies: updating to v0.20240411.1104331 of github.com/hashicorp/go-


azure-sdk/resourcemanager and github.com/hashicorp/go-azure-sdk/sdk

(#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

update properties to Computed & Optional (#25552 )


azurerm_key_vault_certificate_contacts - in v4.0 make the contact property

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

supports Oracle.Database/networkAttachments (#25571 )


azurerm_web_pubsub - support setting the sku property to Premium_P2 (#25578 )

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

into the property app_id (#25520 )


azurerm_application_insights_api_key - add a state migration to re-case static

segments of the resource ID (#25567 )


azurerm_container_app_environment_certificate - the subject_name attribute is

now correctly populated (#25516 )


azurerm_function_app_slot - now taints the resource when partially created

(#24520 )
azurerm_linux_function_app - now taints the resource when partially created

(#24520 )
azurerm_managed_disk - filtering the Resource SKUs response to reduce the

memory overhead, when determining whether a Managed Disk can be online


resized or not (#25549 )
azurerm_monitor_alert_prometheus_rule_group - the severity property is now set

correctly when 0 (#25408 )


azurerm_monitor_smart_detector_alert_rule - normalising the value for id within

the action_group block (#25559 )


azurerm_redis_cache_access_policy_assignment - the object_id_alias property

now allows usernames (#25523 )


azurerm_windows_function_app - doesn't taint the resource when partially created

(#24520 )
azurerm_windows_function_app - doesn't taint the resource when partially created

(#24520 )

DEPRECATIONS:

azurerm_cosmosdb_account - the connection_strings property is superseded by the


primary and secondary connection strings for sql, mongodb and readonly
(#25510 )
azurerm_cosmosdb_account - the enable_free_tier property is superseded by

free_tier_enabled (#25510 )
azurerm_cosmosdb_account - the enable_multiple_write_locations property is

superseded by multiple_write_locations_enabled (#25510 )


azurerm_cosmosdb_account - the enable_automatic_failover property is superseded

by automatic_failover_enabled (#25510 )

3.98.0 (April 04, 2024)


FEATURES:

New Resource: azurerm_static_web_app_function_app_registration (#25331 )


New Resource: azurerm_system_center_virtual_machine_manager_inventory_items
(#25110 )
New Resource: azurerm_workloads_sap_discovery_virtual_instance (#24342 )
New Resource: azurerm_redis_cache_policy (#25477 )
New Resource: azurerm_redis_cache_policy_assignment (#25477 )

ENHANCEMENTS:

dependencies: updating to v0.20240402.1085733 of github.com/hashicorp/go-


azure-sdk (#25482 )
dependencies: updating to v0.67.0 of github.com/hashicorp/go-azure-helpers
(#25446 )
dependencies: updating to v0.25.4 of github.com/tombuildsstuff/giovanni
(#25404 )
alertsmanagement - updating remaining resources to use hashicorp/go-azure-sdk

(#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-

sdk rather than Azure/go-autorest (#25416 )


maintenance - updating to API Version 2023-04-01 (#25388 )
recovery_services - Add recovery_service block to the provider that supports

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

the secret block (#24773 )


azurerm_databricks_workspace - expose managed_services_cmk_key_vault_id and
managed_disk_cmk_key_vault_id and key_vault_id to support cross subscription

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

nested item id (#25323 )


azurerm_mssql_database - add support for secondary_type (#25360 )
azurerm_monitor_scheduled_query_rules_alert_v2 - support for the identity block

(#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

kerberos_5p_read_write_enabled properties (#25385 )


azurerm_recovery_services_vault - upgrading to version 2024-01-01 (#25325 )
azurerm_stack_hci_cluster - the client_id property is now optional (#25407 )
azurerm_storage_encryption_scope - refactoring to use hashicorp/go-azure-sdk

rather than Azure/azure-sdk-for-go (#25437 )


azurerm_mssql_elasticpool - the maintenance_configuration_name property now

supports values SQL_SouthAfricaNorth_DB_1 , SQL_SouthAfricaNorth_DB_2 ,


SQL_WestUS3_DB_1 and SQL_WestUS3_DB_2 (#25500 )
azurerm_lighthouse_assignment - updating API Version from 2019-06-01 to 2022-
10-01 (#25473 )

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

and template_content now force output_content to be updated in the plan


(#25403 )
azurerm_storage_blob - fix a potential crash when the endpoint is unreachable

(#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

endpoint is unreachable (#25404 )


azurerm_storage_data_lake_gen2_filesystem_path - fix a potential crash when the

endpoint is unreachable (#25404 )


azurerm_storage_queue - fix a potential crash when the endpoint is unreachable

(#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

files in subdirectories (#25404 )


azurerm_web_app_hybrid_connection - fix an issue during creation when

send_key_name is specified (#25379 )


azurerm_windows_web_app - prevent a panic during resource upgrade (#25509 )

3.97.1 (March 22, 2024)


ENHANCEMENTS:

azurerm_nginx_deployment - support for the configuration block (#24276 )

BUG FIXES:

azurerm_data_factory_integration_runtime_self_hosted - ensure that

autorizationh keys are exported (#25246 )


azurerm_storage_account - defaulting the value for dns_endpoint_type to Standard

when it's not returned from the Azure API (#25367 )

3.97.0 (March 21, 2024)


BREAKING CHANGES:
azurerm_linux_function_app - app_settings["WEBSITE_RUN_FROM_PACKAGE"] must be

added to ignore_changes for deployments where an external tool modifies the


WEBSITE_RUN_FROM_PACKAGE property in the app_settings block. (#24848 )
azurerm_linux_function_app_slot - app_settings["WEBSITE_RUN_FROM_PACKAGE"]

must be added to ignore_changes for deployments where an external tool


modifies the WEBSITE_RUN_FROM_PACKAGE property in the app_settings block.
(#24848 )

FEATURES:

New Resource: azurerm_elastic_san_volume (#24802 )

ENHANCEMENTS:

dependencies: updating to v0.25.3 of github.com/tombuildsstuff/giovanni


(#25362 )
dependencies: updating to v0.20240321.1145953 of github.com/hashicorp/go-
azure-sdk (#25332 )
dependencies: updating to v0.25.2 of github.com/tombuildsstuff/giovanni
(#25305 )
azurestackhci : updating to API Version 2024-01-01 (#25279 )
monitor/scheduledqueryrules : updating to API version 2023-03-15-preview

(#25350 )
cosmosdb : updating to use the transport layer from hashicorp/go-azure-sdk rather

than Azure/go-autorest (#25166 )


Data Source azurerm_stack_hci_cluster : refactoring the association to use
hashicorp/go-azure-sdk (#25293 )
azurerm_app_configuration - support for Environments other than Azure Public

(#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

the servers block (#25240 )


azurerm_data_share - hyphens are now allowed in the resource's name (#25242 )
azurerm_data_factory_integration_runtime_azure_ssis - support for the
copy_compute_scale and pipeline_external_compute_scale blocks (#25281 )
azurerm_healthcare_service - support for the identity and
configuration_export_storage_account_name properties (#25193 )
azurerm_nginx_deployment - support the auto_scale_profile block (#24950 )
azurerm_netapp_account_resource - support for the kerberos_ad_name ,

kerberos_kdc_ip property , enable_aes_encryption ,


local_nfs_users_with_ldap_allowed , server_root_ca_certificate ,

ldap_over_tls_enabled , and ldap_signing_enabled properties (#25340 )


azurerm_netapp_account_resource - support for [Support for Azure Netapp Files -

AD Site Name #12462] via the site_name property (#25340 )


azurerm_stack_hci_cluster : refactoring the association to use hashicorp/go-azure-
sdk (#25293 )
azurerm_storage_account - support for the dns_endpoint_type property (#22583 )
azurerm_storage_blob_inventory_policy - refactoring to use hashicorp/go-azure-
sdk (#25268 )
azurerm_synapse_spark_pool - added support for 3.4 (#25319 )

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

does not work when days is empty (#25280 )


azurerm_container_app_custom_domain - prevent an issue where the secret was not

being passed through (#25196) (#25251 )


azurerm_data_protection_backup_instance_kubernetes_cluster - prevent the

protection errosr ScenarioPluginInvalidWorkflowDataRequest and


UserErrorKubernetesBackupExtensionUnhealthy

[azurerm_data_protection_backup_instance_kubernetes_cluster is created with


message "Fix protection error for the backup instance" and code
ScenarioPluginInvalidWorkflowDataRequest #25294] (#25345 )
azurerm_purview_account - now allows for PurView accounts with missing or

disabled eventhubs without keys (#25301 )


azurerm_storage_account - fix a crash when the storage account becomes

unavailable while reading (#25332 )


azurerm_storage_blob - fixing a regression where blobs within a nested directory

wouldn't be parsed correctly (#25305 )


azurerm_storage_data_lake_gen2_path - fixing a bug where there was no timeout

available during import (#25282 )


azurerm_storage_queue - fixing a bug where the Table URI was obtained rather

than the Queue URI (#25262 )


azurerm_subscription - fixing an issue when creating a subscription alias

(#25181 )

3.96.0 (March 14, 2024)


ENHANCEMENTS:

dependencies: updating to v0.20240314.1083835 of github.com/hashicorp/go-


azure-sdk (#25255 )
dependencies: updating to v0.25.1 of github.com/tombuildsstuff/giovanni
(#24798 )
dependencies: updating to v1.33.0 of google.golang.org/protobuf (#25243 )
storage : updating the data plane resources to use the transport layer from

hashicorp/go-azure-sdk rather than Azure/go-autorest (#24798 )


Data Source: azurerm_storage_table_entities - support for AAD authentication
(#24798 )
Data Source: azurerm_storage_table_entity - support for AAD authentication
(#24798 )
azurerm_kusto_cluster - support None pattern for the

virtual_network_configuration block (#24733 )


azurerm_linux_function_app - support for the Node 20 runtime (#24073 )
azurerm_linux_function_app_slot - support for the Node 20 runtime (#24073 )
azurerm_stack_hci_cluster - support the identity , cloud_id , service_endpoint

and resource_provider_object_id properties (#25031 )


azurerm_storage_share_file - support for AAD authentication (#24798 )
azurerm_storage_share_directory - support for AAD authentication, deprecate

share_name and storage_account_name in favor of storage_share_id (#24798 )


azurerm_storage_table_entity - support for AAD authentication, deprecate

share_name and storage_account_name in favor of storage_table_id (#24798 )


azurerm_storage_table_entity - support for AAD authentication (#24798 )
azurerm_windows_function_app - support for the Node 20 runtime (#24073 )
azurerm_windows_function_app_slot - support for the Node 20 runtime (#24073 )
azurerm_windows_web_app - support for the Node 20 runtime (#24073 )
azurerm_windows_web_app_slot - support for the Node 20 runtime (#24073 )

BUG FIXES:

azurerm_container_app_custom_domain - fix resource ID parsing bug preventing

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 )

3.95.0 (March 08, 2024)


FEATURES:

New Resource: azurerm_container_app_custom_domain (#24421 )


New Resource: azurerm_data_protection_backup_instance_kubernetes_cluster
(#24940 )
New Resource: azurerm_static_web_app (#25117 )
New resource: azurerm_static_web_app_custom_domain (#25117 )
New resource: azurerm_system_center_virtual_machine_manager_availability_set
(#24975 )
New Resource: azurerm_workloads_sap_three_tier_virtual_instance (#24384 )
New Resource: azurerm_workloads_sap_single_node_virtual_instance (#24331 )

ENHANCEMENTS:

dependencies : updating to v0.20240229.1102109 of github.com/hashicorp/go-


azure-sdk (#25102 )
monitor : updating to use the transport layer from hashicorp/go-azure-sdk rather

than Azure/go-autorest [GH-#25102]


network : updating to API Version 2023-09-01 (#25095 )
azurerm_data_factory_integration_runtime_managed - support for the
credential_name property (#25033 )
azurerm_linux_function_app - support for the description property in the
ip_restriction block (#24527 )
azurerm_linux_function_app - support for the ip_restriction_default_action and

scm_ip_restriction_default_action properties (#25131 )


azurerm_linux_function_app_slot - support for the description property in the
ip_restriction block (#24527 )
azurerm_linux_function_app_slot - support for the ip_restriction_default_action

and scm_ip_restriction_default_action properties (#25131 )


azurerm_linux_web_app - support for the description property in the

ip_restriction block (#24527 )


azurerm_linux_web_app - support for the ip_restriction_default_action and

scm_ip_restriction_default_action properties (#25131 )


azurerm_linux_web_app_slot - support for the description property in the

ip_restriction block (#24527 )


azurerm_linux_web_app_slot - support for the ip_restriction_default_action and
scm_ip_restriction_default_action properties (#25131 )
azurerm_mysql_flexible_server - setting the storage.size_gb property to a

smaller value now forces a new resource to be created (#25074 )


azurerm_orbital_contact_profile - changing the channels property no longer

creates a new resource (#25129 )


azurerm_private_dns_resolver_inbound_endpoint - the private_ip_address

property is no longer required when private_ip_allocation_method is Dynamic


(#25035 )
stream_analytics_output_blob - support for the blob_write_mode property

(#25127 )
azurerm_windows_function_app - support for the description property in the

ip_restriction block (#24527 )


azurerm_windows_function_app - support for the ip_restriction_default_action

and scm_ip_restriction_default_action properties (#25131 )


azurerm_windows_function_app_slot - support for the description property in the

ip_restriction block (#24527 )


azurerm_windows_function_app_slot - support for the
ip_restriction_default_action and scm_ip_restriction_default_action

properties (#25131 )
azurerm_windows_web_app - support for the description property in the

ip_restriction block (#24527 )


azurerm_windows_web_app - support for the ip_restriction_default_action and
scm_ip_restriction_default_action properties (#25131 )
azurerm_windows_web_app_slot - support for the description property in the
ip_restriction block (#24527 )
azurerm_windows_web_app_slot - support for the ip_restriction_default_action

and scm_ip_restriction_default_action properties (#25131 )


BUG FIXES:

Data Source: azurerm_function_app_host_keys - correctly set


event_grid_extension_key by searching for the renamed property in the API

response (#25108 )
azurerm_app_service_public_certificate - fix issue where certificate information

was not being set correctly in the read (#24943 )


azurerm_container_registry - prevent recreation of the resource when the

georeplication.tags are updated (#24994 )


azurerm_firewall_policy_rule_collection_group - fix issue where the client

subscription ID was used to construct the firewall_policy_id (#25145 )


azurerm_function_app_hybrid_connection - fix issue where SendKeyValue was not

populated in the API payload (#23761 )


azurerm_orbital_contact_profile - fix creation of the resource when
event_hub_uri is not specified (#25128 )
azurerm_recovery_services_vault - prevent a panic when immutability is updated

(#25132 )
azurerm_storage_account - fix issue where the queue encryption key type was set

as the table encryption key type (#25046 )


azurerm_web_app_hybrid_connection - fix issue where SendKeyValue was not

populated in the API payload (#23761 )


azurerm_mssql_database - fix incorrect error due to typo when using
restore_long_term_retention_backup_id (#25180 )

DEPRECATIONS:

Deprecated Resource: azurerm_static_site (#25117 )


Deprecated Resource: azurerm_static_site_custom_domain (#25117 )
azurerm_kubernetes_fleet_manager - the hub_profile property is deprecated

(#25010 )

3.94.0 (February 29, 2024)


FEATURES:

New Resource: azurerm_kubernetes_fleet_update_run (#24813 )

ENHANCEMENTS:

dependencies: updating to v0.20240228.1142829 of github.com/hashicorp/go-


azure-sdk (#25081 )
servicefabric : updating to use the transport layer from hashicorp/go-azure-sdk

rather than Azure/go-autorest (#25002 )


springcloud : updating to API Version 2024-01-01-preview (#24937 )
securitycenter : updating to use the transport layer from hashicorp/go-azure-sdk

rather than Azure/go-autorest (#25081 )


Data Source: azurerm_storage_table_entities - support for select (#24987 )
Data Source: azurerm_netapp_volume - support for the
smb_access_based_enumeration and smb_non_browsable properties (#24514 )
azurerm_cosmosdb_account - add support for the minimal_tls_version property

(#24966 )
azurerm_federated_identity_credential - the federated credentials can now be

changed without creating a new resource (#25003 )


azurerm_kubernetes_cluster - support for the current_kubernetes_version

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

restore_long_term_retention_backup_id properties (#24904 )


azurerm_linux_virtual_machine - support for the automatic_upgrade_enabled ,
disk_controller_type , os_image_notification ,

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

smb_non_browsable properties (#24514 )


azurerm_netapp_pool - support for the encryption_type property (#24993 )
azurerm_role_definition - upgrade to the API version 2022-05-01-preview

(#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

refresh_interval_in_seconds property (#25009 )


azurerm_synapse_workspace - support for using the user_assigned_identity_id

property within the customer_managed_key block (#25027 )


azurerm_windows_virtual_machine - support for the automatic_upgrade_enabled ,
disk_controller_type , os_image_notification ,

treat_failure_as_deployment_failure_enabled , and

vm_agent_platform_updates_enabled properties (#23394 )

BUG FIXES:

azurerm_api_management_notification_recipient_email - fixing an issue where

response pages weren't iterated over correctly (#25055 )


azurerm_api_management_notification_recipient_user - fixing an issue where

response pages weren't iterated over correctly (#25055 )


azurerm_batch_pool - fix setting the extension.settings_json property (#24976 )
azurerm_key_vault_key - expiration_date can be updated if newer date is ahead

(#25000 )
azurerm_pim_active_role_assignment - fix an isue where the resource would

disappear or fail to import after 45 days (#24524 )


azurerm_pim_eligible_role_assignment - fix an isue where the resource would

disappear or fail to import after 45 days (#24524 )


azurerm_recovery_services_vault - validate that use_system_assigned_identity

and user_assigned_identity_id cannot be set at the same time (#24091 )


azurerm_recovery_vaults now creates properly with SystemAssigned,UserAssigned
identity (#24978 )
azurerm_subscription - fixing an issue where response pages weren't iterated over

correctly (#25055 )

3.93.0 (February 22, 2024)


FEATURES:

New Data Source: azurerm_express_route_circuit_peering (#24971 )


New Data Source: azurerm_storage_table_entities (#24973 )
New Resource: azurerm_dev_center_catalog (#24833 )
New Resource: azurerm_system_center_virtual_machine_manager_server
(#24278 )

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

identity being set when not specified in config (#24977 )

ENHANCEMENTS:

dependencies: updating to v0.20240221.1170458 of hashicorp/go-azure-sdk


(#24967 )
dependencies: refactor azurerm_spring_cloud_configuration_service to use go-
azure-sdk (#24918 )
provider: support or the feature flag
virtual_machine_scale_set.reimage_on_manual_upgrade (#22975 )
sentinel : updating to use the transport layer from hashicorp/go-azure-sdk rather

than Azure/go-autorest (#24962 )


sqlvirtualmachines : updating to use the transport layer from hashicorp/go-azure-
sdk rather than Azure/go-autorest (#24912 )
nginx : updating to use 2024-01-01-preview (#24868 )
azurerm_cosmosdb_account - support for the backup.tier property (#24595 )
azurerm_linux_virtual_machine - the virtual_machine_scale_set_id proeprty can

now be changed without creating a new resource (#24768 )


azurerm_machine_learning_workspace - support for the

managed_network.isolation_mode property (#24951 )


azurerm_private_dns_resolver_inbound_endpoint - support the static value for

the private_ip_allocation_method property (#24952 )


azurerm_postgresql_flexible_server - expose the storage_tier field (#24892 )
azurerm_redis_cache - support for the preferred_data_persistence_auth_method

property (#24370 )
azurerm_servicebus_namespace - support for the premium_messaging_partitions

property (#24676 )
azurerm_windows_virtual_machine - the virtual_machine_scale_set_id proeprty

can now be changed without creating a new resource (#24768 )

BUG FIXES:

azurerm_cognitive_deployment - the version_upgrade_option property can not be

updated without creating a new resource (#24922 )


azurerm_data_protection_backup_vault - support or the soft_delete and
retention_duration_in_days properties (#24775 )
azurerm_data_factory_pipeline - correctly handle incorrect header values

(#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

certificate block unless otherwise required (#24755 )


azurerm_linux_virtual_machine_scale_set - correctly include public_ip_prefix_id

during updates (#24939 )


azurerm_postgresql_flexible_server - the customer_managed_key.key_vault_key_id

property is now required (#24981 )


azurerm_nginx_deployment - changing the sku property now creates a new

resource (#24905 )
azurerm_orchestrated_virtual_machine_scale_set - the disk_size_gb and lun

parameters of data_disks are optional now (#24944 )


azurerm_storage_account - change order of API calls to be GET-then-PUT ratehr

then PATCHES (#23935 )


azurerm_storage_account - improve the validation around the immutability_policy

being used with blob_properties (#24938 )


azurerm_security_center_setting - prevent a bug when name is SENTINEL
(#24497 )
azurerm_windows_virtual_machine_scale_set - correctly include
public_ip_prefix_id during updates (#24939 )

3.92.0 (February 15, 2024)


FEATURES:

New Data Source: azurerm_virtual_desktop_application_group (#24771 )

ENHANCEMENTS:

provider: support for the feature flag


postgresql_flexible_server.restart_server_on_configuration_value_change
property (#23811 )
dependencies: updating to v0.20240214.1142753 of github.com/hashicorp/go-
azure-sdk (#24889 )
automation : updating to use the transport layer from hashicorp/go-azure-sdk

rather than Azure/go-autorest (#24858 )


maintenance : updating to use the transport layer from hashicorp/go-azure-sdk

rather than Azure/go-autorest (#24819 )


containerapps : updating to use the transport layer from hashicorp/go-azure-sdk

rather than Azure/go-autorest (#24862 )


containerservices : updating to use the transport layer from hashicorp/go-azure-

sdk rather than Azure/go-autorest (#24872 )


timeseriesinsights : updating to use the transport layer from hashicorp/go-azure-

sdk rather than Azure/go-autorest (#24889 )


azurerm_container_app_environment : support for the

infrastructure_resource_group_name property (#24361 )


azurerm_cost_anomaly_alert - support for the subscription_id property

(#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:

azurerm_container_app_environment : avoid unwanted changes when updating and

using log_analytics_workspace_id (#24303 )


azurerm_cosmosdb_account - fixed regression in the backup code block (#24830 )
azurerm_data_factory - allow the git_url property to be blank/empty (#24879 )
azurerm_linux_web_app_slot - the worker_count property now works correctly in

the site_config block (#24515 )


azurerm_linux_web_app - support off for the file_system_level property

(#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

would remove any Application Security Group Association (#24846 )


azurerm_search_service - fixed the update function to adjust for changed API

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 )

3.91.0 (February 08, 2024)


FEATURES:

New Data Source: azurerm_databricks_access_connector (#24769 )


New Resource: azurerm_data_protection_backup_policy_kubernetes_cluster
(#24718 )
New Resource: azurerm_chaos_studio_experiment (#24779 )
New Resource: azurerm_chaos_studio_capability (#24779 )
New Resource: azurerm_dev_center_gallery (#23760 )
New Resource: azurerm_kubernetes_fleet_member (#24792 )
New Resource: azurerm_iotcentral_organization (#23132 )
New Resource:
azurerm_spring_cloud_app_dynamics_application_performance_monitoring

(#24750 )

ENHANCEMENTS:

dependencies: updating to v0.20240208.1095436 of github.com/hashicorp/go-


azure-sdk/resource-manager (#24819 )
dependencies: updating to v0.20240208.1095436 of github.com/hashicorp/go-
azure-sdk/sdk (#24819 )
dependencies: refactor azurerm_app_service_environment_v3 to use go-azure-sdk
(#24760 )
dependencies: refactor azurerm_role_definition to use go-azure-sdk (#24266 )
managedhsm : updating to use the transport layer from hashicorp/go-azure-sdk

rather than Azure/go-autorest (#24761 )


hdinsight : updating to API Version 2023-07-01 (#24761 )
streamanalytics : updating to use the transport layer from hashicorp/go-azure-sdk

rather than Azure/go-autorest (#24819 )


azurerm_app_service_environment_v3 - support for the remote_debugging_enabled

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

always_serve_enabled property (#24573 )

BUG FIXES:

azurerm_api_management - the virtual_network_configuration property now

updates correctly outside of virtual_network_type (#24569 )

3.90.0 (February 01, 2024)


UPGRADE NOTES:

provider - The provider now automatically registers the AppConfiguration ,


DataFactory , and SignalRService Resource Providers. When running Terraform

with limited permissions, note that you must disable automatic Resource Provider
Registration and ensure that any Resource Providers Terraform requires are
registered. (#24645 )

FEATURES:

New Data Source: azurerm_nginx_configuration (#24642 )


New Data Source: azurerm_virtual_desktop_workspace (#24732 )
New Resource: azurerm_kubernetes_fleet_update_strategy (#24328 )
New Resource: azurerm_site_recovery_vmware_replicated_vm (#22477 )
New Resource:
azurerm_spring_cloud_new_relic_application_performance_monitoring (#24699 )

ENHANCEMENTS:

provider: registering the Resource Provider Microsoft.AppConfiguration


(#24645 )
provider: registering the Resource Provider Microsoft.DataFactory (#24645 )
provider: registering the Resource Provider Microsoft.SignalRService (#24645 )
provider: the Provider is now built using Go 1.21.6 (#24653 )
dependencies: the dependency github.com/hashicorp/go-azure-sdk is split into
multiple Go Modules - and as such will be referred to by those paths going
forwards (#24636 )
dependencies: updating to ``v0.20240201.1064937 of github.com/hashicorp/go-
azure-sdk/resource-manager` (#24738 )
dependencies: updating to v0.20240201.1064937 of github.com/hashicorp/go-
azure-sdk/sdk (#24738 )
appservice : update to go-azure-sdk and API version 2023-01-01 (#24688 )
datafactory : updating to use tombuildsstuff/kermit (#24675 )
hdinsight : refactoring to use github.com/hashicorp/go-azure-sdk/resource-
manager (#24011 )
hdinsight : updating to API Version 2021-06-01 (#24011 )
loadbalancer : updating to use hashicorp/go-azure-sdk (#24291 )
nginx : updating to API Version 2023-09-01 (#24640 )
servicefabricmanagedcluster : updating to use the base layer from hashicorp/go-
azure-sdk rather than Azure/go-autorest (#24654 )
springcloud : updating to use API Version 2023-11-01-preview (#24690 )
subscriptions : refactoring to use hashicorp/go-azure-sdk (#24663 )
Data Source: azurerm_stream_analytics_job - support for User Assigned Identities
(#24738 )
azurerm_cosmosdb_account - support for the gremlin_database and

tables_to_restore properties (#24627 )


azurerm_bot_channel_email - support for the magic_code property (#23129 )
azurerm_cosmosdb_account - support for the partition_merge_enabled property

(#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

the trusted_address_ranges property (#24459 )


azurerm_palo_alto_next_generation_firewall_virtual_network_local_rulestack -

support for the trusted_address_ranges property (#24459 )


azurerm_palo_alto_next_generation_firewall_virtual_network_panorama - support

for the trusted_address_ranges property (#24459 )


azurerm_servicebus_namespace - updating to use API Version 2022-10-01-preview

(#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

and local_response_cache_per_instance properties (#24697 )


azurerm_stream_analytics_job - support for User Assigned Identities (#24738 )
azurerm_subscription - refactoring to use hashicorp/go-azure-sdk to set tags on

the subscription (#24734 )


azurerm_virtual_desktop_workspace - correctly validate the name property

(#24668 )

BUG FIXES:

provider: skip registration for resource providers that are unavailable (#24571 )
azurerm_app_configuration - no longer require lifecycle_ignore_changes for the

value property when using a key vault reference (#24702 )


azurerm_app_service_managed_certificate - fix casing issue in app_service_plan_id

by parsing insensitively (#24664 )


azurerm_cognitive_deployment - updates now include the version property

(#24700 )
azurerm_dns_cname_record - prevent casing issue in target_resource_id by parsing

the ID insensitively (#24181 )


azurerm_mssql_managed_instance_failover_group - prevent an issue when trying to

create a failover group with a managed instance from a different subscription


(#24646 )
azurerm_storage_account - conditionally update properties only when needed

(#24669 )
azurerm_storage_account - change update order for access_tier to prevent errors

when uploading blobs to the archive tier (#22250 )

3.89.0 (January 25, 2024)


FEATURES:

New Data Source: azurerm_data_factory_trigger_schedule (#24572 )


New Data Source: azurerm_data_factory_trigger_schedules (#24572 )
New Data Source: azurerm_ip_groups (#24540 )
New Data Source: azurerm_nginx_certificate (#24577 )
New Resource: azurerm_chaos_studio_target (#24580 )
New Resource: azurerm_elastic_san_volume_group (#24166 )
New Resource: azurerm_netapp_account_encryption (#23733 )
New Resource: azurerm_redhat_openshift_cluster (#24375 )

ENHANCEMENTS:

dependencies: updating to v0.66.1 of github.com/hashicorp/go-azure-helpers


(#24561 )
dependencies: updating to v0.20240124.1115501 of github.com/hashicorp/go-
azure-sdk (#24619 )
bot : updating to API Version 2021-05-01-preview (#24555 )
containerservice : the SDK Clients now support logging (#24564 )
cosmosdb : updating to API Version 2023-04-15 (#24541 )
loadtestservice : updating to use the base layer from hashicorp/go-azure-sdk

rather than Azure/go-autorest (and support logging) (#24578 )


managedidentity : updating to use the base layer from hashicorp/go-azure-sdk

rather than Azure/go-autorest (and support logging) (#24578 )


azurerm_api_management_api - change the id format so specific revision s can be

managed by Terraform (#23031 )


azurerm_data_protection_backup_vault - the redundancy propety can now be set

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-

azure-edition-hotpatch and 2022-datacenter-azure-edition-hotpatch-smalldisk


hotpatching images (#23500 )
azurerm_stream_analytics_job - support for the sku_name property (#24554 )

BUG FIXES:

Data Source: azurerm_app_service - parsing the API Response for


app_service_plan_id case-insensitively (#24626 )

Data Source: azurerm_function_app - parsing the API Response for


app_service_plan_id case-insensitively (#24626 )

azurerm_app_configuration_key - the value for the value property can now be

removed/emptied (#24582 )

azurerm_app_service - parsing the API Response for app_service_plan_id case-

insensitively (#24626 )

azurerm_app_service_plan - fix casing in serverFarms due to ID update (#24562 )


azurerm_app_service_slot - parsing the API Response for app_service_plan_id

case-insensitively (#24626 )

azurerm_automation_schedule - only one monthly_occurence block can now be

specified (#24614 )

azurerm_cognitive_deployment - the model.version property is no longer required

(#24264 )

azurerm_container_app - multiple custom_scale_rule can not be updated

(#24509 )

azurerm_container_registry_task_schedule_run_now - prevents issue where the

incorrect scheduled run is tracked if there are multiple (#24592 )

azurerm_function_app - parsing the API Response for app_service_plan_id case-

insensitively (#24626 )

azurerm_function_app_slot - parsing the API Response for app_service_plan_id

case-insensitively (#24626 )

azurerm_logic_app_standard - now parses the app service ID insensitively

(#24562 )

azurerm_logic_app_workflow - the workflow_parameters now correctlys handle

information specified by $connections (#24141 )

azurerm_mssql_managed_instance_security_alert_policy - can not update empty

storage attributes (#24553 )

azurerm_network_interface - the ip_configuration properties are no longer added


to a Load Balancer Backend if one of those ip_configurations is associated with a
backend (#24470 )

3.88.0 (January 18, 2024)


FEATURES:

New Data Source: azurerm_nginx_deployment (#24492 )


New Resource:
azurerm_spring_cloud_dynatrace_application_performance_monitoring (#23889 )
New Resource: azurerm_virtual_machine_run_command (#23377 )
ENHANCEMENTS:

dependencies: updating to v0.20240117.1163544 of github.com/hashicorp/go-


azure-sdk (#24481 )
dependencies: updating to v0.65.1 of github.com/hashicorp/go-azure-helpers
(#24479 )
datashare : updating to use the base layer from hashicorp/go-azure-sdk rather

than Azure/go-autorest (#24481 )


kusto : updating to use the base layer from hashicorp/go-azure-sdk rather than
Azure/go-autorest (#24477 )
Data Source: azurerm_application_gateway - support for the
trusted_client_certificate.data property (#24474 )
azurerm_service_plan : refactoring to use hashicorp/go-azure-sdk (#24483 )
azurerm_container_group - support for the priority property (#24374 )
azurerm_mssql_managed_database - support for the point_in_time_restore property

(#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:

azurerm_application_gateway - the components property within the url block is no

longer computed (#24480 )


azurerm_cdn_frontdoor_route - prevent an issue where cdn_frontdoor_origin_path

gets removed on update if unchanged. (#24488 )


azurerm_cognitive_account - fixing support for the DC0 SKU (#24526 )

3.87.0 (January 11, 2024)


FEATURES:

New Data Source: azurerm_network_manager (#24398 )


New Resource:
azurerm_security_center_server_vulnerability_assessments_setting (#24299 )
ENHANCEMENTS:

dependencies: updating to v0.20240111.1094251 of github.com/hashicorp/go-


azure-sdk (#24463 )
Data Source: azurerm_mssql_database - support for identity ,
transparent_data_encryption_enabled ,

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

pool cycling (#24397 )


azurerm_linux_web_app - support the VS2022 value for the

remote_debugging_version property (#24407 )


azurerm_mssql_database - support for identity ,
transparent_data_encryption_key_vault_key_id and

transparent_data_encryption_key_automatic_rotation_enabled (#24412 )
azurerm_postgres_flexible_server - the sku_name property now supports being

set to MO_Standard_E96ds_v5 (#24367 )


azurerm_role_assignment - support for the principal_type property (#24271 )
azurerm_windows_web_app - support the VS2022 value for the

remote_debugging_version property (#24407 )


azurerm_cdn_frontdoor_firewall_policy - support for request_body_check_enabled

property (#24406 )

BUG FIXES:

Data Source: azurerm_role_definition - fix role_definition_id (#24418 )


azurerm_api_management - the sku_name property can now be updated (#24431 )
azurerm_arc_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 )
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

application_stack in updates to site_config (#24424 )


azure_linux_web_app_slot - Fix bug in App Service processing of
application_stack in updates to site_config (#24424 )
azurerm_network_manager_deployment - update creation wait logic to better tolerate

the api returning not found (#24330 )


azurerm_virtual_machine_data_disk_attachment - do not update applications

profile with disks (#24145 )


azure_windows_web_app - prevent a bug in App Service processing of

application_stack in updates to site_config (#24424 )


azure_windows_web_app_slot - prevent a bug in App Service processing of

application_stack in updates to site_config (#24424 )


azurerm_maintenance_configuration - set the reboot property in flatten from
AlwaysReboot to Always (#24376 )
azurerm_container_app_environment - the workload_profile property can now be

updated (#24409 )

3.86.0 (January 04, 2024)


FEATURES:

New Data Source: azurerm_dashboard_grafana (#24243 )


New Resource: azurerm_log_analytics_workspace_table (#24229 )
New Resource: azurerm_automation_powershell72_module (#23980 )
New Resource: azurerm_data_factory_credential_user_managed_identity
(#24307 )

ENHANCEMENTS:

dependencies: updating to v0.20231215.1114251 of hashicorp/go-azure-sdk


(#24251 )
dependencies: azurerm_spring_cloud_api_portal - update to use hashicorp/go-
azure-sdk (#24321 )
Data Source: azurerm_kusto_cluster - now exports the identity block (#24314 )
azurerm_data_protection_backup_policy_postgresql - support for the time_zone

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

site_config.0.public_network_access_enabled property (#24257 )


azurerm_log_analytics_workspace_table - support for the plan property

(#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:

Data Source: azurerm_role_definition - correctly export the role_definition_id


attribute (#24320 )
azurerm_bot_service - fixing a bug where public_network_access_enabled was

always set to true (#24255 )


azurerm_bot_service_azure_bot - tags can now be updated (#24332 )
azurerm_cosmosdb_account - fix validation for the ip_range_filter property

(#24306 )
azurerm_linux_virtual_machine - the

additional_capabilities.0.ultra_ssd_enabled can now be changed during the

update (#24274 )
azurerm_logic_app_standard - update the default value of version from ~3 which

is no longer supported to ~4 (#24134 )


azurerm_logic_app_standard - fix a crash when setting the default version 4.0 flag

(#24322 )
azurerm_iothub_device_update_account - changing the sku property now creates a

new resource (#24324 )


azurerm_iothub - prevent an inconsistant value after an apply (#24326 )
azurerm_orchestrated_virtual_machine_scale_set - correctly update the resource

when hotpatch is enabled (#24335 )


azurerm_windows_virtual_machine - the

additional_capabilities.0.ultra_ssd_enabled can now be changed during the

update (#24274 )
azurerm_scheduled_query_rules_alert - changing the data_source_id now creates

a new resource (#24327 )


azurerm_scheduled_query_rules_log - changing the data_source_id now creates a

new resource (#24327 )

3.85.0 (December 14, 2023)


FEATURES:

New Data Source: azurerm_locations (#23324 )


New Resource: azurerm_iotcentral_organization (#23132 )

ENHANCEMENTS:

provider: support for authenticating using Azure Kubernetes Service Workload


Identity (#23965 )
dependencies: updating to v0.65.0 of github.com/hashicorp/go-azure-helpers
(#24222 )
dependencies: updating to v0.20231214.1220802 of github.com/hashicorp/go-
azure-sdk (#24246 )
dependencies: updating to version v0.20231214.1160726 of
github.com/hashicorp/go-azure-sdk (#24241 )
dependencies: update security/automation to use hashicorp/go-azure-sdk
(#24156 )
dataprotection : updating to API Version 2023-05-01 (#24143 )
kusto : removing the remnants of the old Resource ID Parsers now this uses

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

verification_timer_in_seconds and write_back_timer_in_seconds properties


(#24207 )
azurerm_hpc_cache_nfs_target - support for the verification_timer_in_seconds

and write_back_timer_in_seconds properties (#24208 )


azurerm_linux_web_app - make client_secret_setting_name optional and conflict

with client_secret_certificate_thumbprint (#21834 )


azurerm_linux_web_app_slot - make client_secret_setting_name optional and

conflict with client_secret_certificate_thumbprint (#21834 )


azurerm_linux_web_app - fix a bug in app_settings where settings could be lost

(#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

immediate_data_purge_on_30_days_enabled property (#24015 )


azurerm_mssql_server - support for other identity types for the key vault key

(#24236 )
azurerm_machine_learning_datastore_blobstorage - resource now skips validation

when being created (#24078 )


azurerm_machine_learning_datastore_datalake_gen2 - resource now skips

validation when being created (#24078 )


azurerm_machine_learning_datastore_fileshare - resource now skips validation

when being created (#24078 )


azurerm_monitor_workspace - support for the default_data_collection_endpoint_id

and default_data_collection_rule_id properties (#24153 )


azurerm_redis_cache - support for the storage_account_subscription_id property

(#24101 )
azurerm_storage_blob - support for the source_content type Page (#24177 )
azurerm_web_application_firewall_policy - support new values to the

rule_group_name property (#24194 )


azurerm_windows_web_app - make the client_secret_setting_name property

optional and conflicts with the client_secret_certificate_thumbprint property


(#21834 )
azurerm_windows_web_app_slot - make the client_secret_setting_name property

optional and conflicts with the client_secret_certificate_thumbprint property


(#21834 )
azurerm_windows_web_app - fix a bug in app_settings where settings could be lost

(#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

passed to the resource even though it isn't supported (#24204 )


azurerm_batch_pool - fix bug where settings_json and protected_settings were

not being unmarshaled (#24075 )


azurerm_bot_service_azure_bot - fix bug where public_network_access_enabled

was being set as the value for LuisKey (#24164 )


azurerm_cognitive_account_customer_managed_key - identity_client_id is no

longer passed to the api when it is empty (#24231 )


azurerm_linux_web_app_slot - error when service_plan_id is identical to the

parent service_plan_id (#23403 )


azurerm_management_group_template_deployment - fixing a bug where
template_spec_version_id couldn't be updated (#24072 )
azurerm_pim_active_role_assignment - fix an importing issue by filtering available

role assignments based on the provided scope (#24077 )


azurerm_pim_eligible_role_assignment - fix an importing issue by filtering

available role assignments based on the provided scope (#24077 )


azurerm_resource_group_template_deployment - fixing a bug where

template_spec_version_id couldn't be updated (#24072 )


azurerm_security_center_setting - fix the casing for the setting_name Sentinel

(#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

parent service_plan_id (#23403 )

3.84.0 (December 07, 2023)


FEATURES:

New Data Source: azurerm_storage_containers (#24061 )


New Resource: azurerm_elastic_san (#23619 )
New Resource:
azurerm_key_vault_managed_hardware_security_module_role_assignment (#22332 )
New Resource:
azurerm_key_vault_managed_hardware_security_module_role_definition (#22332 )

ENHANCEMENTS:

dependencies: updating mssql elasticpools from v5.0 to 2023-05-01-preview


dependencies: updating to v0.20231207.1122031 of github.com/hashicorp/go-
azure-sdk (#24149 )
Data Source: azurerm_storage_account - export the primary and secondary internet
and microsoft hostnames for blobs, dfs, files, queues, tables and web (#23517 )
Data Source: azurerm_cosmosdb_account - export the connection_strings ,
primary_sql_connection_string , secondary_sql_connection_string ,
primary_readonly_sql_connection_string ,

secondary_readonly_sql_connection_string , primary_mongodb_connection_string ,

secondary_mongodb_connection_string ,
primary_readonly_mongodb_connection_string , and

secondary_readonly_mongodb_connection_string attributes (#24129 )


azurerm_bot_service_azure_bot - support for the public_network_access_enabled

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:

azurerm_application_insights_api_key - prevent a bug where multiple keys

couldn't be created for an Application Insights instance (#23463 )


azurerm_container_registry - the network_rule_set.virtual_network property is

deprecated (#24140 )
azurerm_hdinsight_hadoop_cluster - set

roles.edge_node.install_script_action.parameters into state by retrieving the

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

date was always recalculated and sent to the API (#23985 )


azurerm_mssql_database - no longer sends all long retention values in payload

unless set (#24124 )


azurerm_mssql_managed_database - no longer sends all long retention values in

payload unless set (#24124 )


azurerm_mssql_server_microsoft_support_auditing_policy - only include storage

endpoint in payload if set (#24122 )


azurerm_mobile_network_packet_core_control_plane - prevent a panic if the HTTP

Response is nil (#24083 )


azurerm_storage_account - revert plan time name validation (#23799) (#24142 )
azurerm_web_application_firewall_policy - split create and update function to fix

lifecycle - ignore changes (#23412 )

3.83.0 (November 30, 2023)


UPGRADE NOTES

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:

New Data Source: azurerm_stack_hci_cluster (#24032 )

ENHANCEMENTS:

dependencies: updating to v0.20231129.1103252 of github.com/hashicorp/go-


azure-sdk (#24063 )
automation : updating to API Version 2023-11-01 (#24017 )
keyvault : the cache is now populated using the ListBySubscription endpoint on

the KeyVault Resource Provider rather than via the Resources API (#24019 ).
keyvault : updating the cache to populate all Key Vaults available within the

Subscription to reduce the number of API calls (#24019 )


Data Source azurerm_private_dns_zone : refactoring to use the ListBySubscription
API rather than the Resources API when resource_group_name is omitted
(#24024 )
azurerm_dashboard_grafana - support for grafana_major_version (#24014 )
azurerm_linux_web_app - add support for dotnet 8 (#23893 )
azurerm_linux_web_app_slot - add support for dotnet 8 (#23893 )
azurerm_media_transform - deprecate face_detector_preset and

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

updated at the same time (#24029 )


azurerm_data_factory_flowlet_data_flow - source and sink properties are now

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

weren't parsed correctly from the API Response (#24031 )


azurerm_nginx_deployment - add default value of 20 for capacity (#24033 )

3.82.0 (November 23, 2023)


FEATURES:

New Data Source: azurerm_monitor_workspace (#23928 )


New Resource: azurerm_application_load_balancer_subnet_association (#23628 )

ENHANCEMENTS:

dependencies: updating to v0.20231117.1130141 of github.com/hashicorp/go-


azure-sdk (#23945 )
azurestackhci : updating to API Version 2023-08-01 (#23939 )
dashboard : updating to API Version 2023-09-01 (#23929 )
hpccache : updating to API version 2023-05-01 (#24005 )
mssql : updating resources using hashicorp/go-azure-sdk to API Version 2023-02-
01-preview (#23721 )
templatespecversions : updating to API Version 2022-02-01 (#24007 )
Data Source: azurerm_template_spec_version - refactoring to use hashicorp/go-
azure-sdk (#24007 )
azurerm_cosmosdb_postgresql_cluster - coordinator_storage_quota_in_mb and
coordinator_vcore_count are no longer required for read replicas (#23928 )
azurerm_dashboard_grafana - sku can now be set to Essential (#23934 )
azurerm_gallery_application_version - add support for the config_file ,

package_file and target_region.exclude_from_latest properties (#23816 )


azurerm_hdinsight_hadoop_cluster - script_actions is no longer Force New

(#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

application_performance_monitoring_ids property (#23862 )


azurerm_spring_cloud_customized_accelerator - add support for the

accelerator_type and path properties (#23797 )


azurerm_point_to_site_vpn_gateway - allow multiple connection_configurations

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

match the updated API behaviour (#23973 )


azurerm_dev_test_windows_virtual_machine - storage_type is now ForceNew to

match the updated API behaviour (#23973 )


azurerm_disk_encryption_set - resource will recreate if identity changes from

SystemAssigned to UserAssigned (#23904 )


azurerm_eventhub_cluster : sku_name is no longer ForceNew (#24009 )
azurerm_firewall - recasing the value for firewall_policy_id to workaround the

API returning the incorrect casing (#23993 )


azurerm_security_center_subscription_pricing - fix a bug preventing removal of

extensions and downgrading tier to Free (#23821 )


azurerm_windows_web_app - fix an issue of incorrect application stack settings

during update (#23372 )

3.81.0 (November 16, 2023)


ENHANCEMENTS:

dependencies: updating to v0.20231116.1162710 of github.com/hashicorp/go-


azure-sdk (#23922 )
managedservices : updating to use the base layer from hashicorp/go-azure-sdk

rather than Azure/go-autorest (#23890 )


network : updating to API Version 2023-06-01 (#23875 )
servicelinker : updating to use the base layer from hashicorp/go-azure-sdk rather

than Azure/go-autorest (#23890 )


storage : refactoring usages of github.com/hashicorp/go-azure-sdk to use the base

layer from hashicorp/go-azure-sdk rather than Azure/go-autorest (#23890 )


Data Source: azurerm_network_ddos_protection_plan : refactoring to use
hashicorp/go-azure-sdk (#23849 )
azurerm_linux_function_app - add support for disabling Basic Auth for default

Publishing Profile via new properties ftp_publish_basic_authentication_enabled


and webdeploy_publish_basic_authentication_enabled (#23900 )
azurerm_linux_function_app_slot - add support for disabling Basic Auth for

default Publishing Profile via new properties


ftp_publish_basic_authentication_enabled and

webdeploy_publish_basic_authentication_enabled (#23900 )
azurerm_linux_web_app - add support for disabling Basic Auth for default

Publishing Profile via new properties ftp_publish_basic_authentication_enabled


and webdeploy_publish_basic_authentication_enabled (#23900 )
azurerm_linux_web_app_slot - add support for disabling Basic Auth for default

Publishing Profile via new properties ftp_publish_basic_authentication_enabled


and webdeploy_publish_basic_authentication_enabled (#23900 )
azurerm_logic_app_integration_account_certificate - name now accepts

underscores (#23866 )
azurerm_logic_app_integration_account_partner - business_identity.value now

accepts underscores (#23866 )


azurerm_monitor_data_collection_rule - added support for WorkspaceTransforms

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

Publishing Profile via new properties ftp_publish_basic_authentication_enabled


and webdeploy_publish_basic_authentication_enabled (#23900 )
azurerm_windows_function_app_slot - add support for disabling Basic Auth for

default Publishing Profile via new properties


ftp_publish_basic_authentication_enabled and

webdeploy_publish_basic_authentication_enabled (#23900 )
azurerm_windows_web_app - add support for disabling Basic Auth for default

Publishing Profile via new properties ftp_publish_basic_authentication_enabled


and webdeploy_publish_basic_authentication_enabled (#23900 )
azurerm_windows_web_app_slot - add support for disabling Basic Auth for default

Publishing Profile via new properties ftp_publish_basic_authentication_enabled


and webdeploy_publish_basic_authentication_enabled (#23900 )

3.80.0 (November 09, 2023)


ENHANCEMENTS:

internal/sdk - Added support for pointer Types in resource models (#23810 )


dependencies: updating to v0.63.0 of github.com/hashicorp/go-azure-helpers
(#23785 )
dependencies: updating to v0.20231106.1151347 of github.com/hashicorp/go-
azure-sdk (#23787 )
azurerm_cognitive_deployment - support for the version_upgrade_option property

(#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

default_node_pool without recreating the cluster (#23612 )


azurerm_kusto_cluster - the cluster name can now include dashes (#23790 )
azurerm_postgresql_database - update the validation of collation to include

support for French_France.1252 (#23783 )

BUG FIXES:

Data Source: azurerm_data_protection_backup_vault - removing import support,


since Data Sources don't support being imported (#23820 )
Data Source: azurerm_kusto_database - removing import support, since Data
Sources don't support being imported (#23820 )
Data Source: azurerm_virtual_hub_route_table - removing import support, since
Data Sources don't support being imported (#23820 )
azurerm_windows_web_app - prevent a panic with the auto_heal.actions property

(#23836 )
azurerm_windows_web_app - prevent a panic with the auto_heal.triggers property

(#23812 )

3.79.0 (November 02, 2023)


ENHANCEMENTS:

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

without specifying administrator_login_password property (#23750 )


azurerm_managed_application - arrays can be supplied in the parameter_values

property (#23754 )
azurerm_storage_management_policy - support for properties
rule.*.actions.*.base_blob.0.tier_to_cold_after_days_since_{modification|last_

access_time|creation}_greater_than and rule.*.actions.*.


{snapshot|version}.0.tier_to_cold_after_days_since_creation_greater_than

(#23574 )

BUG FIXES:

azurerm_api_management_diagnostic - the operation_name_format attribute will only

be sent if identifier is set to applicationinsights (#23736 )


azurerm_backup_policy_vm - fix payload by using current datetime (#23586 )
azurerm_kubernetes_cluster - the custom_ca_trust_certificates_base64 property

can not be removed, only updated (#23737 )

3.78.0 (October 26, 2023)


FEATURES:

New Resource: azurerm_resource_management_private_link_association (#23546 )

ENHANCEMENTS:

dependencies: updating to v0.20231025.1113325 of github.com/hashicorp/go-


azure-sdk (#23684 )
dependencies: updating to v1.58.3 of google.golang.org/grpc (#23691 )
dependencies: updating search service from 2022-09-01 to 2023-11-01 (#23698 )
Data Source: azurerm_monitor_workspace - export query_endpoint (#23629 )
azurerm_express_route_port - support for macsec_sci_enabled (#23625 )
azurerm_eventhub_namespace_customer_managed_key - support for the

user_assigned_identity_id property (#23635 )


azurerm_postgresql_flexible_server - private_dns_zone_id is no longer ForceNew

and case is suppressed (#23660 )


azurerm_synapse_workspace - add support for azuread_authentication_only

(#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 -

added lock for ruleStackID (#23601 )


azurerm_cognitive_deployment - remove forceNew tag from rai_policy_name

(#23697 )
3.77.0 (October 19, 2023)
FEATURES:

New Resources: azurerm_application_load_balancer_frontend (#23411 )


New Resources: azurerm_dev_center (#23538 )
New Resources: azurerm_dev_center_project (#23538 )

ENHANCEMENTS:

dependencies: updating to v0.62.0 of github.com/hashicorp/go-azure-helpers


(#23581 )
dependencies: updating Kusto SDK from 2023-05-02 to 2023-08-15 (#23598 )
dependencies: updating nginx from 2022-08-01 to 2023-04-01 (#23583 )
netapp : updating to use API Version 2023-05-01 (#23576 )
springcloud : updating to use API Version 2023-09-01-preview (#23544 )
storage : updating to use API Version 2023-01-01 (#23543 )
internal/sdk : fixing an issue where struct fields containing

removedInNextMajorVersion wouldn't be decoded correctly (#23564 )


internal/sdk : struct tag parsing is now handled consistently during both encoding

and decoding (#23568 )


provider: the roll_instances_when_required provider feature in the
virtual_machine_scale_set block is now optional (#22976 )
Data Source: azurerm_automation_account : refactoring the remaining usage of
Azure/azure-sdk-for-go to use hashicorp/go-azure-sdk (#23555 )
azurerm_automation_account : refactoring the remaining usage of Azure/azure-sdk-

for-go to use hashicorp/go-azure-sdk (#23555 )


azurerm_resource_deployment_script_azure_cli - improve validation for the

version property to support newer versions (#23370 )


azurerm_resource_deployment_script_azure_power_shell - improve validation for

the version property to support newer versions (#23370 )


azurerm_nginx_deployment - support for the capacity and email properties

(#23596 )

BUG FIXES:

Data Source: azurerm_virtual_hub_connection - export the inbound_route_map_id ,


outbound_route_map_id , and static_vnet_local_route_override_criteria attributes

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

redis_primary_connection_string and secondary_connection_string (#23575 )


azurerm_monitor_activity_log_alert - the recommend_category property now can

be set to HighAvailability (#23605 )


azurerm_recovery_services_vault - the encryption property can now be used with

the cross_region_restore_enabled property (#23618 )


azurerm_storage_account_customer_managed_key - prevent a panic when the

keyvault id is empty (#23599 )

3.76.0 (October 12, 2023)


FEATURES:

New Resource: azurerm_security_center_storage_defender (#23242 )


New Resource:
azurerm_spring_cloud_application_insights_application_performance_monitoring

(#23107 )

ENHANCEMENTS:

provider: updating to build using Go 1.21.3 (#23514 )


dependencies: updating to v0.20231012.1141427 of github.com/hashicorp/go-
azure-sdk (#23534 )
Data Source: azurerm_application_gateway - support for backend_http_settings ,
global , gateway_ip_configuration and more attributes (#23318 )
Data Source: azurerm_network_service_tags - export the name attribute (#23382 )
azurerm_cosmosdb_postgresql_cluster - add support for sql_version of 16 and

citus_version of 12.1 (#23476 )


azurerm_palo_alto_local_rulestack - correctly normalize the location property

(#23483 )
azurerm_static_site - add support for app_settings (#23421 )

BUG FIXES:

azurerm_automation_schedule - fix a bug when updating start_time (#23494 )


azurerm_eventhub - remove ForceNew and check partition_count is not decreased

(#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

block contains nil properties (#23535 )

3.75.0 (September 28, 2023)


FEATURES:

New Resource: azurerm_application_load_balancer (#22517 )


New Resource: azurerm_resource_management_private_link (#23098 )

ENHANCEMENTS:

dependencies: firewall migrated to hashicorp/go-azure-sdk (#22863 )


azurerm_bot_service_azure_bot - add support for the icon_url property

(#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:

azurerm_api_management_api - fix importing openapi format content file issue

(#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

from being recovered (#23204 )


azurerm_log_analytics_solution - fix create and update lifecycle of resource by

splitting methods (#23333 )


azurerm_management_group_subscription_association - mark resource as gone

correctly if not found when retrieving (#23335 )


azurerm_management_lock - add polling after create and delete to check for RP

propagation (#23345 )
azurerm_monitor_diagnostic_setting - added validation to ensure at least one of

category or category_group is supplied (#23308 )


azurerm_palo_alto_local_rulestack_prefix_list - fix rulestack not being

committed on delete (#23362 )


azurerm_palo_alto_local_rulestack_fqdn_list - fix rulestack not being committed

on delete (#23362 )
security_center_subscription_pricing_resource - disabled extensions logic now

works as expected (#22997 )

3.74.0 (September 21, 2023)


NOTES:

azurerm_synapse_sql_pool - users that have imported azurerm_synapse_sql_pool

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:

New Resource: azurerm_arc_resource_bridge_appliance (#23108 )


New Resource: azurerm_data_factory_dataset_azure_sql_table (#23264 )
New Resource: azurerm_function_app_connection (#23127 )

ENHANCEMENTS:

dependencies: updating to v0.20230918.1115907 of github.com/hashicorp/go-


azure-sdk (#23337 )
dependencies: downgrading to v1.12.5 of github.com/rickb777/date (#23296 )
mysql : updating to use API Version 2022-01-01 (#23320 )
azurerm_app_configuration - support for the replica block (#22452 )
azurerm_bot_channel_directline - support for user_upload_enabled ,
endpoint_parameters_enabled , and storage_enabled (#23149 )
azurerm_container_app - support for scale rules (#23294 )
azurerm_container_app_environment - support for zone redundancy (#23313 )
azurerm_container_group - support for the key_vault_user_identity_id property

for Customer Managed Keys (#23332 )


azurerm_cosmosdb_account - support for MongoDB connection strings (#23331 )
azurerm_data_factory_dataset_delimited_text - support for the
dynamic_file_system_enabled , dynamic_path_enabled , and

dynamic_filename_enabled properties (#23261 )


azurerm_data_factory_dataset_parquet - support for the azure_blob_fs_location

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

for storage_mb (#23277 )


azurerm_shared_image_version - support for the

replicated_region_deletion_enabled and

target_region.exclude_from_latest_enabled properties (#23147 )


azurerm_storage_account - support for setting domain_name and domain_guid for

AADKERB (#22833 )
azurerm_storage_account_customer_managed_key - support for cross-tenant

customer-managed keys with the federated_identity_client_id , and


key_vault_uri properties (#20356 )
azurerm_web_application_firewall_policy - support for the rate_limit_duration ,

rate_limit_threshold , group_rate_limit_by , and


request_body_inspect_limit_in_kb properties (#23239 )

BUG FIXES:

Data Source: azurerm_container_app_environment : fix


log_analytics_workspace_name output to correct value (#23298 )
azurerm_api_management_api - set the service_url property when importing the

resource (#23011 )
azurerm_app_configuration - prevent crash by nil checking the encryption

configuration (#23302 )
azurerm_app_configuration_feature - update percentage_filter_value to accept

correct type of float (#23263 )


azurerm_container_app - fix an issue with commands and args being overwritten

when using multiple containers (#23338 )


azurerm_key_vault_certificate - fix issue where certificates couldn't be recovered

anymore (#23204 )
azurerm_key_vault_key - the ForceNew when expiration_date is removed from

the config file (#23327 )


azurerm_linux_function_app - fix a bug in setting the storage settings when using

Elastic Premium plans (#21212 )


azurerm_linux_web_app - fix docker app stack update (#23303 )
azurerm_linux_web_app - fix crash in auto heal expansion (#21328 )
azurerm_linux_web_app_slot - fix docker app stack update (#23303 )
azurerm_linux_web_app_slot - fix crash in auto heal expansion (#21328 )
azurerm_log_analytics_solution - fix bug where the resource wasn't handling

successful creation on subsequent applies (#23312 )


azurerm_management_group_subscription_association - fix bug to correctly mark

resource as gone if not found during read (#23335 )


azurerm_mssql_elasticpool - remove check that prevents license_type from being

set for certain skus (#23262 )


azurerm_servicebus_queue - fixing an issue where auto_delete_on_idle couldn't be
set to P10675199DT2H48M5.4775807S (#23296 )
azurerm_servicebus_topic - fixing an issue where auto_delete_on_idle couldn't be

set to P10675199DT2H48M5.4775807S (#23296 )


azurerm_storage_account - prevent sending unsupported blob properties in

payload for Storage account kind (#23288 )


azurerm_synapse_sql_pool - expose storage_account_type (#23217 )
azurerm_windows_function_app - fix a bug in setting the storage settings when

using Elastic Premium plans (#21212 )


azurerm_windows_web_app - fix docker app stack update (#23303 )
azurerm_windows_web_app_slot - fix docker app stack update (#23303 )

DEPRECATIONS:

azurerm_application_gateway - deprecate Standard and WAF skus (#23310 )


azurerm_bot_channel_web_chat - deprecate site_names in favour of site block

(#23161 )
azurerm_monitor_diagnostic_setting - deprecate retention_policy in favour of

azurerm_storage_management_policy (#23260 )
3.73.0 (September 14, 2023)
FEATURES:

New Resource: azurerm_iothub_endpoint_cosmosdb_account (#23065 )


New Resource: azurerm_virtual_hub_routing_intent (#23138 )

ENHANCEMENTS:

dependencies: updating to v0.1.1 of github.com/btubbs/datetime (#23221 )


dependencies: updating to v1.3.1 of github.com/google/uuid (#23221 )
dependencies: updating to v0.61.0 of github.com/hashicorp/go-azure-helpers
(#23249 )
dependencies: updating to v0.20230907.1113401 of github.com/hashicorp/go-
azure-sdk (#23221 )
dependencies: updating to v1.5.0 of github.com/hashicorp/go-hclog (#23221 )
dependencies: updating to v2.29.0 of github.com/hashicorp/terraform-plugin-
sdk/v2 (#23221 )
dependencies: updating to v1.5.1 of github.com/hashicorp/terraform-plugin-
testing (#23221 )
dependencies: updating to v1.20.2 of github.com/rickb777/date (#23221 )
dependencies: updating to v0.13.0 of golang.org/x/crypto (#23221 )
dependencies: updating to v0.15.0 of golang.org/x/net (#23221 )
dependencies: updating to v0.13.0 of golang.org/x/tools (#23221 )
azurerm_bot_channel_ms_teams - support for deployment_environment (#23122 )
azurerm_managed_disk - updating to use API Version 2023-04-02 (#23233 )
azurerm_managed_disk - support for optimized_frequent_attach_enabled

(#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

Hyperscale sku (#23256 )


azurerm_security_center_assessment_policy - refactoring to use hashicorp/go-

azure-sdk (#23158 )

BUG FIXES:

azurerm_api_management - split create and update methods (#23259 )


azurerm_api_management_backend - fixing a panic when flattening the credentials

block (#23219 )
azurerm_key_vault_certificate - fixing a regression where certificates from a

custom/unknown issuer would be polled indefinitely (#23214 )


azurerm_redis_cache - prevent sending redis_configuration.aof_backup_enabled

when the sku is not Premium to avoid API error (#22774 )


azurerm_web_application_firewall_policy - capture and toggle state of

custom_rule blocks with an enabled field (#23163 )

3.72.0 (September 07, 2023)


FEATURES:

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:

dependencies: updating to v0.20230906.1160501 of github.com/hashicorp/go-


azure-sdk (#23191 )
containerapps : updating to API Version 2023-05-01 (#22804 )
keyvault : upgrade remaining resources to 2023-02-01 (#23089 )
redisenterprise : updating to API Version 2023-07-01 (#23178 )
vpngateway : updating to use hashicorp/go-azure-sdk (#22906 )
internal/sdk : typed resources using a custom importer now get a timed context

(#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 ,

outbound_route_map_id , and static_vnet_local_route_override_criteria


properties (#23049 )

BUG FIXES:

azurerm_api_management_api_policy - added state migration to mutate id's ending

in policies/policy (#23128 )
azurerm_api_management_api_operation_policy - added state migration to mutate

id's ending in policies/policy (#23128 )


azurerm_api_management_product_policy - added state migration to mutate id's

ending in policies/policy (#23128 )


azurerm_automation_account - fixes logic for local_authentication_enabled

(#23082 )
azurerm_key_vault_managed_storage_account - check id can be parsed correctly

before setting it in state (#23022 )


azurerm_monitor_diagnostic_setting - fix enabled_log feature flagged schema

(#23093 )
azurerm_pim_active_role_assignment : polling for the duration of the timeout,

rather than a fixed 5 minute value (#22932 )


azurerm_policy_set_definition - only sending parameters when a value is

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

replicated items now can be updated (#23199 )

DEPRECATION:

Data Source: azure_monitor_log_profile - Azure is retiring Azure Log Profiles on


the 30th of September 2026 (#23146 )
azure_monitor_log_profile - Azure is retiring Azure Log Profiles on the 30th of

September 2026 (#23146 )

3.71.0 (August 24, 2023)


BREAKING CHANGES:

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:

New Resource: azurerm_databricks_workspace_root_dbfs_customer_managed_key


(#22579 )

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

rather than Azure/go-autorest (#22579 )


webpubsub : updating to use the transport layer from hashicorp/go-azure-sdk rather

than Azure/go-autorest (#22579 )


automation : upgrade remaining resources to 2022-08-08 (#22989 )
azurerm_storage_management_policy - move to hashicorp/go-azure-sdk (#23035 )
Data Source: azurerm_disk_encryption_set - support for the identity block
(#23005 )
azurerm_container_group - support for the sku and (init_)container.*.security

properties (#23034 )
azurerm_kubernetes_cluster - extend allowed ranges for various sysctl_config

attribute ranges (#23077 )


azurerm_kubernetes_cluster_node_pool - extend allowed ranges for various

sysctl_config attribute ranges (#23077 )


azurerm_kubernetes_cluster - clusters can be updated to use the cilium

dataplane by setting the value in ebpf_data_plane (#22952 )


azurerm_linux_virtual_machine_scale_set - cancel rolling upgrades that are in

progress before destroying the resource (#22991 )


azurerm_servicebus_namespace - support for network_rule_set block (#23057 )
azurerm_windows_virtual_machine_scale_set - cancel rolling upgrades that are in

progress before destroying the resource (#22991 )


azurerm_synapse_spark_pool - support addtional values for the node_size_family

property (#23040 )

BUG FIXES:

azurerm_api_management_policy - fixes an error caused by a migration (#23018 )


azurerm_kubernetes_cluster - deprecate public_network_access_enabled and

prevent sending it to the API since it isn't functional (#22478 )

3.70.0 (August 17, 2023)


FEATURES:

New Resource: azurerm_mssql_virtual_machine_availability_group_listener


(#22808 )
New Resource: azurerm_mssql_virtual_machine_group (#22808 )
ENHANCEMENTS:

dependencies: updating to v0.20230815.1165905 of github.com/hashicorp/go-


azure-sdk (#22981 )
apimanagement : updating to use hashicorp/go-azure-sdk (#22783 )
cosmos : updating to use the base layer from hashicorp/go-azure-sdk rather than

Azure/go-autorest (#22874 )
devtestlabs : updating to use the base layer from hashicorp/go-azure-sdk rather

than Azure/go-autorest (#22981 )


policy : updating to use the base layer from hashicorp/go-azure-sdk rather than

Azure/go-autorest (#22874 )
postgresql : updating to use the base layer from hashicorp/go-azure-sdk rather

than Azure/go-autorest (#22874 )


recoveryservices : updating to use the base layer from hashicorp/go-azure-sdk

rather than Azure/go-autorest (#22874 )


resources : updating to use the base layer from hashicorp/go-azure-sdk rather

than Azure/go-autorest (#22874 )


storage : updating Storage Account and Storage Blob Container to use Common

IDs to enable migrating to hashicorp/go-azure-sdk in the future (#22915 )


Data Source: azurerm_kubernetes_cluster - add support for the
current_kubernetes_version property (#22986 )
azurerm_mssql_virtual_machine - add support for the
sql_virtual_machine_group_id and wsfc_domain_credential properties (#22808 )
azurerm_netapp_pool - size_in_tb can be sized down to 2 TB (#22943 )
azurerm_stack_hci_cluster - add support for the automanage_configuration_id

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:

azurerm_cognitive_deployment - add lock on parent resource to prevent errors

when deleting the resource (#22940 )


azurerm_cost_management_scheduled_action - fix update for email_address_sender

(#22930 )
azurerm_disk_encryption_set - now correctly supports key rotation by specifying a

versionless Key ID when setting auto_key_rotation_enabled to true (#22893 )


azurerm_iothub_dps - updating the validation for target within the
ip_filter_rule block to match the values defined in the Azure API Definitions

(#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

overwriting property values (#22966 )


azurerm_virtual_network_gateway_connection - custom_bgp_addresses.secondary is

now Optional rather than Required (#22912 )


azurerm_web_application_firewall_policy - fix handling not found in read

(#22982 )

3.69.0 (August 10, 2023)


FEATURES:

New Data Source: azurerm_palo_alto_local_rulestack (#22700 )


New Resource: azurerm_graph_services_account (#22665 )
New Resource: azurerm_managed_lustre_file_system (#22680 )
New Resource: azurerm_palo_alto_local_rulestack (#22700 )
New Resource: azurerm_palo_alto_local_rulestack_certificate (#22700 )
New Resource: azurerm_palo_alto_local_rulestack_fqdn_list (#22700 )
New Resource:
azurerm_palo_alto_local_rulestack_outbound_trust_certificate_association

(#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:

dependencies: updating to v0.58.0 of github.com/hashicorp/go-azure-helpers


(#22813 )
dependencies: updating to v0.20230808.1103829 of github.com/hashicorp/go-
azure-sdk (#22860 )
arckubernetes - updating to use the hashicorp/go-azure-sdk rather than

Azure/go-autorest as a base layer (#22815 )


bot - updating to use the hashicorp/go-azure-sdk rather than Azure/go-autorest

as a base layer (#22815 )


blueprints : updating to use hashicorp/go-azure-sdk (#21569 )
compute - updating to use the hashicorp/go-azure-sdk rather than Azure/go-

autorest as a base layer (#22860 )


digitaltwins - updating to API Version 2023-01-31 (#22782 )
hsm - updating to use the hashicorp/go-azure-sdk rather than Azure/go-autorest

as a base layer (#22815 )


hybridcompute - updating to use the hashicorp/go-azure-sdk rather than

Azure/go-autorest as a base layer (#22815 )


Data Source: azurerm_network_service_tags - updating to use hashicorp/go-azure-
sdk (#22873 )
Data Source: azurerm_network_watcher - updating to use hashicorp/go-azure-sdk
(#22873 )
azurerm_container_app_environment - log_analytics_workspace_id is now an

Optional property (#22733 )


azurerm_digital_twins_instance - support for User Assigned Identities (#22782 )
azurerm_function_app_function - hyphen and underscore are now allows

characters for function names (#22519 )


azurerm_key_vault_certificate - Support update of certificates based on
certificate_policy (#20627 )
azurerm_kubernetes_cluster - export the identity for Web App Routing under
web_app_routing_identity (#22809 )
azurerm_kubernetes_cluster - add support for the snapshot_id property in the
default_node_pool block (#22708 )
azurerm_log_analytics_workspace - support changing value of sku from
CapacityReservation and PerGB2018 (#22597 )
azurerm_managed_application - deprecate the parameters property in favour of

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

public_network_access_enabled property (#22542 )


azurerm_virtual_machine_packet_capture - updating to use hashicorp/go-azure-
sdk (#22873 )
azurerm_virtual_machine_scale_set_packet_capture - updating to use
hashicorp/go-azure-sdk (#22873 )
azurerm_vpn_gateway_connection - updating to use hashicorp/go-azure-sdk

(#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:

Data Source: azurerm_virutal_machine - correctly retrieve and set value for


power_state (#22851 )
azurerm_cdn_endpoint - conditionally using PUT in place of PATCH when a field

other than tags has changed (#22662 )


azurerm_cdn_frontdoor_security_policy - normalizing the value returned from the

API for cdn_frontdoor_domain_id (#22841 )


azurerm_container_group - set init_container.secure_environment_variables into

state correctly (#22832 )


azurerm_custom_ip_prefix - support for environments other than Azure Public

(#22812 )
azurerm_databricks_workspace - update parse function for

machine_learning_workspace_id field validation (#22865 )


azurerm_key_vault - fixing support for the storage Nested Item type (#22707 )
azurerm_kusto_cosmosdb_data_connection_resource - ensure the subscriptionId

and ResourceGroupName align with the CosmosDB container (#22663 )


azurerm_managed_application - fix an issue where secureString parameters were

not persisted to state (#21541 )


azurerm_managed_application - the plan block is now marked ForceNew to comply

with service limitations (#21541 )


azurerm_monitor_data_collection_rule - recreate resource when attempting to
remove kind (#22811 )
azurerm_static_site_custom_domain - prevent overwriting validation_token with

an empty value by setting it into state when creating the resource (#22848 )

3.68.0 (August 03, 2023)


FEATURES:

New Resource: azurerm_custom_ip_prefix (#21322 )


New Resource:: azurerm_mobile_network_sim (#22628 )
New Data Source: azurerm_mobile_network_sim (#22628 )
New Resource: azurerm_automation_variable_object (#22644 )
New Data Source: azurerm_automation_variable_object (#22644 )

ENHANCEMENTS

dependencies: updating to v0.20230803.1095722 of github.com/hashicorp/go-


azure-sdk (#22803 )
dependencies: migrate mysql resources to hashicorp/go-azure-sdk (#22795 )
advisor : updating the base layer to use hashicorp/go-azure-sdk rather than

Azure/go-autorest (#22750 )
apimanagement : updating to use the base layer from hashicorp/go-azure-sdk rather

than Azure/go-autorest (#22759 )


analysisservices : updating the base layer to use hashicorp/go-azure-sdk rather

than Azure/go-autorest (#22750 )


automation : updating dscnodeconfiguration and sourcecontrol to use API Version
2022-08-08 (#22781 )
azurestackhci : updating the base layer to use hashicorp/go-azure-sdk rather than

Azure/go-autorest (#22750 )
domainservices : updating the base layer to use hashicorp/go-azure-sdk rather

than Azure/go-autorest (#22750 )


eventgrid : refactoring to use hashicorp/go-azure-sdk (#22673 )
machinelearningservice : updating to use API Version 2023-04-01 (#22729 )
monitor : updating the base layer to use hashicorp/go-azure-sdk rather than
Azure/go-autorest (#22750 )
network : updating to use API Version 2023-04-01 (#22727 )
relay : updating to use API Version 2021-11-01 (#22725 )
Data Source: azurerm_images - support for disk_encryption_set_id (#22690 )
azurerm_eventhub_namespace_customer_managed_key - support for the
infrastructure_encryption_enabled property (#22718 )
azurerm_hpc_cache_blob_nfs_target - support for setting the usage_model property

to READ_ONLY and READ_WRITE (#22798 )


azurerm_hpc_cache_nfs_target - support for setting the usage_model property to
READ_ONLY and READ_WRITE (#22798 )
azurerm_monitor_aad_diagnostic_setting - updating to use hashicorp/go-azure-

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

provider: only obtaining an authentication token for Managed HSM in


environments where Managed HSM is available (#22400 )
azurerm_api_management - retrieving the location from the API rather than the

config prior to deletion (#22752 )


azurerm_cognitive_deployment - add locks to parent resource to prevent 409 error

(#22711 )
azurerm_pim_eligible_role_assignment - fixing a bug where the context deadline

was checked incorrectly during deletion (#22756 )


azurerm_private_endpoint - loading the subnet to lock from the API rather than

the config during deletion (#22676 )


azurerm_netapp_volume - updating the validation of security_style to match the

casing defined in the Azure API Definitions (#22721 )


azurerm_netapp_volume_group_sap_hana - update the validation of security_style

to match the casing defined in the Azure API Definitions (#22615 )


azurerm_site_recovery_replication_recovery_plan - fix update for
boot_recovery_group , failover_recovery_group and shutdown_recovery_group

(#22687 )

3.67.0 (July 27, 2023)


FEATURES:

New Data Source: azurerm_eventhub_sas (#22215 )


New Resource: azurerm_kubernetes_cluster_trusted_access_role_binding
(#22647 )
New Resource: azurerm_marketplace_role_assignment (#22398 )
New Resource: azurerm_network_function_azure_traffic_collector (#22274 )

ENHANCEMENTS:

dependencies: updating to v0.20230726.1135558 of github.com/hashicorp/go-


azure-sdk (#22698 )
connections : updating to use the base layer from hashicorp/go-azure-sdk rather

than Azure/go-autorest (#22681 )


iothub : updating to use the base layer from hashicorp/go-azure-sdk rather than
Azure/go-autorest (#22681 )
mysql : updating to use the base layer from hashicorp/go-azure-sdk rather than
Azure/go-autorest (#22681 )
orbital : updating to use the base layer from hashicorp/go-azure-sdk rather than

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

than Azure/go-autorest (#22681 )


purview : updating to use the base layer from hashicorp/go-azure-sdk rather than

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

version is set to Latest (#22683 )


azurerm_image - support for the field disk_encryption_set_id within the os_disk

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

Version 2023-02-01 (#22479 )


azurerm_redis_enterprise_database - support redisSON module for geo-

replication (#22627 )
azurerm_windows_virtual_machine - add support for the

bypass_platform_safety_checks_on_user_schedule_enabled and reboot_setting


properties (#22349 )

BUG FIXES:

azurerm_cosmosdb_account - type within the backup block is updated separately

when set to Continuous (#22638 )


azurerm_cosmosdb_account - max_age_in_seconds within the cors_rule block is now

Optional and can now be configured up to 2147483647 (#22552 )


azurerm_maintenance_configuration - fixing a bug where include and exclude were

set incorrectly (#22671 )


azurerm_pim_eligible_role_assignment - polling for the duration of the timeout,

rather than using a hard-coded value (#22682 )


azurerm_redis_cache - only updating patch_schedule when it has changed in the

config file (#22661 )


azurerm_logic_app_standard - attribute auto_swap_slot_name is now under correct

block site_config (#22712 )


azurerm_postgresql_flexible_server - update the validation of storage_mb

replacing 33554432 with 33553408 (#22706 )


3.66.0 (July 20, 2023)
FEATURES:

New Data Source: azurerm_mobile_network_attached_data_network (#22168 )


New Resource: azurerm_graph_account (#22334 )
New Resource: azurerm_mobile_network_attached_data_network (#22168 )

ENHANCEMENTS:

dependencies: bump go-azure-sdk to v0.20230720.1190320 and switch


machinelearning , mixedreality , mariadb , storagecache , storagepool , vmware ,
videoanalyzer , voiceServices and mobilenetwork to new base layer (#22538 )
dependencies: move azurerm_bastion_host and
azurerm_network_connection_monitor over to hashicorp/go-azure-sdk (#22425 )
dependencies: move azurerm_network_watcher_flow_log to hashicorp/go-azure-
sdk (#22575 )
dependencies: move mysql resources over to hashicorp/go-azure-sdk (#22528 )
dependencies: move storage_sync resources over to hashicorp/go-azure-sdk
(#21928 )
dependencies: updating to API Version 2022-08-08 (#22440 )
postgres - updating to API Version 2023-03-01-preview (#22577 )
data.azurerm_route_table - support for the bgp_route_propagation_enabled

property (#21940 )
data.azurerm_servicebus_* - add deprecation messages for the

resource_group_name and namespace_name properties (#22521 )


azurerm_cdn_frontdoor_rule - allow the
conditions.x.url_path_condition.x.match_values property to be set to /

(#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

changed without creating a new resource (#22557 )


azurerm_postgresql_flexible_server - support for 33554432 storage (#22574 )
azurerm_postgresql_flexible_server - support for the
geo_backup_key_vault_key_id and geo_backup_user_assigned_identity_id

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:

provider: the Resource Providers Microsoft.Kubernetes and


Microsoft.KubernetesConfiguration are no longer automatically registered

(#22580 )
data.automation_account_variables - correctly populate missing variable attributes

(#22611 )
data.azurerm_virtual_machine_scale_set - fix an issue where computer_name ,

latest_model_applied , power_state and virtual_machine_id attributes were not

correctly set (#22566 )


azurerm_app_service_public_certificate - poll for certificate during read to get

around an eventual consistency bug (#22587 )


azurerm_application_gateway - send min_protocol_version and correct

policy_type when using CustomV2 (#22535 )


azurerm_cognitive_deployment - remove upper limit on validation for the capacity

property in the scale block (#22502 )


azurerm_cosmosdb_account - fixed regression to default_identity_type being

switched to FirstPartyIdentity on update (#22609 )


azurerm_kubernetes_cluster - the windows_profile.admin_password property will

become Required in v4.0 (#22554 )


azurerm_kusto_cluster - the engine property is deprecataed and is now non

functional as the service team intends to remove it from the API (#22497 )
azurerm_maintenance_configuration - tge package_names_mask_to_exclude and

package_names_mask_to_exclude properties are not set properly (#22555 )


azurerm_redis_cache - only set the rdb_backup_enabled property when using a

premium SKU (#22309 )


azurerm_site_recovery_replication_recovery_plan - fix an issue where the order of

boot recovery groups was not correctly maintained (#22348 )


azurerm_synapse_firewall_rule - correct an overly strict validation for the name

property (#22571 )

3.65.0 (July 13, 2023)


FEATURES:

New Data Source: azurerm_communication_service (#22426 )


ENHANCEMENTS:

dependencies: updating to v0.20230712.1084117 of github.com/hashicorp/go-


azure-sdk (#22491 )
dependencies: updating to v0.20230703.1101016 of
github.com/tombuildsstuff/kermit (#22390 )
provider: the Resource Providers Microsoft.Kubernetes and
Microsoft.KubernetesConfiguration are now automatically registered (#22463 )
automation/dscconfiguration - updating to API Version 2022-08-08 (#22403 )
azurestackhcl - updating to API Version 2023-03-01 (#22411 )
batch - updating to use API Version 2023-05-01 (#22412 )
datafactory - moving azurerm_data_factory and
azurerm_data_factory_managed_private_endpoint over to hashicorp/go-azure-sdk

(#22409 )
elastic - updating to API Version 2023-06-01 (#22451 )
kusto - updating to API Version 2023-05-02 [GH-22410

managedapplications - migrate to hashicorp/go-azure-sdk (#21571 )


privatedns : updating to API Version 2020-06-01 (#22470 )
storage - updating to Data Plane API Version 2020-08-04 (#22405 )
network - application_security_group and private_endpoint now use

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

support a maximum value of 300 (#22511 )


azurerm_dns_zone - can now use the host_name property with dns_zone for
soa_record creation (#22312 )
azurerm_kubernetes_cluster - add support for the
internal_ingress_gateway_enabled and external_ingress_gateway_enabled

properties (#22393 )
azurerm_site_recovery_vmware_replication_policy_association - update validation

to correctly handle case (#22443 )

3.64.0 (July 06, 2023)


FEATURES:

New Data Source: azurerm_automation_variables (#22216 )


New Resource: azurerm_arc_private_link_scope (#22314 )
New Resource: azurerm_kusto_cosmosdb_data_connection (#22295 )
New Resource: azurerm_pim_active_role_assignment (#20731 )
New Resource: azurerm_pim_eligible_role_assignment (#20731 )

ENHANCEMENTS:

dependencies: web : updating to API Version 2022-09-01 (#22352 )


dependencies: cognitive : updating to API Version 2023-05-01 (#22223 )
dependencies: updating to v1.53.0 of google.golang.org/grpc (#22383 )
azurerm_cognitive_deployment - suppot for the scale block propeties tier , size ,
family , and capacity (#22223 )
azurerm_linux_function_app - added support for the
public_network_access_enabled property (#22352 )
azurerm_linux_function_app_slot - added support for the

public_network_access_enabled property (#22352 )


azurerm_linux_web_app - added support for the public_network_access_enabled

property (#22352 )
azurerm_linux_web_app_slot - added support for the

public_network_access_enabled property (#22352 )


azurerm_windows_function_app - added support for the
public_network_access_enabled property (#22352 )
azurerm_windows_function_app_slot - added support for the
public_network_access_enabled property

azurerm_windows_web_app - added support for the public_network_access_enabled

property (#22352 )
azurerm_windows_web_app_slot - added support for the

public_network_access_enabled property (#22352 )


azurerm_stream_analytics_output_blob - increase the batch_min_rows property

allowed values to 1000000 (#22331 )


azurerm_spring_cloud_gateway - support for the the allowed_origin_patterns

property (#22317 )

BUG FIXES:

Data Source azurerm_virtual_machine_scale_set - prevent a nil pointer panic


during reads (#22335 )
azurerm_application_insights_api_key - prevent a nil pointer panic (#22388 )
azurerm_linux_function_app - the allowed_origins property in the cors block

now has a minimum entry count of 1 (#22352 )


azurerm_linux_function_app_slot - the allowed_origins property in the cors

block now has a minimum entry count of 1 (#22352 )


azurerm_linux_web_app - the allowed_origins property in the cors block now has

a minimum entry count of 1 (#22352 )


azurerm_linux_web_app - prevent a nil pointer panic in docker settings processing

(#22347 )
azurerm_linux_web_app_slot - the allowed_origins property in the cors block

now has a minimum entry count of 1 (#22352 )


azurerm_private_dns_resolver_forwarding_rule_resource - changing the

domain_name property now creates a new resource (#22375 )


azurerm_windows_function_app - the allowed_origins property in the cors block

now has a minimum entry count of 1 (#22352 )


azurerm_windows_function_app_slot - the allowed_origins property in the cors

block now has a minimum entry count of 1 (#22352 )


azurerm_windows_web_app - the allowed_origins property in the cors block now

has a minimum entry count of 1 (#22352 )


azurerm_windows_web_app_slot - the allowed_origins property in the cors block

now has a minimum entry count of 1 (#22352 )


azurerm_network_security_rule - improve validation of the name property and

prevent creation of resources that are broken (#22336 )

DEPRECATION:

media - all resources and data sources are deprecated ahead of service being

retired (#22350 )

3.63.0 (June 29, 2023)


FEATURES:

New Data Source: azurerm_network_manager_network_group (#22277 )

BREAKING CHANGES:

azurerm_linux_web_app - the win32_status property of the status_code block in

auto_heal has changed from string to int . (#22003 )


azurerm_linux_web_app_slot -the win32_status property of the status_code block

in auto_heal has changed from string to int . (#22003 )


azurerm_windows_web_app - the win32_status property of the status_code block in
auto_heal has changed from string to int . (#22003 )
azurerm_windows_web_app_slot - the win32_status property of the status_code

block in auto_heal has changed from string to int . (#22003 )

ENHANCEMENTS:

dependencies: updating to v0.20230623.1103505 of github.com/hashicorp/go-


azure-sdk (#22263 )
dependencies: updating to v0.57.0 of github.com/hashicorp/go-azure-helpers
(#22247 )
dependencies: containers/containerinstance : updating to API Version 2023-05-01
(#22276 )
dependencies: network/securityrules : migrate to go-azure-sdk (#22242 )
dependencies: redis : updating to API Version 2023-04-01 (#22285 )
Data Source: azurerm_kubernetes_cluster - add support for the
custom_ca_trust_certificates_base64 property (#22032 )
azurerm_automation_software_update_configuration - the duration property now

defaults to PT2H as per the service. (#22204 )


azurerm_automation_software_update_configuration - the schedule block is now

limited to 1 , to match the API limit. (#22204 )


azurerm_automation_software_update_configuration - the schedule block is now

Required to match the API specification. The API rejects requests that do not

specify this block, with at least a frequency value. (#22204 )


azurerm_automation_software_update_configuration - the frequency property is

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

limited to 1 to match the API. (#22204 )


azurerm_automation_software_update_configuration - the post_task blocks are

now limited to 1 to match the API. (#22204 )


azurerm_automation_software_update_configuration - the operating_system

property is deprecated and is now controlled by the presence of either a linux or


windows block. (#22204 )
azurerm_automation_software_update_configuration - one of the linux or windows

blocks must now be present. This is a requirement of the API, so is a non-breaking


Optional to Required change. (#22204 )
azurerm_automation_software_update_configuration - the monthly_occurrence

blocks are now limited to 1 to match the API. (#22204 )


azurerm_container_app - support for both system and user assigned identities at

the same time (#21149 )


azurerm_key_vault_managed_hardware_security_module - support for activating an

HSM through security_domain_key_vault_certificate_ids (#22162 )


azurerm_kubernetes_cluster - support for the

custom_ca_trust_certificates_base64 property (#22032 )


azurerm_kubernetes_cluster - support for the maintenance_window_auto_upgrade

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:

azurerm_automation_schedule - prevent diffs for the expiry_time property when it

isn't set in the user's configuration (#21886 )


azurerm_frontdoor - throw an error if the resource cannot be found during an

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

during an update (#21975 )


azurerm_linux_web_app - deprecated the docker_image and docker_image_tag

properties in favour of docker_image_name , docker_registry_url ,


docker_registry_username , and docker_registry_password . These settings now

manage the respective app_settings values of the same name. (#22003 )


azurerm_linux_web_app_slot - deprecated the docker_image and docker_image_tag

properties in favour of docker_image_name , docker_registry_url ,


docker_registry_username , and docker_registry_password . These settings now

manage the respective app_settings values of the same name. (#22003 )


azurerm_site_recovery_replicated_vm - set the
network_interface.failover_test_subnet_name ,
network_interface.failover_test_public_ip_address_id and
network_interface.failover_test_static_ip properties correctly (#22217 )
azurerm_ssh_public_key - throw an error if the resource cannot be found during an

update (#21975 )
azurerm_storage_share - revert the resource ID format back to what it was

previously due to a discrepancy in the API and Portal (#22271 )


azurerm_storage_account - the last_access_time_enabled and

container_delete_retention_policy properties are now supported in

usgovernment (#22273 )
azurerm_windows_virtual_machine - reaise an error if the resource cannot be found

during an update (#21975 )


azurerm_windows_web_app - deprecated the docker_container_registry ,

docker_container_name , and docker_container_tag properties in favour of


docker_image_name , docker_registry_url , docker_registry_username , and

docker_registry_password . These settings now manage the respective

app_settings values of the same name. (#22003 )


azurerm_windows_web_app_slot - deprecated the docker_container_registry ,

docker_container_name , and docker_container_tag properties in favour of


docker_image_name , docker_registry_url , docker_registry_username , and

docker_registry_password . These settings now manage the respective

app_settings values of the same name. (#22003 )

3.62.1 (June 22, 2023)


BUG FIXES:

dependencies: compute/marketplace_agreement - Downgrade API version to 2015-06-


01 [GH-22264]

3.62.0 (June 22, 2023)


FEATURES:

New Resource: azurerm_new_relic_monitor (#21958 )

ENHANCEMENTS:

dependencies: updating to v0.20230614.1151152 of github.com/hashicorp/go-


azure-sdk (#22176 )
dependencies: compute/marketplace_agreement - swap to use hashicorp/go-azure-
sdk (#21938 )
dependencies: network/manager - swap to use hashicorp/go-azure-sdk (#22119 )
dependencies: network/route - swap to use hashicorp/go-azure-sdk (#22227 )
azurerm_cosmosdb_gremlin_graph - support for the analytical_storage_ttl

property (#22179 )
azurerm_kubernetes_cluster - support for the value AzureLinux for the field

os_sku within the default_node_pool block (#22139 )


azurerm_kubernetes_cluster - support for the property node_os_channel_upgrade

(#22187 )
azurerm_kubernetes_cluster_node_pool - support for the value AzureLinux for the

field os_sku (#22139 )


azurerm_monitor_workspace - support for public_network_access_enabled

(#22197 )
azurerm_virtual_hub - support for virtual_router_auto_scale_min_capacity

(#21614 )

BUG FIXES:

azurerm_application_insights_workbook - the display_name property can now be

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

but was being sent as TypeNone to the api (#22165 )


azurerm_bastion_host - the ip_configuration propery is now required (#22154 )

3.61.0 (June 12, 2023)


FEATURES:

New Data Source: azurerm_mobile_network_packet_core_data_plane (#21053 )


New Resource: azurerm_arc_machine_extension (#22051 )
New Resource: azurerm_arc_kubernetes_flux_configuration (#21579 )
New Resource: azurerm_kubernetes_flux_configuration (#21579 )
New Resource: azurerm_mobile_network_packet_core_data_plane (#21053 )

ENHANCEMENTS:

dependencies: updating to v0.20230530.1150329 of


github.com/tombuildsstuff/kermit (#21980 )
dependencies: compute/gallery : updating to API Version 2022-03-03 (#21999 )
dependencies: kusto : updating to API Version 2022-12-29 (#21961 )
Data Source azurerm_site_recovery_replication_recovery_plan - add support for
azure_to_azure_settings block (#22098 )
compute : updating to use API Version 2023-03-01 (#21980 )
containers : updating to use API version 2023-04-02-preview [22048]

managedidentity : updating to use API Version 2023-01-31 (#22102 )


azurerm_backup_protected_vm - support for the protection_state property

(#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 ,

and key_vault_secret_id proeprties can now be updated (#22100 )


azurerm_spring_cloud_gateway - support for the client_authentication property

(#22016 )

BUG FIXES:

azurerm_databricks_workspace_data_source - correctly set the managed_idnetity_id

attribute (#22021 )

3.60.0 (June 08, 2023)


NOTES:

azurerm_security_center_subscription_pricing - upon deletion the pricing tier

now resets to Free tier (#21437 )

ENHANCEMENTS:

dependencies: batch : updating to API Version 2022-10-01 (#21962 )


dependencies: loadtest : updating to API Version 2022-12-01 (#22091 )
provider: adding the client_id_file_path and client_secret_file_path provider
properties (#21764 )
data.azurerm_key_vault_encrypted_value - now exports the

decoded_plain_text_value [attribute GH-21682]

azurerm_automanage_configuration - support for the backup and


azure_security_baseline blocks (#22081 )
azurerm_app_configuration - support toggling of user permission error on soft

deleted stores through app_configuration.recover_soft_deleted feature flag


(#19661 )
azurerm_backup_policy_file_share - support for day-based retention policies and

hourly backups (#21529 )


azurerm_linux_function_app - support for Python 3.11 for Linux function app

(#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

and post_action properties is now respected (#22019 )

BUG FIXES:

azurerm_hdinsight_interactive_query_cluster - deprecating the


*_node.0.autoscale.0.capacity property (#21981 )
azurerm_key_vault_key - allow the rotation_policy property to be removed

(#21935 )
azurerm_mssql_server - fix issue where the minimum_tls_version property is being

returned as None instead of Disabled (#22067 )


azurerm_sentinel_data_connector_microsoft_threat_intelligence - the

bing_safety_phishing_url_lookback_date property is deprecated (#21954 )

3.59.0 (June 01, 2023)


FEATURES:
New Data Source: azurerm_arc_machine (#21796 )
New Resource: azurerm_automanage_configuration (#21490 )

ENHANCEMENTS:

dependencies: updating to v0.20230523.1140858 of github.com/hashicorp/go-


azure-sdk (#21910 )
dependencies: azurem_monitor_action_group - upgrading actiongroupsapis from
2021-09-01 to 2023-01-01 (#21948 )
dependencies: policy.guestconfigurationassignments : migrate to hashicorp/go-
azure-sdk (#21927 )
dependencies: azurerm_monitor_autoscale_setting upgrade API version from to
2023-05-01-preview (#21953 )
data.azurerm_linux_web_app - now exports the availability and usage attributes

(#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 ,

only_critical_addons_enabled , os_disk_size_gb , os_disk_type , os_sku ,

pod_subnet_id , ultra_ssd_enabled , vnet_subnet_id and zones are now updateable

through cycling of the system node pool (#21719 )


azurerm_machine_learning_compute_cluster - add support for the
node_public_ip_enabled property (#21377 )
azurerm_nginx_certificate - key_vault_secret_id now accepts version-less key

vault secret ids (#21949 )


azurerm_postgresql_flexible_server - add support for version value 15

(#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:

azurerm_app_configuration - prevent errors when deleting by checking that the

name of the app configuration store is released (#21750 )


azurerm_express_route_port_authorization - add a lock when

create/update/delete authorization of express route port (#21959 )


azurerm_kubernetes_cluster - recompute the field oidc_issuer_url if the value of

oidc_issuer_enabled has changed (#21911 )


azurerm_kubernetes_cluster - set correct value for default_node_pool.os_sku

when resizing the default_node_pool (#21976 )


azurerm_postgresql_flexible_server - fix issue updating storage_mb and

backup_retention_days together (#21987 )

3.58.0 (May 25, 2023)


FEATURES:

New data Source: azurerm_mobile_network_packet_core_control_plane (#21071 )


New Resource: azurerm_cosmosdb_mongo_role_definition (#21754 )
New Resource: azurerm_cosmosdb_mongo_user_definition (#21914 )
New Resource: azurerm_iothub_file_upload (#20668 )
New Resource: azurerm_mobile_network_packet_core_control_plane (#21071 )
New Resource: azurerm_mysql_flexible_server_active_directory_administrator
(#21786 )
New Resource: azurerm_monitor_alert_prometheus_rule_group (#21751 )
New Resource: azurerm_recovery_services_vault_resource_guard_association
(#21712 )
New Resource: azurerm_site_recovery_hyperv_network_mapping (#21788 )
New Resource: azurerm_site_recovery_vmware_replication_policy_association
(#21389 )

ENHANCEMENTS:

dependencies: updating to v0.20230523.1080931 of github.com/hashicorp/go-


azure-sdk (#21898 )
dependencies: updating to v0.20230518.1143920 of
github.com/tombuildsstuff/kermit (#21899 )
dependencies: azurerm_monitor_autoscale_setting upgrade API version from
2015-04-01 to 2022-10-01 (#21887 )
cosmosdb.gremlin : updating to use hashicorp/go-azure-sdk and api version 2023-

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

than Azure/go-autorest (#21810 )


azurerm_cosmosdb_account - fix for upstream Microsoft API issue where updating
identity and default_identity at the same time silently fails (#21780 )
azurerm_monitor_activity_log_alert - support for the levels ,

resource_providers , resource_types , resource_groups , resource_ids , statuses ,


and sub_statuses properties (#21367 )
azurerm_media_transform - support for the experimental_options property

(#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

be set to Microsoft.App/environments (#21893 )


azurerm_subnet_service_endpoint_policy - support for the service property

(#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

properties is now omitted when not specified (#21745 )


azurerm_subnet - permit Microsoft.BareMetal/AzureHostedService as an option for

the service_delegation property (#21871 )

3.57.0 (May 19, 2023)


FEATURES:

New Data Source: azurerm_virtual_hub_connection (#21681 )

ENHANCEMENTS:

synapse : refactoring to use tombuildsstuff/kermit rather than Azure/azure-sdk-

for-go for Data Plane (#21792 )


azurerm_batch_account - support versionless keys for CMK (#21677 )
azurerm_kubernetes_cluster - changing the http_proxy_config.no_proxy no longer

creates a new resource (#21793 )


azurerm_media_transform - support for the jpg_image and png_image blocks within

the custom_preset block (#21709 )


azurerm_recovery_services_vault - support the monitoring block (#21691 )

BUG FIXES:

data.azurerm_kubernetes_cluster - prevent a panic when some values returned

are nil (#21850 )

3.56.0 (May 11, 2023)


FEATURES:

New Resource: azurerm_cosmosdb_postgresql_coordinator_configuration


(#21595 )
New Resource: azurerm_cosmosdb_postgresql_node_configuration (#21596 )
New Resource: azurerm_cosmosdb_postgresql_role (#21597 )
New Resource: azurerm_monitor_workspace (#21598 )
New Resource: azurerm_network_manager_deployment (#20451 )

ENHANCEMENTS:

dependencies: updating to v0.56.0 of github.com/hashicorp/go-azure-helpers


(#21725 )
dependencies: updating to v0.20230511.1094507 of github.com/hashicorp/go-
azure-sdk (#21759 )
provider: improving the error messages when parsing a Resource ID and the ID
doesn't match what's expected (#21725 )
provider: Resource Provider Registration now uses API Version 2022-09-01
(#21695 )
provider: updating the IsAzureStack check to use hashicorp/go-azure-sdk rather
than relying on the environment from Azure/go-autorest (#21697 )
appconfiguration : updating to API Version 2023-03-01 (#21660 )
keyvault : refactoring to use hashicorp/go-azure-sdk (#21621 )
azurerm_machine_learning_workspace - exporting workspace_id (#21746 )
azurerm_mssql_server - expose the ability to enable Transparent Data Encryption

using a Customer Managed Key during server deployment (#21704 )


azurerm_orbital_contact_profile - ip_address is now optional (#21721 )

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

cause a crash (#21740 )


azurerm_eventhub_namespace - add locks and remove unneeded WaitForState

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

the vm_secrets block wouldn't be set into the state (#21680 )


azurerm_storage_share - correct resource ID segment from fileshares to shares

(#21645 )
azurerm_virtual_machine_scale_set , - - support specifying

ultra_ssd_disk_iops_read_write and ultra_ssd_disk_mbps_read_write for


PremiumV2_LRS (#21530 )

3.55.0 (May 04, 2023)


FEATURES:

New Data Source: azurerm_kubernetes_node_pool_snapshot (#21511 )


New Resource: azurerm_cosmosdb_postgresql_firewall_rule (#21599 )

ENHANCEMENTS:

appconfiguration : refactoring to use tombuildsstuff/kermit rather than an

embedded SDK (#21623 )


recoveryservicesbackup - updating to use API Version 2023-02-01 (#21575 )
azurerm_kubernetes_cluster_node_pool - support for the snapshot_id property

(#21511 )

BUG FIXES:

Data Source: azurerm_healthcare_fhir_service - identity now exports both


SystemAssigned and UserAssigned identities (#21594 )
azurerm_local_network_gateway - validating that address_space isn't set to an

empty string (#21566 )


azurerm_log_analytics_cluster - Add locks and remove unneeded WaitForState

checks (#21631 )
azurerm_log_analytics_cluster_customer_managed_key - Add locks and remove

unneeded WaitForState checks (#21631 )


azurerm_managed_disk - now detaches when disk_size_gb increases from below

4095 to above 4095 (#21620 )


Service mssqlmanagedinstance - add initialize of client.MSSQLManagedInstance to fix
panic (#21657 )
azurerm_virtual_machine - fixing a regression when parsing the OS Disk ID from

the Azure API (#21606 )


azurerm_virtual_machine - fixing a regression when parsing the Data Disk ID from

the Azure API (#21606 )

3.54.0 (April 27, 2023)


BREAKING CHANGES:

azurerm_attestation_provider - the field policy is deprecated and non-functional

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:

New Resource: azurerm_arc_kubernetes_cluster_extension (#21310 )


New Resource: azurerm_cosmosdb_postgresql_cluster (#21090 )
New Resource: azurerm_email_communication_service (#21526 )
New Resource: azurerm_kubernetes_cluster_extension (#21310 )
New Resource: azurerm_netapp_volume_group_sap_hana (#21290 )
New Resource: azurerm_storage_mover_project (#21477 )
New Resource: azurerm_storage_mover_job_definition (#21514 )

ENHANCEMENTS:

dependencies: updating to v0.20230427.1112058 of github.com/hashicorp/go-


azure-sdk (#21583 )
security : updating to API Version 2023-01-01 (#21531 )
Data Source: azurerm_virtual_network_gateway - add support for the field
private_ip_address (#21432 )
azurerm_active_directory_domain_service - domain_name now supports a length up

to 30 characters (#21555 )
azurerm_attestation_provider - adding support for the field

open_enclave_policy_base64 , sgx_enclave_policy_base64 and tpm_policy_base64

(#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

be set to TheLast7Days (#21528 )


azurerm_firewall_policy_rule_collection_group - the fields source_addresses and
destination_addresses now accepts an IPv4 range (#21542 )
azurerm_kubernetes_cluster - add support for the service_mesh_profile block

(#21516 )
azurerm_resource_group_cost_management_export - the field time_frame can now be

set to TheLast7Days (#21528 )


azurerm_search_service - adding support for authentication_failure_mode

(#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

set to TheLast7Days (#21528 )

BUG FIXES:

Provider: fix an authentication bug when specifying auxiliary_tenant_ids while


authenticating using Azure CLI (#21583 )
azurerm_attestation_provider - the field policy is deprecated and non-functional

- instead Use the fields open_enclave_policy_base64 , sgx_enclave_policy_base64


and tpm_policy_base64 (#21524 )
azurerm_mysql_flexible_server - fix issue where identity was not being removed

properly on updates (#21533 )


azurerm_search_service - updating the default value for partition_count to 1 to

match the API (#21323 )


azurerm_search_service - updating the default value for replica_count to 1 to

match the API (#21323 )


azurerm_search_service - the field allowed_ips is now a Set rather than a List

(#21323 )

3.53.0 (April 20, 2023)


FEATURES:
New Resource: azurerm_cost_management_scheduled_action (#21325 )
New Resource: azurerm_storage_mover_agent (#21273 )
New Resource: azurerm_storage_mover_source_endpoint (#21449 )
New Resource: azurerm_storage_mover_target_endpoint (#21449 )

ENHANCEMENTS:

advisor - refactoring to use hashicorp/go-azure-sdk (#21307 )


healthcare : refactoring to use hashicorp/go-azure-sdk (#21327 )
hpccache - refactoring to use hashicorp/go-azure-sdk (#21303 )
logz - refactoring to use hashicorp/go-azure-sdk (#21321 )
hpccache : updating to API Version 2023-01-01 (#21459 )
orbital : updating to API Version 2022-11-01 (#21405 )
vmware : updating to API Version 2022-05-01 (#21458 )
azurerm_attestation_provider - support for the policy block (#20972 )
azurerm_linux_function_app - support for the hosting_environment_id property

(#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

dynamic_criteria.0.ignore_data_before property isn't set (#21446 )


azurerm_postgresql_flexible_server - correctly set the

point_in_time_restore_time_in_utc property (#21501 )


azurerm_search_service - mark the primary_key and secondary_key properties as

sensitive (#21469 )

3.52.0 (April 13, 2023)


ENHANCEMENTS:

containerRegistry - refactoring to use hashicorp/go-azure-sdk (#21344 )


monitor - refactoring to use hashicorp/go-azure-sdk (#21392 )
recoveryServices - refactoring to use hashicorp/go-azure-sdk (#21344 )
Data Source: azurerm_key_vault_certificate - add support for
resource_manager_id and resource_manager_versionless_id (#21314 )
Data Source: azurerm_key_vault_secret - support for not_before_date and
expiration_date (#21359 )
Data Source: azurerm_key_vault_secret - support specifying the keyvault secret
version (#21336 )
azurerm_dashboard_grafana - support for UserAssigned identitiues (#21394 )
azurerm_key_vault_certificate - add support for resource_manager_id and
resource_manager_versionless_id (#21314 )
azurerm_linux_function_app - mark the site_credential block as Sensitive

(#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:

azurerm_app_configuration_key - extend timeout for polling resource to allow

propagation of read permission (#21337 )


azurerm_app_configuration_feature - extend timeout for polling resource to allow

propagation of read permission (#21337 )


azurerm_cdn_endpoint - the global_delivery_rule property must have at least one

action specified (#21403 )


azurerm_kubernetes_cluster - the enable_host_encryption properly is not set

when when resizing the default_node_pool (#21379 )


azurerm_linux_function_app - fix a crash in auth_v2 in active_directory_v2

(#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

Resource Providers (#21370 )


azurerm_subscription - fix an error during update (#21255 )
azurerm_windows_function_app - fix acrash in auth_v2 in active_directory_v2

(#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 )

3.51.0 (April 06, 2023)


BREAKING CHANGES:

azurerm_kubernetes_cluster - the sku_tier property no longer accepts the value

Paid , it must be updated to Standard (#21256 )

FEATURES:

New Resource: azurerm_arc_kubernetes_cluster (#15401 )


New Resource: azurerm_resource_group_cost_management_view (#21112 )
New Resource: azurerm_signalr_service_custom_certificate (#21112 )
New Resource: azurerm_storage_mover (#21000 )
New Resource: azurerm_subscription_cost_management_view (#21112 )
New Resource: azurerm_voice_services_communications_gateway_test_line
(#21111 )

ENHANCEMENTS:

dependencies: updating to v0.20230405.1143248 of github.com/hashicorp/go-


azure-sdk (#21312 )
dependencies: updating to v0.20230331.1120327 of
github.com/tombuildsstuff/kermit (#21235 )
dependencies: updating containerservice/2022-09-02-preview to 2023-02-02-
preview (#21256 )
dependencies: updating search/2020-03-13 to search/2022-09-01 (#21250 )
batch : updating to API Version 2022-01-01.15.0 (from

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

workload_runtime property (#21176 )


azurerm_kubernetes_cluster_node_pool - support KataMshvVmIsolation as a option

for the workload_runtime property (#21176 )


azurerm_monitor_data_collection_rule - support for the
data_collection_endpoint_id property (#21159 )
azurerm_monitor_data_collection_rule - support for the identity and

stream_declaration blocks (#21159 )


azurerm_monitor_data_collection_rule - support for more destinations ,

data_sources and data_flow transformations (#21159 )


azurerm_signalr_service - support for the http_request_logs_enabled property

(#21032 )
azurerm_snapshot - support for the incremental_enabled property (#21263 )
azurerm_web_pubsub_hub - support for the event_listener block (#21145 )

BUG FIXES:

Data Source: azurerm_app_configuration_keys - fixing a regression where the API


doesn't return the http endpoint when listing items (#21208 )
Data Source: azurerm_kubernetes_cluster - prevent errors when used with limited
permissions (#21229 )
azurerm_api_management - prevent error from empty response body when updating

the resource (#21221 )


azurerm_application_gateway - correctly validate the firewall_policy_id property

(#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

applies to a Kusto Cluster (#21243 )


azurerm_linux_function_app - fix a crash in auth_v2 in active_directory_v2

(#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

created for a Kusto Cluster (#21243 )


azurerm_mssql_database - fix a issue with short_term_retention_policy preventing

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 )

3.50.0 (March 30, 2023)


FEATURES:

New DataSource: azurerm_container_app (#21199 )


New Resource: azurerm_web_pubsub_custom_certificate (#21114 )

ENHANCEMENTS:

dependencies: updating to v0.20230329.1052505 of github.com/hashicorp/go-


azure-sdk (#21175 )
dependencies: updated azurerm_subscription to use new SDK (#18813 )
azurerm_databricks_access_connector - support for user assigned identities

(#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

long_term_retention_policy and short_term_retention_policy (#21166 )


azurerm_windows_function_app - add support for zip_deploy_file (#20544 )

BUG FIXES:

Data Source: azurerm_databricks_workspace_private_endpoint_connection :


validating private_endpoint_id and workspace_id (#21129 )
Data Source: azurerm_healthcare_medtech_service - the workspace_id field is no
longer marked as ForceNew (#21077 )
Data Source: azurerm_healthcare_medtech_service - support for Azure
Environments other then Azure Public (#21077 )
azurerm_api_management - validating public_ip_address_id and subnet_id

(#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

block is a base64-encoded value (#21191 )


azurerm_application_insights_analytics_item - validating

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

app_service_id and virtual_network_id (#21129 )


azurerm_bastion_host - validating public_ip_address_id (#21129 )
azurerm_container_registry - validating subnet_id (#21129 )
azurerm_database_migration_service - validating subnet_id (#21129 )
azurerm_databricks_workspace - validating

load_balancer_backend_address_pool_id , machine_learning_workspace_id and


virtual_network_id (#21129 )
azurerm_data_factory_linked_service_key_vault - validating key_vault_id

(#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

instead be omitted (#21129 )


azurerm_express_route_circuit_peering - validating route_filter_id (#21129 )
azurerm_express_route_gateway - validating virtual_hub_id (#21129 )
azurerm_eventhub - validating storage_account_id (#21129 )
azurerm_eventgrid_event_subscription - validating eventhub_resource_id ,

servicebus_queue_endpoint_id , servicebus_topic_endpoint_id and


storage_account_id (#21129 )
azurerm_frontdoor - validating web_application_firewall_policy_link_id

(#21129 )
azurerm_hdinsight_hadoop_cluster - validating storage_resource_id , subnet_id

and virtual_network_id (#21129 )


azurerm_hdinsight_hbase_cluster - validating storage_resource_id , subnet_id and

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

Azure Public (#21077 )


azurerm_hpc_cache - validating subnet_id (#21129 )
azurerm_image - validating managed_disk_id and source_virtual_machine_id

(#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 ,

network_security_group_id , public_ip_prefix_id and subnet_id (#21129 )


azurerm_log_analytics_linked_service - validating the workspace id (#21170 )
azurerm_log_analytics_linked_storage_account - validating the
storage_account_id (#21129 )
azurerm_logic_app_action_custom - validating logic_app_id (#21129 )
azurerm_logic_app_action_http - validating subnet_id (#21129 )
azurerm_logic_app_trigger_custom - validating logic_app_id (#21129 )
azurerm_logic_app_trigger_http_request - validating logic_app_id (#21129 )
azurerm_logic_app_trigger_recurrence - validating logic_app_id (#21129 )
azurerm_mssql_virtual_machine - the sql_license_type property is now optional

(#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

application_security_group_id and network_interface_id (#21129 )


azurerm_network_interface_backend_address_pool_association - validating the

backend_address_pool_id and subnet_id (#21129 )


azurerm_network_interface_network_security_group_association - validating

network_security_group_id and subnet_id (#21129 )


azurerm_network_interface_nat_rule_association - validating
network_interface_id and nat_rule_id (#21129 )
azurerm_network_profile - validating subnet_id (#21129 )
azurerm_network_watcher_flow_log - fixing the delete function to work reliably

during deletion (#21129 )


azurerm_network_watcher_flow_log - validating storage_account_id (#21129 )
azurerm_orchestrated_virtual_machine_scale_set - validating

application_security_group_ids , key_vault_id , proximity_placement_group_id ,


public_ip_prefix_id and subnet_id (#21129 )
azurerm_private_link_service - validating subnet_id (#21129 )
azurerm_public_ip - validating public_ip_prefix_id (#21129 )
azurerm_postgresql_virtual_network_rule - validating subnet_id is a subnet

(#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

Range that's invalid when the validation fails (#21178 )


azurerm_storage_account_network_rules - validating ip_rules (#21178 )
azurerm_storage_management_policy - validating storage_account_id (#21129 )
azurerm_subnet_nat_gateway_association - validating nat_gateway_id and
subnet_id (#21129 )
azurerm_subnet_network_security_group_association - validating
network_security_group_id and subnet_id (#21129 )
azurerm_subnet_route_table_association - validating subnet_id (#21129 )
azurerm_virtual_hub - validating virtual_wan_id (#21129 )
azurerm_virtual_machine_data_disk_attachment - validating managed_disk_id and

virtual_machine_id (#21129 )
azurerm_virtual_network - validating ddos_protection_plan_id (#21129 )
azurerm_virtual_network_gateway - validating default_local_network_gateway_id

and public_ip_address_id (#21129 )


azurerm_virtual_network_gateway_connection - validating

express_route_circuit_id , local_network_gateway_id and


peer_virtual_network_gateway_id (#21129 )
azurerm_web_application_firewall_policy - the match_values property is now

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 ,

proximity_placement_group_id , public_ip_prefix_id , subnet_id and


virtual_network_gateway_id (#21129 )
azurerm_windows_web_app - fix crash in auth_v2 in active_directory_v2 (#21113 )
azurerm_windows_web_app_slot - fix crash in auth_v2 in active_directory_v2

(#21113 )

3.49.0 (March 23, 2023)


BREAKING CHANGES: App Service site_config

ip_restriction blocks are no longer computed - changes to IP restrictions outside

of Terraform now presents a diff


scm_ip_restriction blocks are no longer computed - changes to SCM IP

restrictions outside of Terraform now presents a diff


cors blocks no longer require allowed_origins , however, if the property is

supplied it must contain at least one item. Omitting this property will set the array
empty

FEATURES:

New Datasource: azurerm_orchestrated_virtual_machine_scale_set (#21050 )


New Resource: azurerm_databricks_virtual_network_peering #20728 (#20728 )
New Resource: azurerm_sentinel_threat_intelligence_indicator (#20771 )
New Resource: azurerm_voice_services_communications_gateway (#20607 )

ENHANCEMENTS:

dependencies: updating to v0.20230322.1105901 of hashicorp/go-azure-sdk


(#21079 )
databricks : refactoring to use hashicorp/go-azure-sdk as a base layer rather than

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

supported by the API since docker is no longer a valid container runtime


(#20952 )
azurerm_management_group_policy_assignment - support for the overrides and
resource_selectors blocks (#20686 )
azurerm_mysql_flexible_server - support for the geo_backup_key_vault_key_id

and geo_backup_user_assigned_identity_id properties (#20796 )


azurerm_resource_group_policy_assignment - support for the overrides and

resource_selectors blocks (#20686 )


azurerm_resource_policy_assignment - support for the overrides and
resource_selectors blocks (#20686 )
azurerm_role_assignment - support subscription aliases scopes (#20895 )
azurerm_signalr_service - support for public_network_access_enabled ,

local_auth_enabled , aad_auth_enabled , tls_client_cert_enabled , and

serverless_connection_timeout_in_seconds properties (#20975 )


azurerm_subscription_policy_assignment - support for the overrides and

resource_selectors blocks (#20686 )


azurerm_sentinel_log_analytics_workspace_onboarding - the resource_group_name

and workspace_name properties are deprecated in favour of workspace_id


(#20661 )
azurerm_virtual_network_peering - adding an explicit default value for

allow_forwarded_traffic , allow_gateway_transit and use_remote_gateways

(#21009 )
azurerm_virtual_hub - support for the hub_routing_preference property

(#21028 )

BUG FIXES:

azurerm_automation_account - the key_source property is deprecated (#21041 )


azurerm_application_insights - the workspace_id can now be updated without

creating a new resource (#21029 )


azurerm_firewall - Prevent duplicate name from being used for ip_configuration
and management_ip_configuration (#21068 )
azurerm_kubernetes_cluster - replace calls to the deprecated accessProfiles

endpoint with listUserCredentials (#20927 )


azurerm_kusto_cluster - language_extensions is now a Set rather than a List

(#20951 )
azurerm_linux_function_app - fixan update bug with the

health_check_eviction_time_in_min property (#21095 )


azurerm_linux_function_app - fixed processing of cors block (#20987 )
azurerm_linux_function_app - fixauth_v2 active_directory_v2 sending empty data

(#21091 )
azurerm_linux_function_app - fixread for token_store_enabled to correctly set

returned value in state (#21091 )


azurerm_linux_function_app - the ip_restriction block can is now successfully

removed by removing from config (#20987 )


azurerm_linux_function_app - the scm_ip_restriction block can is now

successfully removed by removing from config (#20987 )


azurerm_linux_function_app_slot - fixed processing of cors block (#20987 )
azurerm_linux_function_app_slot - the ip_restriction block can is now

successfully removed by removing from config (#20987 )


azurerm_linux_function_app_slot - the scm_ip_restriction block can is now

successfully removed by removing from config (#20987 )


azurerm_linux_function_app_slot - fixauth_v2 active_directory_v2 sending empty

data (#21091 )
azurerm_linux_function_app_slot - fixread for token_store_enabled to correctly set

returned value in state (#21091 )


azurerm_linux_web_app - fixauth_v2 active_directory_v2 sending empty data

(#21091 )
azurerm_linux_web_app - fixread for token_store_enabled to correctly set returned

value in state (#21091 )


azurerm_linux_web_app - fixed processing of cors block (#20987 )
azurerm_linux_web_app - the ip_restriction block can is now successfully

removed by removing from config (#20987 )


azurerm_linux_web_app - the scm_ip_restriction block can is now successfully

removed by removing from config (#20987 )


azurerm_linux_web_app_slot - fixauth_v2 active_directory_v2 sending empty data

(#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

removed by removing from config (#20987 )


azurerm_linux_web_app_slot - the scm_ip_restriction block can is now

successfully removed by removing from config (#20987 )


azurerm_machine_learning_datastore_blobstorage - fixan issue creating this

resource in clouds other than public (#21016 )


azurerm_virtual_desktop_host_pool - changing the load_balancer_type property

no longer creates a new resource (#20947 )


azurerm_windows_function_app - fixan update bug with the

health_check_eviction_time_in_min property (#21095 )


azurerm_windows_function_app - fixed processing of cors block (#20987 )
azurerm_windows_function_app - fixauth_v2 active_directory_v2 sending empty

data (#21091 )
azurerm_windows_function_app - fixread for token_store_enabled to correctly set

returned value in state (#21091 )


azurerm_windows_function_app - the ip_restriction block can is now successfully

removed by removing from config (#20987 )


azurerm_windows_function_app - the scm_ip_restriction block can is now

successfully removed by removing from config (#20987 )


azurerm_windows_function_app_slot - fixed processing of cors block (#20987 )
azurerm_windows_function_app_slot - fixauth_v2 active_directory_v2 sending

empty data (#21091 )


azurerm_windows_function_app_slot - fixread for token_store_enabled to correctly

set returned value in state (#21091 )


azurerm_windows_function_app_slot - the ip_restriction block can is now

successfully removed by removing from config (#20987 )


azurerm_windows_function_app_slot - the scm_ip_restriction block can is now

successfully removed by removing from config (#20987 )


azurerm_windows_web_app - the ip_restriction block can is now successfully

removed by removing from config (#20987 )


azurerm_windows_web_app - fixed processing of cors block (#20987 )
azurerm_windows_web_app - the scm_ip_restriction block can is now successfully

removed by removing from config (#20987 )


azurerm_windows_web_app - fixauth_v2 active_directory_v2 sending empty data

(#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

removed by removing from config (#20987 )


azurerm_windows_web_app_slot - fixed processing of cors block (#20987 )
azurerm_windows_web_app_slot - the scm_ip_restriction block can is now

successfully removed by removing from config (#20987 )


azurerm_windows_web_app_slot - fixauth_v2 active_directory_v2 sending empty

data (#21091 )
azurerm_windows_web_app_slot - fixread for token_store_enabled to correctly set

returned value in state (#21091 )

3.48.0 (March 16, 2023)


FEATURES:

New Data Source: azurerm_mobile_network_sim_policy [FGH-20732]


New Resource: azurerm_express_route_port_authorization (#20736 )
New Resource: azurerm_mobile_network_sim_policy (#20732 )
New Resource: azurerm_site_recovery_vmware_replication_policy (#20881 )
New Resource: azurerm_sentinel_alert_rule_anomaly_duplicate (#20760 )

ENHANCEMENTS:

dependencies: updating to v0.20230316.1132628 of github.com/hashicorp/go-


azure-sdk (#20986 )
signalr : updating to API Version 2023-02-01 (#20910 )
webpubsub : updating to API Version 2023-02-01 (#20910 )
azurerm_express_route_gateway - support for the allow_non_virtual_wan_traffic

property (#20667 )
azurerm_ssh_public_key - allow . for name validation (#20955 )

BUG FIXES:

provider: fix an authentication bug which sometimes caused access tokens to be


refreshed too late (#20894 )
azurerm_bot_channel_directline - fixing an issue where an empty site was

passed to the API (#20890 )


azurerm_healthcare_dicom_service - extending the create and update timeouts to
90 minutes (#20932 )
azurerm_kusto_eventhub_data_connection - fixing an issue where an existing

resource wouldn't be flagged during creation (#20926 )


azurerm_linux_function_app - Fixed apply time validation when using

WEBSITE_CONTENTOVERVNET (#18258 )
azurerm_windows_function_app - Fixed apply time validation when using

WEBSITE_CONTENTOVERVNET (#18258 )

3.47.0 (March 09, 2023)


FEATURES:

New Resource: azurerm_sentinel_metadata (#20801 )

ENHANCEMENTS

dependencies: updating to v4.4.0+incompatible of github.com/gofrs/uuid


(#20821 )
dependencies: updating to v0.55.0 of github.com/hashicorp/go-azure-helpers
(#20807 )
dependencies: updating to version v0.20230309.1123256 of
github.com/hashicorp/go-azure-sdk (#20810 )
dependencies: updating to v0.20230307.1105329 of
github.com/tombuildsstuff/kermit (#20821 )
dependencies: updating redis/2021-06-01 to redis/2022-06-01 (#20839 )
dashboard : refactoring to use hashicorp/go-azure-sdk as a base layer rather than
Azure/go-autorest (#20810 )
media : refactoring to use hashicorp/go-azure-sdk as a base layer rather than
Azure/go-autorest (#20810 )
servicebus : refactoring to use hashicorp/go-azure-sdk as a base layer rather than

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

no longer ForceNew and can be resized by specifying


temporary_name_for_rotation (#20628 )
azurerm_mariadb_server - support for the ssl_minimal_tls_version_enforced

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

address_space synchronization (#20877 )

BUG FIXES:

provider: fix an issue with authentication using oidc_token_file_path (#20824 )


provider: fix an issue with Azure CLI authentication when running in Azure Cloud
Shell (#20824 )
azurerm_application_insights_analytics_item - marking the resource as gone

when it's been deleted outside of Terraform (#20797 )


azurerm_automated_connection_type - marking the resource as gone when it's been

deleted outside of Terraform (#20797 )


azurerm_automation_software_update_configuration - marking the resource as

gone when it's been deleted outside of Terraform (#20797 )


azurerm_automation_source_control - marking the resource as gone when it's been

deleted outside of Terraform (#20797 )


azurerm_automation_watcher - marking the resource as gone when it's been

deleted outside of Terraform (#20797 )


azurerm_cdn_frontdoor_origin - fixregression where origin_host_header value

would be inadvertently removed (#20874 )


azurerm_cdn_frontdoor_route_disable_link_to_default_domain - marking the

resource as gone when it's been deleted outside of Terraform (#20797 )


azurerm_container_registry_task - fixupdating failed due to incomplete

registry_credential (#20841 )
azurerm_digital_twins_time_series_database_connection - marking the resource

as gone when it's been deleted outside of Terraform (#20797 )


azurerm_fluid_relay_server - marking the resource as gone when it's been

deleted outside of Terraform (#20797 )


azurerm_function_app_active_slot - marking the resource as gone when it's been
deleted outside of Terraform (#20797 )
azurerm_iothub_endpoint_eventhub - marking the resource as gone when it's been

deleted outside of Terraform (#20798 )


azurerm_iothub - fixwrong default value of file_upload.sas_ttl when not

specified (#20854 )
azurerm_iothub_endpoint_servicebus_queue - marking the resource as gone when

it's been deleted outside of Terraform (#20798 )


azurerm_iothub_endpoint_servicebus_topic - marking the resource as gone when

it's been deleted outside of Terraform (#20798 )


azurerm_iothub_endpoint_servicebus_queue - marking the resource as gone when

it's been deleted outside of Terraform (#20798 )


azurerm_iothub_endpoint_storage_container - marking the resource as gone when

it's been deleted outside of Terraform (#20798 )


azurerm_iothub_fallback_route - marking the resource as gone when it's been

deleted outside of Terraform (#20797 )


azurerm_iothub_route - marking the resource as gone when it's been deleted

outside of Terraform (#20798 )


azurerm_kubernetes_cluster - fixvalidation logic for dns_prefix (#20813 )
azurerm_linux_function_app_slot - fixhealth_check_eviction_time_in_min

(#20816 )
azurerm_logic_app_integration_account - marking the resource as gone when it's

been deleted outside of Terraform (#20797 )


azurerm_maintenance_assignment_virtual_machine - prevent a potential panic from

a nil value (#20781 )


azurerm_maintenance_assignment_virtual_machine - maintenance configuration is

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

outside of Terraform (#20797 )


azurerm_nginx_configuration - marking the resource as gone when it's been

deleted outside of Terraform (#20797 )


azurerm_nginx_deployment - marking the resource as gone when it's been deleted

outside of Terraform (#20797 )


azurerm_synapse_workspace_aad_admin - marking the resource as gone when it's

been deleted outside of Terraform (#20797 )


azurerm_synapse_workspace_key - marking the resource as gone when it's been

deleted outside of Terraform (#20797 )


azurerm_synapse_workspace_sql_aad_admin - marking the resource as gone when

it's been deleted outside of Terraform (#20797 )


azurerm_web_app_active_slot - marking the resource as gone when it's been
deleted outside of Terraform (#20797 )
azurerm_windows_function_app_slot - fixhealth_check_eviction_time_in_min

(#20816 )

3.46.0 (March 02, 2023)


FEATURES

New Data Source: azurerm_mobile_network_data_network (#20338 )


New Data Source: azurerm_sentinel_alert_rule_anomaly_built_in (#20368 )
New Resource: azurerm_mobile_network_data_network (#20338 )
New Resource: azurerm_sentinel_alert_rule_anomaly_built_in (#20368 )
New Resource: azurerm_sentinel_alert_rule_threat_intelligence (#20739 )

ENHANCEMENTS

dependencies: updating to v0.20230228.1160358 of github.com/hashicorp/go-


azure-sdk (#20688 )
dependencies: updating to v0.20230224.1120200 of
github.com/tombuildsstuff/kermit (#20649 )
dependencies: updating containerservice/2022-09-02-preview to 2023-01-02-
preview (#20734 )
dependencies: updating hybridCompute/2022-03-10 to 2022-11-10 (#20733 )
aadb2c : refactoring to use hashicorp/go-azure-sdk as a base layer rather than
Azure/go-autorest (#20715 )
databoxedge - switching to use github.com/hashicorp/go-azure-sdk (#20638 )
dns : refactoring to use hashicorp/go-azure-sdk as a base layer rather than

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

maximum of 100000 (#20755 )


azurerm_key_vault_key - support for the rotation_policy block (#19113 )
azurerm_kubernetes_cluster - support for Standard with the sku_tier (#20734 )
azurerm_linux_function_app - support for AuthV2 (EasyAuthV2) auth_settings_v2

(#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 ,

common_encryption_cenc.content_key_to_track_mapping and envelope_encryption

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

Data Source: azurerm_automation_variable_bool - fixed a regression in read


(#20665 )
Data Source: azurerm_automation_variable_datetime - fixed a regression in read
(#20665 )
Data Source: azurerm_automation_variable_int - fixed a regression in read
(#20665 )
Data Source: azurerm_automation_variable_string - fixed a regression in read
(#20665 )
azurerm_aadb2c_directory - fixing a crash when the connection dropped

(#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

creates a new resource (#20711 )


azurerm_eventhub_cluster - fixing a crash when the connection dropped

(#20670 )
azurerm_eventhub_namespace - fixing a crash when the connection dropped

(#20670 )
azurerm_eventhub_namespace_disaster_recovery_config - fixing a crash when the

connection dropped (#20670 )


azurerm_kubernetes_cluster_node_pool - fixing a crash when the connection

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

connection dropped (#20670 )


azurerm_servicebus_namespace_disaster_recovery_config - fixing a crash when the

connection dropped (#20670 )


azurerm_storage_object_replication - now functions when cross tenant replication

is disabled (#20132 )

3.45.0 (February 23, 2023)


FEATURES

App Service - Add authV2 to Web Apps (#20449 )


New Resource: azurerm_site_recovery_hyperv_replication_policy (#20454 )
New Resource: azurerm_site_recovery_hyperv_replication_policy_association
(#20630 )
ENHANCEMENTS

dependencies: updating to v0.20230222.1094703 of github.com/hashicorp/go-


azure-sdk (#20610 )
dependencies: updating to v0.7.0 of golang.org/x/net (#20541 )
automation - switching to use github.com/hashicorp/go-azure-sdk (#20568 )
compute/capacityreservations - switching to use github.com/hashicorp/go-azure-
sdk (#20580 )
compute/capacityreservationgroups - switching to use github.com/hashicorp/go-
azure-sdk (#20580 )
kusto - switching to use github.com/hashicorp/go-azure-sdk (#20563 )
azurerm_backup_policy_vm - add support for instant_restore_resource_group

(#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

allow for auto-rotation of key (#20583 )


azurerm_linux_virtual_machine - strengthen validation for admin_password

(#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

enabling password authtication (#20578 )


azurerm_media_streaming_endpoint - add support for reading sku and increase

limit for scale_units (#20585 )


azurerm_recovery_services_vault - add support for
classic_vmware_replication_enabled (#20473 )
azurerm_windows_virtual_machine - strengthen validation for admin_password

(#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

Data Source: azurerm_linux_web_app - set virtual_network_subnet_id correctly


(#20577 )
Data Source: azurerm_redis_cache - fixissue when no patch schedules can be
found (#20516 )
Data Source: azurerm_windows_web_app - set virtual_network_subnet_id correctly
(#20577 )
azurerm_batch_pool - set user assigned id for azure_blob_file_system correctly

(#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

Assigned Identities (#20474 )


azurerm_monitor_diagnostic_setting - the log_analytics_destination_type
property is nto computer rather then defaulting to AzureDiagnostics on new
resources (#20203 )

3.44.1 (February 17, 2023)


ENHANCEMENTS

dependencies: updating to v0.20230217.1150808 of github.com/hashicorp/go-


azure-sdk (#20539 )

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

can't be built (#20533 )


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 )
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

couldn't be found (#20536 )


azurerm_synapse_role_assignment - fixing an issue where the Synapse domain
suffix couldn't be found (#20536 )

3.44.0 (February 16, 2023)


FEATURES:

New Data Source: azurerm_hybrid_compute_machine (#20211 )


New Data Source: azurerm_policy_definition_built_in (#19933 )
New Data Source: azurerm_mobile_network_service (#20337 )
New Data Source: azurerm_mobile_network_site (#20334 )
New Data Source: azurerm_mobile_network_slice (#20336 )
New Data Source: azurerm_mobile_network_sim_group (#20339 )
New Data Source: azurerm_virtual_desktop_host_pool (#20505 )
New Resource: azurerm_network_manager_security_admin_configuration
(#20233 )
New Resource: azurerm_network_manager_admin_rule_collection (#20233 )
New Resource: azurerm_network_manager_admin_rule (#20233 )
New Resource: azurerm_mobile_network_service (#20337 )
New Resource: azurerm_mobile_network_site (#20334 )
New Resource: azurerm_mobile_network_slice (#20336 )
New Resource: azurerm_mobile_network_sim_group [GH-20339
New Resource: azurerm_site_recovery_services_vault_hyperv_site [GH-204309

ENHANCEMENTS:

dependencies: updating to v0.20230216.1112535 of github.com/hashicorp/go-


azure-sdk (#20465 )
dependencies: no longer utilizing github.com/manicminer/hamilton (#20320 )
provider: support for the client_certificate provider property (#20320 )
provider: support for the use_cli provider property (#20320 )
provider: authentication now uses the github.com/hashicorp/go-azure-
sdk/sdk/auth package (#20320 )
provider: cloud configuration now uses the github.com/hashicorp/go-azure-
sdk/sdk/environments package (#20320 )
datashare : refactoring to use github.com/hashicorp/go-azure-sdk (#20501 )
managementlocks : refactoring to use github.com/hashicorp/go-azure-sdk
(#20387 )
media : refactoring StreamingEndpoints to use API Version 2022-08-01 (#20457 )
postgres - updating API to 2022-12-01 (#20370 )
Data Source: azurerm_policy_definition - support for the mode property
(#20420 )
Data Source: azurerm_key_vault_certificates - now exports the certificates
block (#20498 )
Data Source: azurerm_key_vault_secrets - now exports the secrets block
(#20498 )
azurerm_api_management - support for the delegation block (#20399 )
azurerm_container_app - now supports multiple container blocks (#20423 )
azurerm_cognitive_account - the field sku_name can now be set to DC0 (#20426 )
azurerm_container_app - support for the registry.identity property (#20466 )
azurerm_data_factory_linked_service_azure_blob_storage - Add support for
connection_string_insecure [Gh-20494]

azurerm_express_route_port - support for the billing_type property (#20361 )


azurerm_kubernetes_cluster - the web_app_routing.dns_zone_id property now

accepts an empty string for BYO DNS (#20341 )


azurerm_linux_virtual_machine - validating that the value for the admin_username

property isn't a disallowed username (#20424 )


azurerm_windows_virtual_machine - validating that the value for the

admin_username property isn't a disallowed username (#20424 )

BUG FIXES:

Data Source: azurerm_aadb2c_directory - fixing a bug where the Data Source


didn't return an error when the Azure AD B2C was not found (#20479 )
Data Source: azurerm_app_service_environment_v3 - fixing a bug where the Data
Source didn't return an error when the App Service Environment was not found
(#20479 )
Data Source: azurerm_consumption_budget_resource_group - using the correct
timeout value (#20479 )
Data Source: azurerm_consumption_budget_resource_group - fixing a bug where the
Data Source didn't return an error when the Consumption Budget Resource Group
was not found (#20479 )
Data Source: azurerm_data_protection_backup_vault - fixing a bug where the Data
Source didn't return an error when the Data Protection Backup Vault was not found
(#20479 )
Data Source: azurerm_databox_edge_device - fixing a bug where the Data Source
didn't return an error when the DataBox Edge Device was not found (#20479 )
Data Source: azurerm_healthcare_dicom - fixing a bug where the Data Source
didn't return an error when the HealthCare DICOM was not found (#20479 )
Data Source: azurerm_healthcare_fhir - fixing a bug where the Data Source didn't
return an error when the HealthCare FHIR was not found (#20479 )
Data Source: azurerm_healthcare_medtech_service - fixing a bug where the Data
Source didn't return an error when the HealthCare MedTech Service was not found
(#20479 )
Data Source: azurerm_key_vault_certificate_data - fixing a bug where the Data
Source didn't return an error when the KeyVault Certificate was not found
(#20479 )
Data Source: azurerm_key_vault_certificate - fixing a bug where the Data Source
didn't return an error when the KeyVault Certificate was not found (#20479 )
Data Source: azurerm_lb_outbound_rule - fixing a bug where the Data Source
didn't return an error when the Load Balancer Outbound Rule was not found
(#20479 )
Data Source: azurerm_lb_rule - fixing a bug where the Data Source didn't return
an error when the Load Balancer Rule was not found (#20479 )
Data Source: azurerm_local_network_gateway - fixing a bug where the Data Source
didn't return an error when the Local Network Gateway was not found (#20479 )
Data Source: azurerm_mobile_network - fixing a bug where the Data Source didn't
return an error when the Mobile Network was not found (#20479 )
Data Source: azurerm_monitor_data_collection_endpoint - fixing a bug where the
Data Source didn't return an error when the Monitor Data Collection Endpoint was
not found (#20479 )
Data Source: azurerm_mssql_managed_instance - fixing a bug where the Data
Source didn't return an error when the MSSQL Managed Instance was not found
(#20479 )
Data Source: azurerm_policy_assignment - fixing a bug where the Data Source
didn't return an error when the Policy Assignment was not found (#20479 )
Data Source: azurerm_redis_enterprise_database - fixing a bug where the Data
Source didn't return an error when the Redis Enterprise Database was not found
(#20479 )
Data Source: azurerm_servicebus_namespace_disaster_recovery_config - fixing a
bug where the Data Source didn't return an error when the ServiceBus Namespace
Disaster Recovery Config was not found (#20479 )
Data Source: azurerm_site_recovery_replication_recovery_plan - fixing a bug
where the Data Source didn't return an error when the Site Recovery Replication
Recovery Plan was not found (#20479 )
Data Source: azurerm_storage_blob - fixing a bug where the Data Source didn't
return an error when the Blob was not found (#20479 )
Data Source: azurerm_storage_table_entity - fixing a bug where the Data Source
didn't return an error when the Table Entity was not found (#20479 )
Data Source: azurerm_vpn_gateway - fixing a bug where the Data Source didn't
return an error when the VPN Gateway was not found (#20479 )
Data Source: azurerm_web_pubsub - fixing a bug where the Data Source didn't
return an error when the Web PubSub was not found (#20479 )
azurerm_backup_protected_vm - now correctly deletes (#20469 )
azurerm_eventhub - changing the partition_count property now works by creating

a new resource (#20480 )


azurerm_eventgrid_domain_topic - the name property can now be up to 128

characters (#20407 )
azurerm_kubernetes_cluster - parsing the API response for the

log_analytics_workspace_id field case-insensitively (#20484 )


azurerm_private_endpoint - normalizing the private_connection_resource_id

propety for a redis cache (#20418 )


azurerm_private_endpoint - consistently normalizing the value returned from the

API for private_connection_resource_id (#20452 )


azurerm_recovery_services_vault - updating cross_region_restore_enabled to

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

since storage management policies fail if it's unspecified (#20448 )

3.43.0 (February 09, 2023)


FEATURES

New Data Source: azurerm_container_app_environment (#18008 )


New Data Source: azurerm_container_app_environment_certificate (#18008 )
New Data Source: azurerm_mobile_network (#20128 )
New Resource: azurerm_container_app_environment (#18008 )
New Resource: azurerm_container_app_environment_storage (#18008 )
New Resource: azurerm_container_app_environment_dapr_component (#18008 )
New Resource: azurerm_container_app_environment_certificate (#18008 )
New Resource: azurerm_container_app (#18008 )
New Resource: azurerm_machine_learning_datastore_fileshare (#19934 )
New Resource: azurerm_machine_learning_datastore_datalake_gen2 (#20045 )
New Resource: azurerm_mobile_network (#20128 )
New Resource: azurerm_sentinel_data_connector_microsoft_threat_intelligence
(#20273 )

ENHANCEMENTS:

dependencies: updating to v0.11.28 of github.com/Azure/go-autorest/autorest


(#20272 )
dependencies: updating to v0.50.0 of github.com/hashicorp/go-azure-helpers
(#20272 )
dependencies: updating to v0.20230208.1165725 of github.com/hashicorp/go-
azure-sdk (#20381 )
dependencies: updating to v0.55.0 of github.com/manicminer/hamilton
(#20272 )
dependencies: updating to v0.20230208.1135849 of
github.com/tombuildsstuff/kermit (#20381 )
dependences: updating postgresql/2021-06-01/databases to 2022-12-01
(#20369 )
appservice : updating to API Version 2021-03-01 (#20349 )
azurestackhci : refactoring to use github.com/hashicorp/go-azure-sdk (#20318 )
batch : refactoring to use github.com/hashicorp/go-azure-sdk (#20375 )
databricks : refactoring to use github.com/hashicorp/go-azure-sdk (#20309 )
datadog : refactoring to use github.com/hashicorp/go-azure-sdk (#20311 )
databoxedge : refactoring to use github.com/hashicorp/go-azure-sdk (#20236 )
digitaltwins : refactoring to use github.com/hashicorp/go-azure-sdk (#20318 )
postgresql : updating to API Version 2022-12-01 (#20367 )
redis : refactoring to use github.com/hashicorp/go-azure-sdk (#20313 )
azurerm_media_streaming_locator - support for the filter_names property

(#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

confidential_vm_enabled properties (#20249 )


azurerm_postgresql_flexible_server - support for replication_role and new

enum value Replica for create_mode (#20364 )

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

in last file being used for all entries (#20198 )


azurerm_monitor_diagnostic_setting - changing the storage_account_id ,

eventhub_authorization_rule_id , and eventhub_name properties no longer creates

a new resource (#20307 )


azurerm_redis_enterprise_cluster - switching a spurious usage of Azure/azure-
sdk-for-go to hashicorp/go-azure-sdk (#20314 )
azurerm_service_fabric_managed_cluster - fixpotential panic when setting

node_type (#20345 )
azurerm_web_application_firewall_policy - prevent a failure caused by changing

the order of the disabled_rules properties (#20285 )


azurerm_databricks_access_connector - name can now be up to 64 character in

length (#20353 )

3.42.0 (February 02, 2023)


FEATURES

New Resource: azurerm_ip_group_cidr (#20225 )


New Resource: azurerm_network_manager_connectivity_configuration (#20133 )

ENHANCEMENTS:

dependencies: updating to v0.20230130.1140358 of github.com/hashicorp/go-


azure-sdk (#20293 )
databasemigration : refactoring to use github.com/hashicorp/go-azure-sdk

(#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 ,

multi_vm_group_name , target_edge_zone , and test_network_id properties

(#19939 )

BUG FIXES:

data.azurerm_monitor_data_collection_rule - raises an error when the specified

data collection rule can't be found (#20282 )


azurerm_federated_identity_credential - prevent a perpetual diff (#20219 )
azurerm_linux_function_app - fix linuxFxVersion for docker registry_url

processing (#18194 )
azurerm_monitor_aad_diagnostic_setting - the field log_analytics_workspace_id is

now parsed case-insensitively from the API Response (#20206 )

3.41.0 (January 26, 2023)


FEATURES

New Data Source: azurerm_key_vault_certificates (#19498 )


New Data Source: azurerm_site_recovery_replication_recovery_plan (#19940 )
New Resource: azurerm_orbital_contact (#19036 )
New Resource: azurerm_site_recovery_replication_recovery_plan (#19940 )

ENHANCEMENTS:

dependencies: updating to v0.20230124.1111819 of github.com/hashicorp/go-


azure-sdk (#20160 )
resourceproviders: no longer registering Microsoft.ServiceFabricMesh by default
(#20165 )
testing: refactoring to use hashicorp/terraform-plugin-testing (#20114 )
devtestlabs : refactoring to use github.com/hashicorp/go-azure-sdk (#20139 )
logic : refactoring to use github.com/hashicorp/go-azure-sdk (#20144 )
network : updating to API version 2022-07-01 (#20097 )
postgresql : updating to API version 2022-03-08-preview (#20073 )
streamanalytics : updating to API Version 2021-10-01-preview (#20145 )
azurerm_*_app_slot - support for slots to be placed in different service plans

(#20184 )
azurerm_databricks_workspace - support for customer managed keys for managed

disks attached to the workspace (#19992 )


azurerm_databricks_workspace - support for updating the properties

public_network_access_enabled , network_security_group_rules_required and


managed_services_cmk_key_vault_key_id (#19992 )
azurerm_kubernetes_cluster - support for node_public_ip_tags (#19731 )
azurerm_kubernetes_cluster_node_pool - support for node_public_ip_tags

(#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:

azurerm_stream_analytics_output_servicebus_queue - shared access policy name

and key are now optional for MSI authentication (#19712 )


azurerm_stream_analytics_output_servicebus_topic - shared access policy name

and key are now optional for MSI authentication (#19708 )

3.40.0 (January 19, 2023)


FEATURES

New Data Source: azurerm_bastion_host (#20062 )


New Resource: azurerm_lab_service_schedule (#19977 )
New Resource: azurerm_machine_learning_datastore_blobstorage (#19909 )
New Resource: azurerm_network_manager_scope_connection (#19610 )
New Resource: azurerm_network_manager_static_member (#20077 )
New Resource: azurerm_sentinel_log_analytics_workspace_onboarding (#19692 )

ENHANCEMENTS:

dependencies: updating to v0.20230117.1125206 of github.com/hashicorp/go-


azure-sdk (#20081 )
azurerm_application_gateway - support for TLS 1.3 and CustomV2 (#20029 )
azurerm_kubernetes_cluster - support for the key_management_service block

(#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

identity and use_system_assigned_identity properties (#20109 )


azurerm_synapse_sql_pool - support for geo_backup_policy_enabled and fix

recovery_database_id [(#20010 )

BUG FIXES:

Data Source: azurerm_batch_pool - the field password is now correctly marked as a


sensitive value (#20061 )
Data Source: azurerm_batch_pool - the field ssh_private_key is now correctly
marked as a sensitive value (#20061 )
azurerm_api_management_identity_provider_twitter - the field api_key is now

correctly marked as a sensitive value (#20061 )


azurerm_cdn_frontdoor_origin_group - shim SDK to allow health_probe to be

passed as null (#20015 )


azurerm_container_group - fix dynamic setting dns_config crash issue (#20002 )
azurerm_container_registry_task - the field password is now correctly marked as a
sensitive value (#20061 )
azurerm_dev_test_windows_virtual_machine - the password field is now correctly

marked as a sensitive value (#20061 )


azurerm_federated_identity_credential - preent concurrent write to parent

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

marked as a sensitive value (#20061 )


azurerm_service_fabric_managed_cluster - the resource_group_name field is now

correctly marked as ForceNew (#20061 )


azurerm_spring_cloud_configuration_service - the field password is now correctly

marked as a sensitive value (#20061 )


azurerm_spring_cloud_configuration_service - the field private_key is now

correctly marked as a sensitive value (#20061 )


azurerm_static_site - the field api_key is now correctly marked as a sensitive

value (#20061 )
azurerm_storage_account - no longer silently ignores 404 error while reading

service properties (#19062 )


azurerm_storage_account - the infrastructure_encryption_enabled is now

supportted for premium accounts (#20028 )


azurerm_windows_web_app_slot - fixa bug where use_32_bit_worker would not be

set correctly (#20051 )

3.39.1 (January 13, 2023)


BUG FIXES:

azurerm_cosmosdb_sql_container - fixproperty included_path can not be removed

issue (#19998 )
azurerm_log_analytics - fixing crash during read (#20011 )

3.39.0 (January 12, 2023)


BREAKING CHANGES:

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

at the version specified by java_version . Defaults to false . Note: One of


java_embedded_server_enabled or tomcat_version is required when

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

at the version specified by java_version . Defaults to false . Note: One of


java_embedded_server_enabled or tomcat_version is required when

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

java_version - input validation is introduced based on supported values within

the service. Valid values are now: 8 , 11 , and 17 .

FEATURES:

New Data Source: azurerm_private_dns_resolver (#19885 )


New Data Source: azurerm_private_dns_resolver_dns_forwarding_ruleset
(#19941 )
New Data Source: azurerm_private_dns_resolver_forwarding_rule (#19947 )
New Data Source: azurerm_private_dns_resolver_inbound_endpoint (#19948 )
New Data Source: azurerm_private_dns_resolver_outbound_endpoint (#19950 )
New Data Source: azurerm_private_dns_resolver_virtual_network_link
(#19951 )
New Resource: azurerm_application_insights_standard_web_test (#19954 )
New Resource: azurerm_cost_anomaly_alert (#19899 )
New Resource: azurerm_lab_service_lab (#19852 )
New Resource: azurerm_lab_service_user (#19957 )
New Resource: azurerm_network_manager_subscription_connection (#19617 )
New Resource: azurerm_network_manager_management_group_connection (#19621 )
New Resource: azurerm_media_services_account_filter (#19964 )
New Resource:
azurerm_private_endpoint_application_security_group_association (#19825 )
New Resource: azurerm_sentinel_data_connector_threat_intelligence_taxii
(#19209 )
New Resource: azurerm_storage_account_local_user (#19592 )

ENHANCEMENTS:

siterecovery : refactoring to use github.com/hashicorp/go-azure-sdk (#19571 )


siterecovery : updating to API version 2021-11-01 (#19571 )
Data Source: azurerm_shared_image - add support for the purchase_plan block
(#19873 )
azurerm_kubernetes_cluster - add support for the vnet_integration_enabled and
subnet_id properties (#19438 )
azurerm_log_analytics_data_export_rule - destination_resource_id accepts an

Event Hub Namespace ID (#19868 )


azurerm_linux_web_app - support for the application_stack.go_version property

(#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

and install_patches properties (#19865 )


azurerm_monitor_diagnostic_setting - deprecate log in favour of enabled_log

(#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 ,

and condition_json properties (#19309 )


azurerm_spring_cloud_gateway - support for the

application_performance_monitoring_types , environment_variables , and


sensitive_environment_variables properties (#19884 )
azurerm_storage_account - support for the allowed_copy_scope property

(#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

longer used by the service (#19685 )


azurerm_windows_web_app - the python property supersedes python_version .

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

tomcat_version and java_embedded_server_enabled (#19685 )


azurerm_windows_web_app - the java_container_version property This property is

deprecated in favour of tomcat_version and java_embedded_server_enabled


(#19685 )
azurerm_windows_web_app - the current_stack property is now computed if 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 - 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

no longer used by the service (#19685 )


azurerm_windows_web_app_slot - the python property supersedes python_version .

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

favour of tomcat_version and java_embedded_server_enabled (#19685 )


azurerm_windows_web_app_slot - the java_container_version property This

property is deprecated in favour of tomcat_version and


java_embedded_server_enabled (#19685 )
azurerm_windows_web_app_slot - the current_stack property now is computed if

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:

azurerm_app_configuration_feature - handle updates correctly where the label ID

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

expand resulting in the config not being sent (#19685 )


azurerm_linux_web_app - prevent a bug where health_check_eviction_time_in_min

would not be correctly read back from the service (#19685 )


azurerm_linux_web_app_slot - prevent a bug where backup_config could silently fail

to expand resulting in the config not being sent (#19685 )


azurerm_linux_web_app_slot - prevent a bug where

health_check_eviction_time_in_min would not be correctly read back from the

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

list keys is missing (#19645 )


azurerm_storage_data_lake_gen2_path - ace generated by default are no longer

stored in state to prevent perpetual state diffs (#18494 )


azurerm_storage_data_lake_gen2_filesystem - ace generated by default are no

longer stored in state to prevent perpetual state diffs (#18494 )


azurerm_web_pubsub_hub - the event_handler property is now a list instead of set to

respect the input order (#19886 )


azurerm_windows_web_app - prevent a bug where backup_config could silently fail

to expand resulting in the config not being sent (#19685 )


azurerm_windows_web_app - prevent a bug where

health_check_eviction_time_in_min would not be correctly set on Crete or Update

(#19685 )
azurerm_windows_web_app_slot - prevent a bug where backup_config could silently

fail to expand resulting in the config not being sent (#19685 )


azurerm_windows_web_app_slot - prevent a bug where

health_check_eviction_time_in_min would not be correctly set on Crete or Update

(#19685 )

3.38.0 (January 05, 2023)


FEATURES:

New Data Source: azurerm_marketplace_agreement (#19628 )


New Data Source: azurerm_network_manager_network_group (#19593 )
New Data Source: azurerm_virtual_hub_route_table (#19628 )

ENHANCEMENTS:

dependencies: updating to v0.20230105.1121404 of github.com/hashicorp/go-


azure-sdk (#19872 )
dependencies: updating to v0.20221207.1110610 of
github.com/tombuildsstuff/kermit (#19698 )
azurerm_dedicated_host - add support for LSv3-Type1 type (#19875 )
azurerm_proximity_placement_group - support for the allowed_vm_sizes and zone

properties (#19675 )

BUG FIXES:

azurerm_automation_software_update_configuration - correctly handle empty

expiry_time api values (#19774 )


azurerm_app_service_connection - polling until the resource is fully created,

updated and deleted (#19792 )


azurerm_batch_pool - correctly handle the resource being deleted outside of

terraform (#19780 )
azurerm_billing_account_cost_management_export - marking the resource as gone

when it's no longer present in Azure (#19871 )


azurerm_bot_service_azure_bot - marking the resource as gone when it's no

longer present in Azure (#19871 )


azurerm_databricks_access_connector - polling until the resource is fully created,

updated and deleted (#19792 )


azurerm_databricks_access_connector - marking the resource as gone when it's no

longer present in Azure (#19871 )


azurerm_datadog_monitor_sso_configuration - polling until the resource is fully

created and deleted (#19792 )


azurerm_hdinsight_kafka_cluster - the kafka_management_node property is

deprecated and will be removed in v4.0 (#19423 )


azurerm_kubernetes_cluster - scale_down_mode of the default node pool can now

be updated without rebuilding the entire cluster (#19823 )


azurerm_orbital_contact_profile - polling until the resource is fully created,

updated and deleted (#19792 )


azurerm_orbital_spacecraft - polling until the resource is fully created, updated

and deleted (#19792 )


azurerm_postgresql_flexible_server - correctly handle password authentication
(#19800 )
azurerm_resource_group_cost_management_export - marking the resource as gone

when it's no longer present in Azure (#19871 )


azurerm_spring_cloud_connection - polling until the resource is fully updated and

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

property is now optional when MSI auth is used (#19676 )


azurerm_storage_account_network_rules - the requires import check no longer

checks the bypass field to workaround an issue within the Azure API (#19719 )
azurerm_subscription_cost_management_export - marking the resource as gone

when it's no longer present in Azure (#19871 )


azurerm_synapse_linked_service - report error during create/update (#19849 )
azurerm_virtual_desktop_application_group - changing the host_pool_id now

creates a new resource (#19689 )


azurerm_vmware_express_route_authorization - marking the resource as gone

when it's no longer present in Azure (#19871 )

3.37.0 (December 21, 2022)


FEATURES:

New Resource: azurerm_cognitive_deployment (#19526 )


New Resource: azurerm_billing_account_cost_management_export (#19723 )
New resource: azurerm_key_vault_certificate_contacts (#19743 )
New Resource: azurerm_lab_service_plan (#19312 )
New Resource: azurerm_resource_deployment_script (#19436 )
New Resource: azurerm_spring_cloud_customized_accelerator (#19736 )

ENHANCEMENTS:

azurerm_netapp_volume - support for the zone property (#19669 )

BUG FIXES:

azurerm_app_configuration_key - fixa regression when handling IDs containing a :

(#19722 )
azurerm_virtual_network_gateway_connection - can now be created with a

azurerm_virtual_network_gateway in another resource group (#19699 )

3.36.0 (December 15, 2022)


FEATURES:

New Resource: azurerm_virtual_machine_packet_capture (#19385 )


New Resource: azurerm_virtual_machine_scale_set_packet_capture (#19385 )
New Resource: azurerm_spring_cloud_accelerator (#19572 )
New Resource: azurerm_spring_cloud_dev_tool_portal (#19568 )
New Resource: azurerm_route_map (#19402 )
New Data Source: azurerm_lb_outbound_rule (#19345 )

ENHANCEMENTS:

healthbot : refactoring to use github.com/hashicorp/go-azure-sdk (#19433 )


media : updating to API version 2021-11-01 and 2022-08-01 (#19623 )
azurerm_cosmosdb_account - support for updating some capabilities (#14991 )
azurerm_key_vault_managed_hardware_security_module - support for the
public_network_access_enabled and network_acls properties (#19640 )
azurerm_kubernetes_cluster - support for the monitor_metrics block (#19530 )
azurerm_kubernetes_cluster - the ssh_key property can now be updated

(#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

allow_resource_only_permissions property (#19346 )


azurerm_private_endpoint - support for the member_name property in the

ip_configuration block and support for multiple ip_configuration blocks

(#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

outbound_route_map_id properties (#19681 )


azurerm_point_to_site_vpn_gateway - support for the

routing_preference_internet_enabled , inbound_route_map_id , and

outbound_route_map_id properties (#19672 )


azurerm_web_application_firewall_policy - support the rule property in the

rule_group_override block (#19497 )

BUG FIXES:

Data Source: azurerm_api_management - prevent failure when retrieving tenant


access properties when permissions are missing (#19626 )
azurerm_cdn_frontdoor_firewall_policy - allow Log as a valid value for managed

rule override action in DRS 2.0 and above (#19637 )


azurerm_cosmosdb_account - enabling analytical_storage_enabled no longer forces

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

now be correctly set as empty (#19670 )


azurerm_synapse_linked_service - add validation for type (#19636 )
azurerm_resource_policy_exemption - changing the policy_assignment_id property

not created a new resource (#19674 )


azurerm_resource_group_policy_exemption - changing the policy_assignment_id

property not created a new resource (#19674 )


azurerm_subscription_policy_exemption - changing the policy_assignment_id

property not created a new resource (#19674 )


azurerm_stream_analytics_output_mssql - the user and password properties are

not optional when using MSI authentication (#19696 )

3.35.0 (December 09, 2022)


BREAKING CHANGES:

azurerm_stream_analytics_output_blob - the field batch_min_rows is now an

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:

New Resource: azurerm_digital_twins_time_series_database_connection


(#19576 )
New Resource: azurerm_network_manager (#19334 )
New Resource: azurerm_spring_cloud_application_live_view (#19495 )
New Resource: azurerm_sentinel_data_connector_microsoft_threat_protection
(#19162 )
New Resource: azurerm_vmware_netapp_volume_attachment (#19082 )

ENHANCEMENTS:

dependencies: updating to v0.20221207.1121859 of github.com/hashicorp/go-


azure-sdk (#19602 )
lighthouse : updating to API version 2022-10-01 (#19499 )
proximityplacementgroups : updating to API Version 2022-03-01 (#19537 )
Data Source: azurerm_kubernetes_cluster - support for the storage_profile block
(#19396 )
azurerm_firewall_policy - support for the explicit_proxy block and

auto_learn_private_ranges_mode property (#19313 )


azurerm_kubernetes_cluster - support for the custom_ca_trust_enabled property

(#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:

Data Source: azurerm_sentinel_alert_rule_template : Set custom ID rather than


using ID returned from API (#19580 )
azurerm_app_service_connection - correctly pass the secret to the service

(#19519 )
azurerm_automation_software_update_configuration - fixissue where omitting

tags and tag_filter result in an error (#19516 )


azurerm_automation_source_control - a state migration to work around the

previously incorrect id casing (#19506 )


azurerm_automation_webhook - a state migration to work around the previously

incorrect id casing (#19506 )


azurerm_container_registry_webhook - added a state migration to work around the
previously incorrect id casing (#19507 )
azurerm_frontdoor_rules_engine - a state migration to work around the previously

incorrect id casing (#19512 )


azurerm_healthcare_* - added a state migration to work around the previously

incorrect id casing (#19511 )


azurerm_iothub_* - added a state migration to work around the previously

incorrect id casing (#19524 )


azurerm_key_vault - allow for keyvaults in two different subscriptions (#19531 )
azurerm_key_vault_certificate - skip purging during deletion if the parent key

vault has purge protection enabled (#19528 )


azurerm_key_vault_key - skip purging during deletion if the parent key vault has

purge protection enabled (#19528 )


azurerm_key_vault_managed_hardware_security_module - skip purging during

deletion if the parent key vault has purge protection enabled (#19528 )
azurerm_key_vault_secret - skip purging during deletion if the parent key vault

has purge protection enabled (#19528 )


azurerm_lb - adding/removing a frontend configuration no longer forces

recreation a new resource to be created (#19548 )


azurerm_kusto_* - added a state migration to work around the previously incorrect

id casing (#19525 )
azurerm_media_services_account - fixing an issue in the state upgrade where the

Resource ID was being parsed incorrectly (#19578 )


azurerm_mssql_elasticpool - Prevent license_type from being configured in

specific scenarios (#19586 )


azurerm_monitor_smart_detector_alert_rule - added a state migration to work

around the previously incorrect id casing (#19513 )


azurerm_spring_cloud_* - added a state migration to work around the previously

incorrect id casing (#19564 )


azurerm_stream_analytics_output_blob - the field batch_min_rows is now an

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 )

3.34.0 (December 01, 2022)


ENHANCEMENTS:

dependencies: updating to v0.20221129.1175354 of github.com/hashicorp/go-


azure-sdk (#19483 )
media : refactoring to use github.com/hashicorp/go-azure-sdk (#19285 )
springcloud : updating to use API Version 2022-11-01-preview (#19445 )
streamanalytics : refactoring to use github.com/hashicorp/go-azure-sdk

(#19395 )
synapse : refactoring to use github.com/tombuildstuff/kermit rather than the

embedded sdk (#19484 )


Data Source: azurerm_api_management - support for tenant_access property
(#19422 )
azurerm_kusto_database - supports underscores in the name (#19466 )
azurerm_managed_disk - support for upload_size_bytes property (#19458 )
azurerm_monitor_activity_log_alert - action is now supplied as a list instead of a

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 - support for the

tier_to_cool_after_days_since_creation_greater_than ,
tier_to_archive_after_days_since_creation_greater_than ,

delete_after_days_since_creation_greater_than properties (#19446 )

BUG FIXES:

data.azurerm_sentinel_alert_rule_template - a state migration to work around

the previously incorrect id casing (#19487 )


azurerm_app_configuration_key - prevent crash when retrieving the key value

(#19464 )
azurerm_data_factory_linked_service_azure_file_storage - send host and and

user_id in the payload only when it's been set (#19468 )


azurerm_eventgrid_topic - fixsetting of fields in input_mapping_fields during read

(#19494 )
azurerm_iot_security_solution - a state migration to work around the previously

incorrect id casing (#19489 )


azurerm_monitor_autoscale_setting - a state migration to work around the

previously incorrect id casing (#19492 )


azurerm_sentinel_automation_rule - a state migration to work around the

previously incorrect id casing (#19487 )


azurerm_sql_active_directory_administrator - a state migration to work around

the previously incorrect id casing (#19486 )


azurerm_stream_analytics_output_eventhub - shared_access_policy_key and

shared_access_policy_name are now optional (#19447 )


azurerm_synapse_integration_runtime_azure - a state migration to work around

the previously incorrect id casing (#19485 )


azurerm_synapse_integration_runtime_self_hosted - a state migration to work

around the previously incorrect id casing (#19485 )


azurerm_synapse_linked_service - a state migration to work around the previously

incorrect id casing (#19477 )


azurerm_windows_web_app - fixcurrentStack is being reset when other site_config

values are changed. (#18568 )


azurerm_windows_web_app_slot - fixcurrentStack is being reset when other

site_config values are changed. (#18568 )


azurerm_windows_virtual_machine_scale_set Fix crash when upgrading
automatic_os_upgrade_policy (#19465 )

3.33.0 (November 24, 2022)


FEATURES:

New Data Source: azurerm_cdn_frontdoor_custom_domain (#19357 )


New Resource: azurerm_mssql_managed_instance_transparent_data_encryption
(#18918 )
New Resource:
azurerm_postgresql_flexible_server_active_directory_administrator (#19269 )

ENHANCEMENTS:

build: updating to use Go 1.19.3 (#19362 )


dependencies: updating to v0.20221122.1115312 of github.com/hashicorp/go-
azure-sdk (#19412 )
dependencies: upgrading to v2.24.1 of github.com/hashicorp/terraform-plugin-
sdk (#19303 )
cognitive : updating to API Version 2022-10-01 (#19344 )
springcloud : updating to API Version 2022-09-01-preview (#19340 )
Data Source: azurerm_mssql_managed_instance - support for
customer_managed_key_id attribute and user-assigned identity (#18918 )
azurerm_cognitive_account - support for dynamic_throttling_enabled (#19371 )
azurerm_databricks_workspace - support for storage_account_identity property in

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:

azurerm_application_insights - validating/normalizing the workspace_id as a

Workspace ID (#19325 )
azurerm_cdn_frontdoor_rule - allow cache_duration to be null if cache_behavior

is set to HonorOrigin (#19378 )


azurerm_monitor_alert_processing_rule_action_group -

condition.x.monitor_condition can be correctly specified alone (#19338 )


azurerm_monitor_alert_processing_rule_suppression -
condition.x.monitor_condition can be correctly specified alone (#19338 )
azurerm_mysql_flexible_server - increase validation max value for the iops

property (#19419 )
azurerm_servicebus_subscription_rule - correlation_filter with empty attributes

no longer crashes (#19352 )


azurerm_storage_account - fix crash in multichannel checking (#19298 )
azurerm_storage_account - prevent both blob_properties.0.versioning_enabled

and is_hns_enabled being set to true (#19418 )

3.32.0 (November 17, 2022)


DEPRECATIONS

The azurerm_integration_service_environment resource is now deprecated as the


underlying Azure Service is being retired on 2024-08-31 and new instances cannot
be provisioned (by default) after 2022-11-01 (#19265 )

ENHANCEMENTS:

dependencies: updating to v0.20221116.1175352 of github.com/hashicorp/go-


azure-sdk (#19319 )
azurerm_security_center_subscription_pricing - support for the subplan property

(#19273 )
azurerm_storage_account - support for the sas_policy block (#19222 )
azurerm_windows_web_app , azurerm_windows_web_app_slot - aupport for 17 value

for java_version property (#19249 )


azurerm_storage_blob_inventory_policy - support for include_deleted property

(#19286 )

BUG FIXES:

azurerm_app_service_public_certificate - add custom poller to prevent Root

resource was present, but now absent. result (#19348 )


azurerm_eventhub_namespace - correct zone_redundant property (#19164 )
azurerm_orchestrated_virtual_machine_scale_set - allow no image to be specified

(#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 )

3.31.0 (November 10, 2022)


FEATURES:

New Resource: azurerm_federated_identity_credential (#19199 )


New Resource: azurerm_stream_analytics_stream_input_eventhub_v2 (#19150 )

ENHANCEMENTS

dependencies: updating to v0.20221108.1145701 of github.com/hashicorp/go-


azure-sdk (#19193 )
dependencies: updating network to API Version 2022-05-01 (#19124 )
dependencies: updating sentinel to API Version 2022-10-01-preview (#19161 )
azurerm_disk_encryption_set - support for the federated_client_id property

(#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

ddos_protection_plan_id properties (#19206 )


azurerm_sentinel_alert_rule_nrt - support for the techniques property

(#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:

azurerm_cdn_frontdoor_route - update read function to parse

cdn_frontdoor_origin_group_id insensitively (#19178 )


azurerm_cdn_frontdoor_rule - update url_redirect_action to allow query_string

field to pass multiple query string parameters (#19180 )


azurerm_cdn_frontdoor_profile - the response_timeout_seconds property is no

longer force new (#19175 )


3.30.0 (November 03, 2022)
FEATURES:

New Resource: azurerm_kubernetes_fleet_manager (#19111 )


New Resource: azurerm_mssql_server_microsoft_support_auditing_policy
(#18609 )
New Resource: azurerm_private_dns_resolver_virtual_network_link (#19029 )
New Resource: azurerm_private_dns_resolver_forwarding_rule (#19028 )

ENHANCEMENTS

dependencies: iothub updating to 2022-04-30-preview (#19070 )


dependencies: updating to v0.47.0 of github.com/hashicorp/go-azure-helpers
(#19107 )
dependencies: updating to v0.20221102.1171058 of github.com/hashicorp/go-
azure-sdk (#19108 )
webpubsub: refactoring to use github.com/hashicorp/go-azure-sdk (#18892 )
Data Source: azurerm_application_gateway - export the backend_address_pool
block (#19026 )
Data Source: azurerm_function_app_host_keys - export webpubsub_extension_key
property (#19073 )
azurerm_iothub - support for DigitalTwinChangeEvents as source and

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

protected_settings_from_key_vault blovk (#19098 )


azurerm_linux_virtual_machine_scale_set - support for StandardSSD_ZRS ,
PremiumV2_LRS , and Premium_ZRS storage account types (#19091 )
azurerm_mssql_virtual_machine - support for the system_db_on_data_disk_enabled

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

protected_settings_from_key_vault blovk (#19098 )


azurerm_windows_virtual_machine_scale_set - support for StandardSSD_ZRS ,

PremiumV2_LRS , and Premium_ZRS storage account types (#19091 )

BUG FIXES:

Data Source: azurerm_app_configuration_keys - fixa crash when label is not set


(#19032 )
azurerm_api_management - correct the api return subnet_id with the wrong case

(#18988 )
azurerm_cdn_frontdoor_firewall_policy - expose AnomalyScoring in override rule

action for DRS 2.0 (#19095 )


azurerm_eventhub_namespace_disaster_recovery_config - now correctly breaks the
pairing (#19030 )
azurerm_kubernetes_cluster - set a valid default value for
auto_scaler_profile.expander (#19057 )
azurerm_linux_virtual_machine_scale_set - can now set
automatic_os_upgrade_policy with rolling upgrades enables (#18605 )
azurerm_mssql_database - handle the license_type property no longer being

returned by API (#19084 )


azurerm_postgresql_flexible_server_database - is now correctly removed from

state on deletion (#19081 )


azurerm_virtual_network_gateway_connection - correctly set authorization_key

from state as the API returnes * s (#19071 )


azurerm_windows_virtual_machine_scale_set - can now set
automatic_os_upgrade_policy with rolling upgrades enables (#18605 )

3.29.1 (October 28, 2022)


BUG FIXES:

azurerm_kubernetes_cluster - prevent panic when setting

public_network_access_enabled (#19048 )

3.29.0 (October 27, 2022)


FEATURES:

New Data Source: azurerm_api_management_gateway_host_name_configuration


(#17166 )
New Data Source: azurerm_cdn_frontdoor_firewall_policy (#18903 )
New Resource: azurerm_datadog_monitor_tag_rule (#17825 )
New Resource: azurerm_datadog_monitor_sso_configuration (#17825 )
New Resource: azurerm_iothub_device_update_account (#18789 )
New Resource: azurerm_iothub_device_update_instance (#18789 )
New Resource: azurerm_nginx_configuration (#18761 )
New Resource: azurerm_nginx_certificate (#18762 )
New Resource: azurerm_private_dns_resolver (#18473 )
New Resource: azurerm_private_dns_resolver_dns_forwarding_ruleset (#19012 )
New Resource: azurerm_private_dns_resolver_inbound_endpoint (#18983 )
New Resource: azurerm_private_dns_resolver_outbound_endpoint (#18986 )

ENHANCEMENTS:

Dependencies compute - updating to 2022-08-01 (#18994 )


Dependencies containerinstance - updating to 2021-10-01 (#17785 )
Dependencies: update go-azure-helpers to v0.45.0 (#18968 )
containerservice: refactoring to use github.com/hashicorp/go-azure-sdk
(#18705 )
customproviders - refactoring to use github.com/hashicorp/go-azure-sdk
(#18978 )
snapshot - refactoring to use github.com/hashicorp/go-azure-sdk (#18957 )
disks: refactoring to use github.com/hashicorp/go-azure-sdk (#18928 )
Data Source: azurerm_storage_management_policy - add support for
tier_to_archive_after_days_since_last_tier_change_greater_than (#18898 )
azurerm_container_group - the network_profile_id property hasbeen deprecated

in favour of subnet_ids as the newer versions of the API no longer support it


(#17785 )
azurerm_cdn_frontdoor_rule - allow the cdn_frontdoor_origin_group_id field to be

optional in the route_configuration_override_action (#18906 )


azurerm_cdn_frontdoor_rule - expose Disabled as a possible value of
cache_behavior in the route_configuration_override_action (#18906 )
azurerm_disk_encryption_set - support for identities UserAssigned and

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

Azure Storage Account configurations (#18760 )


azurerm_logic_app_action_http - support for the queries property (#18934 )
azurerm_monitor_scheduled_query_rules_alert_v2 - add evaluation_frequency ,

window_duration , mute_actions_after_alert_duration , and


query_time_range_override validation (#18960 )
azurerm_mssql_virtual_machine - =support for the assessment block (#18923 )
azurerm_mssql_server_transparent_data_encryption - support for autorotation of

keyvault keys (#18523 )


azurerm_logic_app_standard - support for the scm_ip_restriction block and the
scm_use_main_ip_restriction , scm_min_tls_version , scm_type properties

(#18853 )
azurerm_postgresql_server - can now set public_network_access_enabled during

creation when point in time restore is used (#18962 )


azurerm_servicebus_namespace_disaster_recovery_config - support the
alias_authorization_rule_id property (#18729 )
azurerm_synapse_workspace - sql_administrator_login and
sql_administrator_login_password are now no longer required for the creation of

this resource (#18850 )


azurerm_synapse_workspace - enable user assigned managed identity (#19007 )
azurerm_windows_function_app - support for using storage_account external Azure

Storage Account configurations (#18760 )


azurerm_windows_function_app - support for Java 17 (#18689 )
azurerm_windows_function_app_slot - support for using storage_account external

Azure Storage Account configurations (#18760 )

BUG FIXES:

provider: no longer automatically registers the Microsoft.StoragePool provider as


Azure has halted the preview of Azure Disk Pools, and it's not generally available
(#18905 )
azurerm_app_configuration_keys - now correctly retrieves result if more than 100

entries are returned (#19020 )


azurerm_data_factory_dataset_parquet - azure_blob_storage_location.path and
http_server_location.path are now Optional (#19009 )
azurerm_disk_pool - is deprecated as Azure has halted the preview of Azure Disk

Pools, and it isn't to be made generally available (#18905 )


azurerm_disk_pool_iscsi_target - is deprecated as Azure has halted the preview

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

renamted to gallery_application (#19014 )


azurerm_managed_disk - logical_sector_size , disk_iops_read_write ,
disk_mbps_read_write , disk_iops_read_only and disk_mbps_read_only can be set

when storage_account_type is PremiumV2_LRS (#18991 )


azurerm_monitor_data_collection_rule - correctly support streams (#18966 )
azurerm_netapp_volume - correctly set snapshot ID when

create_from_snapshot_resource_id is specified (#18996 )


azurerm_key_vault_certificate - new versions of key vault certs can now be

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

renamted to gallery_application (#19014 )

3.28.0 (October 20, 2022)


FEATURES:

New Data Source: azurerm_cdn_frontdoor_secret (#18817 )


New Resource: azurerm_databricks_access_connector (#18709 )
New Resource: azurerm_sentinel_data_connector_dynamics_365 (#18859 )
New Resource: azurerm_sentinel_data_connector_iot (#18862 )
New Resource: azurerm_sentinel_data_connector_office_365_project (#18858 )
New Resource: azurerm_sentinel_data_connector_office_irm (#18856 )
New Resource: azurerm_sentinel_data_connector_office_power_bi (#18857 )

ENHANCEMENTS:

dependencies: updating to v0.20221018.1075906 of github.com/hashicorp/go-


azure-sdk (#18833 )
azurestackhci : updating to API Version 2022-09-01 (#18759 )
Data Source: azurerm_linux_function_app - add support for
client_certificate_exclusion_paths (#16603 )
Data Source: azurerm_linux_web_app - add support for
client_certificate_exclusion_paths (#16603 )
Data Source: azurerm_windows_function_app - add support for
client_certificate_exclusion_paths (#16603 )
Data Source: azurerm_windows_web_app - add support for
client_certificate_exclusion_paths (#16603 )
azurerm_cdn_frontdoor_firewall_policy - managed rules can now exclude

matches on RequestBodyJsonArgNames (#18874 )


azurerm_cosmosdb_account - support for the primary_sql_connection_string ,
secondary_sql_connection_string , primary_readonly_sql_connection_string , and

secondary_readonly_sql_connection_string attributes (#17810 )


azurerm_fluid_relay_server - support for the service_endpoint property

(#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

client_certificate_exclusion_paths property (#16603 )


azurerm_linux_function_app - add VS2022 to remote_debugging_version valid

values (#18684 )
azurerm_linux_function_app_slot - add support for the

client_certificate_exclusion_paths property (#16603 )


azurerm_linux_web_app - add support for the client_certificate_exclusion_paths

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

client_certificate_exclusion_paths property (#16603 )


azurerm_windows_function_app - add VS2022 to remote_debugging_version valid

values (#18684 )
azurerm_windows_function_app_slot - add support for the

client_certificate_exclusion_paths correctly (#16603 )


azurerm_windows_web_app - add support for the
client_certificate_exclusion_paths correctly (#16603 )
azurerm_windows_web_app_slot - add support for the
client_certificate_exclusion_paths correctly (#16603 )

BUG FIXES:
azurerm_automation_software_update_configuration - parse subscription IDs

correctly when set in scope (#18860 )


azurerum_cdn_frontdoor_route - fixa panic on import (#18824 )
azurerm_eventhub_namespace - ignore case for

network_rulesets.x.virtual_network_rule.x.subnet_id (#18818 )
azurerm_firewall_policy_rule_collection_group - limit the number of destination

ports in a NAT rule to one (#18766 )


Data Source: azurerm_linux_function_app - fixmissing error on data source not
found (#18876 )
azurerm_linux_function_app - fixan issue where app_settings would show a diff

when setting vnet_route_all_enabled to true (#18836 )


azurerm_linux_function_app_slot - fixan issue where app_settings would show a

diff when setting vnet_route_all_enabled to true (#18836 )


azurerm_linux_virtual_machine - allow disabling secure boot when creating a

virtual machine with disk encryption type VMGuestStateOnly (#18749 )


azurerm_linux_virtual_machine_scale_set - allow disabling secure boot when

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

the default value when the identity block is updated (#18871 )


azurerm_windows_virtual_machine - allow disabling secure boot when creating a

virtual machine with disk encryption type VMGuestStateOnly (#18749 )


azurerm_windows_function_app - fixan issue where app_settings would show a diff

when setting vnet_route_all_enabled to true (#18836 )


azurerm_windows_function_app_slot - fixan issue where app_settings would show

a diff when setting vnet_route_all_enabled to true (#18836 )


azurerm_windows_web_app - fixparsing of docker_container_name and

docker_container_registry on read (#18251 )

3.27.0 (October 13, 2022)


BREAKING CHANGES:
azurerm_cdn_frontdoor_custom_domain - removed the
associate_with_cdn_frontdoor_route_id field to allow for a custom domain to be

associated with multiple routes. (#18600 )

FEATURES:

New DataSource: data.azurerm_cosmosdb_sql_role_definition (#18728 )


New DataSource: data.azurerm_cosmosdb_sql_database (#18728 )
New Resource: azurerm_cdn_frontdoor_custom_domain_association (#18600 )
New Resource: azurerm_nginx_deployment (#18510 )
New Resource: azurerm_orbital_contact_profile (#18317 )
New Resource: azurerm_sentinel_data_connector_office_atp (#18708 )

ENHANCEMENTS:

dependencies: updating to version v0.44. of github.com/hashicorp/go-azure-


helpers (#18716 )
dependencies: updating to version v0.50.0 of github.com/manicminer/hamilton
(#18716 )
azurerm_automation_runbook - support for the draft block and
log_activity_trace propertry (#17961 )
azurerm_app_configuration - support for the encrption , local_auth_enabled ,
public_network_access_enabled , purge_protection_enabled , and

soft_delete_retention_days properties (#17714 )


azurerm_api_management_api - support for the contact and license blocks
(#18472 )
azurerm_cdn_frontdoor_route - exposed cdn_frontdoor_custom_domain_ids and
link_to_default_domain (#18600 )
azurerm_data_factory_integration_runtime_azure_ssis - support for
elastic_pool_namr property (#18696 )
azurerm_dedicated_hardware_security_module - support the

management_network_profile block (#18702 )


azurerm_hdinsight_hadoop_cluster , - support for the script_actions block

(#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

authentication_mode property (#18491 )

BUG FIXES:

azurerm_kubernetes_cluster - orchestrator_version is set properly for clusters

created with an older API version (#18130 )


azurerm_kubernetes_cluster_node_pool - orchestrator_version is set properly for

node pools created with an older API version (#18130 )


azurerm_log_analytics_cluster - fixing an issue when checking for the presence of

an existing Log Analytics Cluster (#18700 )


azurerm_logic_app_workflow - can now be updated when associated with

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 )

3.26.0 (October 06, 2022)


BREAKING CHANGES:

azurerm_load_test - the computed attribute dataplane_uri is renamed to

data_plane_uri for consistency (#18654 )

FEATURES:

New Resource: azurerm_iotcentral_application_network_rule_set (#18589 )

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 ,

managed_outbound_ipv6_count , scale_down_mode and workload_runtime properties

(#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:

azurerm_linux_function_app_slot - read app settings from the correct endpoint

(#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 )

3.25.0 (September 29, 2022)


FEATURES:

New Resource: azurerm_cdn_frontdoor_route (#18231 )


New Resource: azurerm_cdn_frontdoor_custom_domain (#18231 )
New Resource: azurerm_cdn_route_disable_link_to_default_domain (#18231 )

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

is deprecated in favour of the classifications property that supports multiple


values (#18539 )
azurerm_healthcare_fhir_service - support for the oci_artifact block (#18571 )
azurerm_healthcare_fhir - support for the public_network_access_enabled

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

public_network_access_enabled and v1_legacy_mode properties (#18469 )


azurerm_storage_account - support for the multichannel_enabled property

(#17999 )
azurerm_virtual_hub_bgp_connection - support for the

virtual_network_connection_id property (#18469 )


azurerm_windows_virtual_machine - support for the gallery_application property

(#18406 )

BUG FIXES:

Data Source: azurerm_key_vault_certificate_data - correctly create PEM private


key block header for EC keys (#18419 )
azurerm_log_analytics_linked_storage_account - correctly data_source_type case

handling (#18116 )

3.24.0 (September 22, 2022)


FEATURES:
New Resource: azurerm_automation_software_update_configuration (#17902 )
New Resource: azurerm_monitor_alert_processing_rule_action_group (#17006 )
New Resource: azurerm_monitor_alert_processing_rule_suppression (#17006 )

ENHANCEMENTS:

dependencies: updating to version v0.20220916.1125744 of


github.com/hashicorp/go-azure-sdk (#18446 )
dependencies: disks - updating to use 2022-03-02 (#17671 )
Data Source: azurerm_automation_account - exports the identity attribute
(#18478 )
Data Source: azurerm_storage_account - export the
azure_files_identity_based_auth property (#18405 )
azurerm_api_management_api_operation - support the example , schema_id , and

type_name properties (#18409 )


azurerm_cognitive_account - support for the customer_managed_key property

(#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

failure_suppression_enabled property (#18441 )


azurerm_windows_virtual_machine - support for the patch_assessment_mode

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

workspace_id property (#18467 )

3.23.0 (September 15, 2022)


FEATURES:

New Data Source: azurerm_private_dns_zone_virtual_network_link (#18045 )


New Data Source: azurerm_monitor_data_collection_rule (#18318 )

ENHANCEMENTS:

azurerm_api_management_api_schema - support for the components and definitions

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

for vNet integration (#17731 )


azurerm_management_group_policy_remediation - the policy_definition_id

property is deprecated in favour of the more accuractly named


policy_definition_reference_id property (#18037 )
azurerm_resource_policy_remediation - the policy_definition_id property is

deprecated in favour of the more accuractly named


policy_definition_reference_id property (#18037 )
azurerm_resource_group_policy_remediation - the policy_definition_id property

is deprecated in favour of the more accuractly named


policy_definition_reference_id property (#18037 )
azurerm_subscription_policy_remediation - the policy_definition_id property is

deprecated in favour of the more accuractly named


policy_definition_reference_id property (#18037 )

BUG FIXES:

azurerm_netapp_volume : add extra validation when

data_protection_snapshot_policy.0. snapshot_policy_id is empty (#18348 )

3.22.0 (September 08, 2022)


FEATURES:

New Resource: azurerm_api_management_api_tag_description (#17876 )


New Resource: azurerm_api_management_schema (#18158 )
New Resource: azurerm_automation_watcher (#17927 )
New Resource: azurerm_automation_source_control (#18175 )
New Resource: azurerm_container_registry_token_password (#15939 )
New Resource: azurerm_monitor_data_collection_rule_association (#17948 )
New Resource: azurerm_orbital_spacecraft (#17860 )

ENHANCEMENTS:

dependencies: updating to version v0.20220907.1111434 of


github.com/hashicorp/go-azure-sdk (#18282 )
dependencies: desktopvirtualization - updating to use 2022-02-10 (#17489 )
dependencies: iothub.dps - update to use hashicorp/go-azure-sdk (#18299 )
azurerm_api_management_api - the soap_pass_through property is deprecated in

favour of the api_type property (#17812 )


azurerm_kubernetes_cluster - support for the edge_zone property (#18115 )
azurerm_kubernetes_cluster - support for the windows_profile.gmsa block

(#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:

azurerm_mssql_database - the license_type property is now also Computed

(#18230 )
azurerm_log_analytics_solution - a state migration to work around the previously

incorrect id casing (#18291 )

3.21.1 (September 02, 2022)


BREAKING CHANGES:

azurerm_container_registry - the field


azuread_authentication_as_arm_policy_enabled is removed to fix a regression -

support for this will be reintroduced in a future release.


azurerm_container_registry - the field soft_delete_policy is removed to fix a

regression - support for this will be reintroduced in a future release.

NOTES:

the containerregistry api version is reverted to 2021-08-01-preview to restore the


virtual_network block meaning the
azuread_authentication_as_arm_policy_enabled and soft_delete_policy

properties had to be removed as they were not supported by the API version that
supported virtual network rules. (#18239 )

BUG FIXES:

azurerm_container_registry - the virtual_network block is restored (#18239 )


azurerm_log_analytics_data_export_rule - a state migration to work around the

previously incorrect id casing (#18240 )

3.21.0 (September 01, 2022)


FEATURES:

New Data Source: azurerm_monitor_data_collection_endpoint (#17992 )


New Resource: azurerm_app_service_connection (#16907 )
New Resource: azurerm_automation_hybrid_runbook_worker (#17893 )
New Resource: azurerm_api_management_gateway_certificate_authority
(#17879 )
New Resource: azurerm_api_management_gateway_host_name_configuration
(#17962 )
New Resource: azurerm_api_management_product_tag (#17798 )
New Resource: azurerm_automation_connection_type (#17538 )
New Resource: azurerm_automation_hybrid_runbook_worker_group (#17881 )
New Resource: azurerm_cdn_frontdoor_rule (#18010 )
New Resource: azurerm_cdn_frontdoor_secret (#18010 )
New Resource: azurerm_container_registry_task_schedule_run_now (#15120 )
New Resource: azurerm_cosmosdb_sql_dedicated_gateway (#18133 )
New Resource: azurerm_dashboard_grafana (#17840 )
New Resource: azurerm_healthcare_medtech_service (#15967 )
New Resource: azurerm_log_analytics_query_pack_query (#17929 )
New Resource: azurerm_spring_cloud_connection (#16907 )
New Resource: azurerm_search_shared_private_link_service (#17744 )
New Resource: azurerm_sentinel_alert_rule_nrt (#15999 )

ENHANCEMENTS:

dependencies: updating to version v0.20220830.1105041 of


github.com/hashicorp/go-azure-sdk (#18183 )
dependencies: log_analytics - update to use hashicorp/go-azure-sdk (#18098 )
azurerm_batch_pool - support for the mount property (#18042 )
azurerm_container_registry - support for the
azuread_authentication_as_arm_policy_enabled and soft_delete_policy

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

disk_encryption property (#17351 )


azurerm_hdinsight_hbase_cluster - add support for the disk_encryption property

(#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

host_group_id , and extension_operations_enabled (#17571 )


azurerm_linux_virtual_machine_scale_set - support for the data_disk block

property name (#17571 )


azurerm_linux_virtual_machine_scale_set - support for the scale_in block

properties rule , and force_deletion_enabled (#17571 )


azurerm_linux_virtual_machine_scale_set - support for the
rolling_upgrade_policy block properties cross_zone_upgrade_enabled , and

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

properties enabled , and timeout (#17571 )


azurerm_linux_virtual_machine_scale_set - support for the public_ip_address

block property version (#17571 )


azurerm_linux_virtual_machine_scale_set - 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 gallery_applications

code block (#17571 )


azurerm_linux_virtual_machine_scale_set - support for the gallery_applications

block properties configuration_reference_blob_uri , order , package_referenceId ,


and tag (#17571 )
azurerm_linux_virtual_machine_scale_set - deprecated the scale_in_policy

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

property rule (#17571 )


azurerm_management_group_policy_remediation - support for the resource_count ,
parallel_deployments , and failure_percentage properties (#17313 )
azurerm_monitor_diagnostic_setting - support for the category_group property

(#16367 )
azurerm_orchestrated_virtual_machine_scale_set - support for the following

properties capacity_reservation_group_id , single_placement_group , and


extension_operations_enabled (#17571 )
azurerm_orchestrated_virtual_machine_scale_set - support for the extension

block property suppress_failures_enabled (#17571 )


azurerm_orchestrated_virtual_machine_scale_set - support for the
additional_capabilities block property ultra_ssd_enabled (#17571 )
azurerm_orchestrated_virtual_machine_scale_set - support for the
public_ip_address block properties version , and sku_name (#17571 )
azurerm_orchestrated_virtual_machine_scale_set - support for

linux_configuration , and windows_configuration code blocks property


patch_assessment_mode (#17571 )
azurerm_orchestrated_virtual_machine_scale_set - the source_image_id property

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 ,

parallel_deployments , and failure_percentage properties (#17313 )


azurerm_resource_policy_remediation - support for the resource_count ,

parallel_deployments , and failure_percentage properties (#17313 )


azurerm_role_assignment - support for scope to start with
/providers/Subscription (#17456 )
azurerm_servicebus_namespace - support for the public_network_access_enabled

and minimum_tls_version properties (#17805 )


azurerm_storage_account - support for the public_network_access_enabled

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

authentication_mode property (#18096 )


azurerm_stream_analytics_output_powerbi - support for the
token_user_principal_name and token_user_display_name properties (#18117 )
azurerm_stream_analytics_output_cosmosdb - support for the partition_key

property (#18120 )
azurerm_stream_analytics_reference_input_blob - support for the

authentication_mode property (#18137 )


azurerm_stream_analytics_reference_input_mssql - support for the table property

(#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

property name (#17571 )


azurerm_windows_virtual_machine_scale_set - support for the scale_in block

properties rule , and force_deletion_enabled (#17571 )


azurerm_windows_virtual_machine_scale_set - support for the

rolling_upgrade_policy block properties cross_zone_upgrade_enabled , and

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

properties enabled , and timeout (#17571 )


azurerm_windows_virtual_machine_scale_set - support for the public_ip_address
block property version (#17571 )
azurerm_windows_virtual_machine_scale_set - 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

gallery_applications code block (#17571 )


azurerm_windows_virtual_machine_scale_set - support for the
gallery_applications block properties configuration_reference_blob_uri , order ,

package_referenceId , and tag (#17571 )


azurerm_windows_virtual_machine_scale_set - deprecated the scale_in_policy

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

property rule (#17571 )

BUG FIXES:
azurerm_kubernetes_cluster - kube_config is now set when Microsoft Entra ID is

enabled for a v1.24 cluster (#18142 )


azurerm_redis_cache - now recreates the cache when downgrading the SKU

(#17767 )
azurerm_spring_cloud_service - ignore the default zero value for

read_timeout_seconds (#18161 )

3.20.0 (August 25, 2022)


FEATURES:

Provider: support for generic OIDC authentication providers (#18118 )


New Resource: azurerm_backup_policy_vm_workload (#17765 )
New Resource: azurerm_monitor_scheduled_query_rules_alert_v2 (#17772 )

ENHANCEMENTS:

Dependencies: update go-azure-sdk to v0.20220824.1090858 (#18100 )


Dependencies: consumption - updating to use hashicorp/go-azure-sdk (#18101 )
azurerm_data_factory_dataset_json - filename and path in
azure_blob_storage_location block can now be empty (#18061 )

BUG FIXES:

data.azurerm_kubernetes_cluster - kube_config is now set when Microsoft Entra

ID is enabled for a v1.24 cluster (#18131 )


azurerm_cosmosdb_sql_database - prevent panic in autoacale settings (#18070 )
azurerm_kubernetes_cluster_node_pool - fixa crash in expanding upgrade settings

(#18074 )
azurerm_mssql_elastic_pool - list of values for maintenance_configuration_name is

now correct (#18041 )


azurerm_postgresql_flexible_server - point_in_time_restore_time_in_utc

correctly converts to RFC3339 (#18106 )

3.19.1 (August 19, 2022)


BUG FIXES:

azurerm_dns_a_record - parse resource IDs insensitively in the read functions due

to casing on the dnsZones segment (#18048 )


azurerm_dns_aaaa_record - parse resource IDs insensitively in the read functions

due to casing on the dnsZones segment (#18048 )


azurerm_dns_caa_record - parse resource IDs insensitively in the read functions due

to casing on the dnsZones segment (#18048 )


azurerm_dns_cname_record - parse resource IDs insensitively in the read functions

due to casing on the dnsZones segment (#18048 )


azurerm_dns_mx_record - parse resource IDs insensitively in the read functions due

to casing on the dnsZones segment (#18048 )


azurerm_dns_ns_record - parse resource IDs insensitively in the read functions due

to casing on the dnsZones segment (#18048 )


azurerm_dns_ptr_record - parse resource IDs insensitively in the read functions due

to casing on the dnsZones segment (#18048 )


azurerm_dns_srv_record - parse resource IDs insensitively in the read functions due

to casing on the dnsZones segment (#18048 )


azurerm_dns_txt_record - parse resource IDs insensitively in the read functions due

to casing on the dnsZones segment (#18048 )


azurerm_dns_zone - parse resource IDs insensitively in the read functions due to

casing on the dnsZones segment (#18048 )

3.19.0 (August 18, 2022)


FEATURES:

New Data Source: azurerm_dns_a_record (#17477 )


New Data Source: azurerm_dns_aaaa_record (#17477 )
New Data Source: azurerm_dns_caa_record (#17477 )
New Data Source: azurerm_dns_cname_record (#17477 )
New Data Source: azurerm_dns_mx_record (#17477 )
New Data Source: azurerm_dns_ns_record (#17477 )
New Data Source: azurerm_dns_ptr_record (#17477 )
New Data Source: azurerm_dns_soa_record (#17477 )
New Data Source: azurerm_dns_srv_record (#17477 )
New Data Source: azurerm_dns_txt_record (#17477 )
New Data Source: azurerm_private_dns_a_record (#18036 )
New Data Source: azurerm_private_dns_aaaa_record (#18036 )
New Data Source: azurerm_private_dns_cname_record (#18036 )
New Data Source: azurerm_private_dns_mx_record (#18036 )
New Data Source: azurerm_private_dns_ptr_record (#18036 )
New Data Source: azurerm_private_dns_soa_record (#18036 )
New Data Source: azurerm_private_dns_srv_record (#18036 )
New Data Source: azurerm_private_dns_txt_record (#18036 )
New Resource: azurerm_eventhub_namespace_schema_group (#17635 )
New Resource: azurerm_cdn_frontdoor_firewall_policy (#17715 )
New Resource: azurerm_cdn_frontdoor_security_policy (#17715 )
New Resource: azurerm_data_factory_flowlet_data_flow (#16987 )

ENHANCEMENTS:

Dependencies: update go-azure-helpers to v0.39.1 (#18015 )


Dependencies: update go-azure-sdk to v0.20220815.1092453 (#17998 )
Dependencies: dedicated_host_* to use hashicorp/go-azure-sdk (#17616 )
Dependencies: dataprotection : updating to use hashicorp/go-azure-sdk
(#17700 )
Dependencies: dns - updating to use hashicorp/go-azure-sdk (#17986 )
Dependencies: maintenance - updating to use hashicorp/go-azure-sdk (#17954 )
Data Source: azurerm_images - now uses a logical id (#17766 )
Data Source: azurerm_management_group - now exports the management_group_ids ,
all_management_group_ids , and all_subscription_ids attributes (#16208 )
azurerm_active_directory_domain_service - support for the
kerberos_armoring_enabled and kerberos_rc4_encryption_enabled properties

(#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

local_authentication_enabled property (#17454 )


azurerm_batch_account - support for the storage_account_authentication_mode ,
storage_account_node_identit , and allowed_authentication_modes properties

(#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

express_vnet_injection property (#17756 )


azurerm_firewall_policy_resource - support for the private_ranges and

allow_sql_redirect properties (#17842 )


azurerm_key_vault - support for the public_network_access_enabled property

(#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:

Data Source: azurerm_windows_web_app - add missing schema definition for


'virtual_network_subnet_id' (#18028 )
azurerm_cdn_endpoint_custom_domain - deprecating the key_vault_certificate_id

property in favour of the key_vault_secret_id property withing the user_managed


https_allows block (#17114 )
azurerm_data_protection_backup_policy_postgresql_resource - prevent a crash

when given an empty criteria block (#17904 )


azurerm_disk_encryption_set - prevent an issue during creation when the disk

encryption set and key vault are in different subscriptions (#17964 )


azurerm_windows_function_app fix a bug with setting values for WindowsFxString

(#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

storage_uses_managed_identity is set to true (#18035 )


azurerm_windows_function_app - correctly send WEBSITE_CONTENTSHARE and

WEBSITE_CONTENTAZUREFILECONNECTIONSTRING (#18035 )
azurerm_windows_function_app - fixcontent settings when

storage_uses_managed_identity is set to true (#18035 )


azurerm_windows_function_app_slot - correctly send WEBSITE_CONTENTSHARE and
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING (#18035 )
azurerm_windows_function_app_slot - fixcontent settings when
storage_uses_managed_identity is set to true (#18035 )

3.18.0 (August 11, 2022)


FEATURES:

New Resource: azurerm_monitor_data_collection_endpoint (#17684 )

ENHANCEMENTS:

dependencies: updating github.com/hashicorp/go-azure-sdk to


v0.20220809.1122626 (#17905 )
storage: updating to use API Version 2021-09-01 (#17523 )
azurerm_express_route_circuit_peering - support for the ipv4_enabled and

gateway_manager_etag properties (#17338 )


azurerm_site_recovery_replicated_vm - support for the target_disk_encryption

block (#15783 )
azurerm_subnet - deprecate enforce_private_link_endpoint_network_policies

property in favour of private_endpoint_network_policies_enabled (#17464 )


azurerm_subnet - deprecate enforce_private_link_service_network_policies

property in favour of private_link_service_network_policies_enabled (#17464 )


azurerm_servicebus_subscription - support for the

client_scoped_subscription_enabled property and the


client_scoped_subscription block (#17101 )

BUG FIXES:

azurerm_backup_policy_vm - now prevents crash when frequency is set to Hourly

and, hour_interval and hour_duration are not set (#17880 )


Data Source: azurerm_blueprint_definition - fix version property output
(#16299 )

3.17.0 (August 04, 2022)


ENHANCEMENTS:

domainservice: updating to use API Version 2021-05-01 (#17737 )


Data Source: azurerm_proximity_placement_group - refactoring to use
hashicorp/go-azure-sdk (#17776 )
azurerm_api_management - update the sku_name property validation to accept

newer Premium SKUs (#17887 )


azurerm_firewall - the property sku_tier is now updateable (#17577 )
azurerm_linux_virtual_machine_scale_set - the property instances is now

Optional and defaults to 0 (#17836 )


azurerm_log_analytics_cluster - updated validation for the size_gb property

(#17780 )
azurerm_proximity_placement_group - refactoring to use hashicorp/go-azure-sdk

(#17776 )
azurerm_shared_image - improved validation for the publisher , offer and sku

properties in the identifier block (#17547 )


azurerm_subnet - support for the service delegation

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:

Data Source: azurerm_private_dns_zone - returning the correct Resource ID when


not specifying the resource_group_name (#17729 )

3.16.0 (July 28, 2022)


FEATURES:

New Resource: azurerm_datadog_monitor (#16131 )


New Resource: azurerm_kusto_cluster_managed_private_endpoint (#17667 )
New Resource: azurerm_log_analytics_query_pack (#17685 )
New Resource: azurerm_logz_sub_account_tag_rule (#17557 )
New Resource: azurerm_signalr_shared_private_link_resource (#16187 )

ENHANCEMENTS:

dependencies: updating to version v0.20220725.1163004 of


github.com/hashicorp/go-azure-sdk (#17753 )
automationaccount: updating to use hashicorp/go-azure-sdk (#17347 )
Data Source: azurerm_linux_function_app - support the
virtual_network_subnet_id property for for vNet integration (#17494 )
Data Source: azurerm_windows_function_app - support the
virtual_network_subnet_id property for for vNet integration (#17572 )
Data Source: azurerm_windows_web_app - support the virtual_network_subnet_id
property for for vNet integration (#17576 )
eventhub : updating all data sources/resources onto single API Version 2021-11-01

(#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

longer ForceNew (#17584 )


azurerm_linux_function_app support the virtual_network_subnet_id property for

for vNet integration (#17494 )


azurerm_linux_function_app_slot support the virtual_network_subnet_id property

for for vNet integration (#17494 )


azurerm_stream_analytics_stream_input_eventhub - support for the
authentication_mode property (#17739 )
azurerm_windows_function_app support the virtual_network_subnet_id property

for for vNet integration (#17572 )


azurerm_windows_function_app_slot support the virtual_network_subnet_id

property for for vNet integration (#17572 )


azurerm_windows_web_app support the virtual_network_subnet_id property for for

vNet integration (#17576 )


azurerm_windows_web_app_slot support the virtual_network_subnet_id property

for for vNet integration (#17576 )

BUG FIXES:

azurerm_linux_function_app - fixcasing bug with the linux_fx_string property for

Node apps (#17789 )


azurerm_linux_function_app_slot - fixcasing bug with the linux_fx_string

property for Node apps (#17789 )


azurerm_resource_group_template_deployment - fixing a bug where the same

Resource Provider defined in different casings would cause the API Version to not
be identified (#17707 )

3.15.1 (July 25, 2022)


BUG FIXES:

data.azurerm_servicebus_queue - fixa regression around namespace_id (#17755 )


azurerm_postgresql_aad_administrator - fixthe state migration (#17732 )
azurerm_postgresql_server - fixa regression around id (#17755 )

3.15.0 (July 21, 2022)


FEATURES:

New Data Source: azurerm_cdn_frontdoor_origin_group (#17089 )


New Data Source: azurerm_cdn_frontdoor_origin (#17089 )
New Resource: azurerm_cdn_frontdoor_origin_group (#17089 )
New Resource: azurerm_cdn_frontdoor_origin (#17089 )
New Resource: azurerm_application_insights_workbook (#17368 )
New Resource: azurerm_monitor_data_collection_rule (#17342 )
New Resource: azurerm_route_server (#16578 )
New Resource: azurerm_route_server_bgp_connection (#16578 )
New Resource: azurerm_web_pubsub_private_link_resource (#15550 )

ENHANCEMENTS:

dependencies: updating to v0.20220715.1071215 of github.com/hashicorp/go-


azure-sdk (#17645 )
domainservice: to use hashicorp/go-azure-sdk (#17595 )
servicebus: refactoring to use hashicorp/go-azure-sdk (#17628 )
postgres: refactoring to use hashicorp/go-azure-sdk (#17625 )
azurerm_kusto_cluster_resource - support for the allowed_fqdns ,
allowed_ip_ranges , and outbound_network_access_restricted properties

(#17581 )
azurerm_storage_account - supports for the change_feed_retention_in_days

property (#17130 )

3.14.0 (July 14, 2022)


FEATURES:

New Resource: azurerm_application_insights_workbook_template (#17433 )


New Resource: azurerm_gallery_application (#17394 )
New Resource: azurerm_gallery_application_version (#17394 )

ENHANCEMENTS:

dependencies: updating to v0.20220712.1111122 of github.com/hashicorp/go-


azure-sdk (#17606 )
dependencies: updating to v0.37.0 of github.com/hashicorp/go-azure-helpers
(#17588 )
dependencies: updating to v2.18.0 of github.com/hashicorp/terraform-plugin-
sdk (#17141 )
appconfiguration: updating to use API Version 2022-05-01 (#17467 )
spring: updating to use API Version 2022-05-01-preview (#17467 )
databricks: refactoring to use hashicorp/go-azure-sdk (#17475 )
lighthouse: refactoring to use hashicorp/go-azure-sdk (#17590 )
policyremediation: updated to use version 2021-10-01 (#17298 )
signalr: refactoring to use hashicorp/go-azure-sdk (#17463 )
storage: refactoring objectreplicationpolicy to use hashicorp/go-azure-sdk
(#17471 )
Data Source: azurerm_availability_set - updating to use hashicorp/go-azure-sdk
(#17608 )
Data Source: azurerm_ssh_public_key - refactoring to use hashicorp/go-azure-sdk
(#17609 )
azurerm_availability_set - updating to use hashicorp/go-azure-sdk (#17608 )
azurerm_container_group - support for the http_headers property (#17519 )
azurerm_dashboard - refactoring to use hashicorp/go-azure-sdk (#17598 )
azurerm_kusto_cluster - support for the public_ip_address property (#17520 )
azurerm_kusto_script - support for the script_content property (#17522 )
azurerm_kusto_iothub_data_connection - support for the database_routing_type

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

managed_identity_resource_id properties (#17524 )


azurerm_kubernetes_cluster - support for the host_group_id property (#17496 )
azurerm_kubernetes_cluster_node_pool - support for the host_group_id property

(#17496 )
azurerm_linux_virtual_machine_scale_set - support for

capacity_reservation_group_id property (#17530 )


azurerm_linux_virtual_machine_scale_set - support for the placement property for

os disks (#17013 )
azurerm_orchestrated_virtual_machine_scale_set - support for the placement

property for os disks (#17013 )


azurerm_shared_image - support for the end_of_life_date disk_types_not_allowed ,
max_recommended_vcpu_count , max_recommended_vcpu_count ,

max_recommended_memory_in_gb , min_recommended_memory_in_gb (#17300 )


azurerm_signalr_service - Add support for live_trace (#17629 )
azurerm_ssh_public_key - refactoring to use hashicorp/go-azure-sdk (#17609 )
azurerm_stream_analytics_output_blob - support for the authentication_mode

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

for os disks (#17013 )


BUG FIXES:

azurerm_api_management - correct set the API Management Cipher

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

handlers are used (#17498 )


azurerm_windows_function_app_slot - set the default_hostname properly on read

(#17498 )
azurerm_windows_function_app_slot - correctly create function apps when custom

handlers are used (#17498 )

3.13.0 (July 08, 2022)


FEATURES:

New Data Source: azurerm_public_maintenance_configurations (#16810 )


New Resource: azurerm_fluid_relay_server (#17238 )
New Resource: azurerm_logz_sub_account (#16581 )

ENHANCEMENTS:

azurestackhci: refactoring to use hashicorp/go-azure-sdk (#17469 )


containerinstance: refactoring to use hashicorp/go-azure-sdk (#17499 )
eventhub: refactoring to use hashicorp/go-azure-sdk (#17445 )
hardwaresecuritymodules: refactoring to use hashicorp/go-azure-sdk (#17470 )
netapp: refactoring to use hashicorp/go-azure-sdk (#17465 )
privatedns: refactoring to use hashicorp/go-azure-sdk (#17436 )
Data Source: azurerm_container_registry - add support for the
data_endpoint_enabled property (#17466 )
azurerm_hdinsight_kafka_cluster -support for the network block (#17259 )
azurerm_key_vault_certificate - now correctly recovers certificates on import

(#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

Auto Resolve (#17111 )


azurerm_windows_virtual_machine - support for the capacity_reservation_group_id

property (#17236 )

BUG FIXES:

azurerm_application_gateway - the request_routing_rule.x.priority property is

now optional (#17380 )

3.12.0 (June 30, 2022)


FEATURES:

New Resource: azurerm_active_directory_domain_service_trust (#17045 )


New Resource: azurerm_data_protection_resource_guard (#17325 )
New Resource: azurerm_spring_cloud_api_portal_custom_domain (#16966 )

ENHANCEMENTS:

dependencies: updating to v0.20220628.1190740 of github.com/hashicorp/go-


azure-sdk (#17399 )
appservice: replacing usages of ioutil with io (#17392 )
containerservice: updated to use version 2022-03-02-preview (#17084 )
elastic: refactoring to use hashicorp/go-azure-sdk (#17431 )
loadtest: refactoring to use hashicorp/go-azure-sdk (#17432 )
maps: refactoring to use hashicorp/go-azure-sdk (#17434 )
mixedreality: switching to use hashicorp/go-azure-sdk (#17417 )
msi: refactoring to use hashicorp/go-azure-sdk (#17430 )
powerbi: refactoring to use hashicorp/go-azure-sdk (#17435 )
purview: refactoring to use hashicorp/go-azure-sdk (#17419 )
redisenterprise: refactoring to use hashicorp/go-azure-sdk (#17387 )
relay: refactoring to use hashicorp/go-azure-sdk (#17385 )
search: refactoring to use hashicorp/go-azure-sdk (#17386 )
servicefabricmanaged: refactoring to use hashicorp/go-azure-sdk (#17384 )
trafficmanager: refactoring to use hashicorp/go-azure-sdk (#17383 )
videoanalyzer: refactoring to use hashicorp/go-azure-sdk (#17382 )
vmware: refactoring to use hashicorp/go-azure-sdk (#17381 )
Data Source: azurerm_key_vault_key - exporting the resource_id and
resource_versionless_id attributes (#17424 )
Data Source: azurerm_key_vault_secret - exporting the resource_id and
resource_versionless_id attributes (#17424 )
Data Source: azurerm_spatial_anchors_account - exposing the tags attribute
(#17417 )
azurerm_bot_service_azure_bot - support new bot type with the
microsoft_app_msi_id , microsoft_app_tenant_id , and microsoft_app_type

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

resource_versionless_id attributes (#17424 )


azurerm_kubernetes_cluster - support for version aliases (#17084 )
azurerm_linux_web_app - support for the virtual_network_subnet_id property

(#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 ,

end_of_life_date , and replication_mode properties (#17295 )


azurerm_static_site_custom_domain - the validation_type propety is now optional

(#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

a UI bug in the Azure Data Factory Portal (#17346 )


azurerm_data_factory_linked_service_azure_file_storage - corredctly assign

user_id (#17398 )
azurerm_key_vault - ensuring that soft_delete_enabled is explicitly set when

purge_protection_enabled is set (#16368 )


azurerm_linux_function_app - correctly validate the app_setting_names and
connection_string_names properties within the sticky_settings block (#17209 )
azurerm_linux_web_app - correctly configure auto_heal and slow_request

(#17296 )
azurerm_linux_web_app - correctly validate the app_setting_names and

connection_string_names properties within the sticky_settings block (#17209 )


azurerm_management_group_policy_assignment - the name property can no longer

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

connection_string_names properties within the sticky_settings block (#17209 )

3.11.0 (June 23, 2022)


FEATURES:

New Data Source: azurerm_management_group_template_deployment (#14524 )


New Data Source: azurerm_policy_assignment (#16527 )
New Data Source: azurerm_resource_group_template_deployment (#14524 )
New Data Source: azurerm_subscription_template_deployment (#14524 )
New Data Source: azurerm_tenant_template_deployment (#14524 )

ENHANCEMENTS:

dependencies: updating to v0.20220623.1064317 of github.com/hashicorp/go-


azure-sdk (#17348 )
batch: updating to use API Version 2022-01-01 (#17219 )
confidentialledger: updating to use API Version 2022-05-13 (#17146 )
desktopvirtualization: refactoring to use hashicorp/go-azure-sdk (#17340 )
Data Source: azurerm_managed_disk - exporting the disk_access_id attribute
(#17270 )
Data Source: azurerm_managed_disk - exporting the network_access_policy
attribute (#17270 )
Data Source: azurerm_storage_account - add support for the identity property
(#17215 )

BUG FIXES:

Data Source: azurerm_mysql_flexible_server - generate the correct terraform


resource ID (#17301 )
azurerm_shared_image - the privacy_statement_uri , publisher , offer , and sku

fields are now ForceNew (#17289 )


azurerm_shared_image_* - correctly validate the gallery_name property (#17201 )
azurerm_time_series_insights_gen2_environment - correctly order id_properties
(#17234 )

3.10.0 (June 09, 2022)


FEATURES:

New Data Source: azurerm_cdn_frontdoor_rule_set (#17094 )


New Resource: azurerm_capacity_reservation_group (#16464 )
New Resource: azurerm_capacity_reservation (#16464 )
New Resource: azurerm_cdn_frontdoor_rule_set (#17094 )

ENHANCEMENTS:

azurerm_cosmosdb_cassandra_cluster - support for the authentication_method ,


client_certificate , external_gossip_certificate , external_seed_node , identity ,

repair_enabled and version properties (#16799 )


azurerm_key_vault_managed_hardware_security_module - support for purging when

soft deleted (#17148 )


azurerm_hpc_cache - support for identity block and the key_vault_key_id and
automatically_rotate_key_to_latest_enabled properties (#16972 )

BUG FIXES:

azurerm_api_management - default hostname proxy configuration is no longer

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

to state file ((#17183 )

3.9.0 (June 02, 2022)


FEATURES:

New Data Source: azurerm_app_configuration_keys (#17053 )


New Data Source: azurerm_cdn_frontdoor_endpoint (#17078 )
New Data Source: azurerm_cdn_frontdoor_profile (#17061 )
New Resource: azurerm_cdn_frontdoor_endpoint (#17078 )
New Resource: azurerm_cdn_frontdoor_profile (#17061 )
New Resource: azurerm_sentinel_data_connector_office_atp (#16825 )
New Resource: azurerm_vpn_server_configuration_policy_group (#16911 )

ENHANCEMENTS:

dependencies: upgrading to v0.33.0 of github.com/hashicorp/go-azure-hepers


(#17074 )
dependencies: upgrading to v1.6.1 of github.com/hashicorp/go-getter
(#17074 )
dependencies: upgrade netapp to 2021-10-01 (#17043 )
azurerm_batch_job - refactor to split create and update (#17138 )
azurerm_data_factory_trigger_schedule - support for the pipeline block

(#16922 )
azurerm_backup_policy_vm - support for V2 policies viu the policy_type property,

supporting Enhanced Policies of the hourly type (#16940 )


azurerm_log_analytics_workspace - allow property updates when a workspace is

linked to a cluster (#17069 )


azurerm_netapp_volume - support for the network_features property (#17043 )
azurerm_provider_registration - refactor to split create and update (#17138 )
azurerm_web_pubsub_hub - the event_handler block is now optional (#17037 )
azurerm_redis_cache - support the identity block (#16990 )
azurerm_service_fabric_managed_cluster - refactor to split create and update

(#17138 )
azurerm_synapse_role_assignment - the role_name property now supports Synapse

Monitoring Operator (#17024 )


azurerm_vpn_gateway_nat_rule - support for the port_range property (#16724 )

BUG FIXES:

azurerm_container_registry_task - sending authentication within the


source_trigger block when updating (#17002 )
azurerm_eventhub_authorization_rule - extend regex char limit for name

(#17057 )
azurerm_kubernetes_cluster - prevent a potential crash during import of a cluster

that doesn't have an API Server Access Profile (#17005 )

3.8.0 (May 26, 2022)


FEATURES:

New Resource: azurerm_mssql_server_dns_alias (#16861 )


New Resource: azurerm_spring_cloud_gateway_route_config (#16721 )
New Resource: azurerm_spring_cloud_api_portal (#16719 )
New Resource: azurerm_spring_cloud_build_deployment (#16730 )

ENHANCEMENTS:

dependencies: upgrade botservice to 2021-05-01-preview (#16665 )


dependencies: upgrade keyvault to 2021-10-01 (#16955 )
azurerm_active_directory_domain_service - supports for the
domain_configuration_type property (#16920 )
azurerm_backup_protected_vm - allow the attached vm to be disassociated from the

backup (#16939 )
azurerm_backup_protected_vm - the backup is now removed from state when it is

soft deleted (#16939 )


azurerm_portal_dashboard - now supports the display_name argument (#16406 )
azurerm_data_factory_trigger_schedule - support for the time_zone property

(#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:

azurerm_mysql_server - fix an error updating public_network_access_enabled with

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

new resources (#16866 )


3.7.0 (May 19, 2022)
FEATURES:

New Authentication Method: OIDC (#16555 )


New Data Source: azurerm_elastic_cloud_elasticsearch (#14821 )
New Resource: azurerm_elastic_cloud_elasticsearch (#14821 )
New Resource: azurerm_healthcare_fhir_service (#15913 )
New Resource: azurerm_virtual_network_gateway_nat_rule (#15720 )

ENHANCEMENTS:

dependencies: upgrade redis to 2020-12-01 (#16532 )


azurerm_container_registry - support changing replications (#16678 )
azurerm_disk_encryption_set - the encryption_type property now supports
ConfidentialVmEncryptedWithCustomerKey (#16870 )
azurerm_linux_function_app - add support for PowerShell 7.2 (#16718 )
azurerm_signalr_service - support the Premium_P1 SKU (#16875 )
azurerm_spring_cloud_app - support for the identity block (#16280 )
azurerm_spring_cloud_app - support for the addon_json property (#16722 )
azurerm_windows_function_app - support for PowerShell 7.2 (#16718 )
azurerm_mssql_managed_instance - support for the maintenance_configuration_name

property (#16832 )

BUG FIXES:

Data Source: azurerm_databricks_workspace - prevent a panic when the SKU field is


missing (#16819 )
azurerm_application_insights_web_test - working around a breaking change in

the API where creation would fail (#16845 )


azurerm_express_route_gateway - handle gateway connections not found error

(#16804 )
azurerm_shared_image - changing the eula property now creates a new resource

(#16868 )

DEPRECATIONS:

azurerm_video_analyzer - Video Analyzer (Preview) is now Deprecated 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 )
azurerm_video_analyzer_edge_module - Video Analyzer (Preview) is now Deprecated

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 )

3.6.0 (May 12, 2022)


FEATURES:

New Resource: azurerm_confidential_ledger (#15420 )


New Resource: azurerm_managed_disk_sas_token (#15558 )
New Resource: azurerm_spring_cloud_gateway (#16175 )
New Resource: azurerm_spring_cloud_build_pack_binding (#16673 )
New Resource: azurerm_spring_cloud_gateway_custom_domain (#16720 )
New Resource: azurerm_stream_analytics_output_powerbi (#16439 )

ENHANCEMENTS:

dependencies: updating to v64.0.0 of github.com/Azure/azure-sdk-for-go


(#16631 )
dependencies: upgrade network to 2021-08-01 (#16631 )
azurerm_container_group - support for the key_vault_key_id property (Customer

Managed Key encryption) (#16709 )


azurerm_cosmosdb_account - support mongo version 4.2 (#16738 )
azurerm_cosmosdb_cassandra_cluster - support for the tags property (#16743 )
azurerm_kubernetes_cluster_node_pool - the property node_labels can now be

updated (#16360 )
azurerm_kubernetes_cluster - the property default_node_pool.node_labels can

now be updated (#16360 )


azurerm_kubernetes_cluster - allow value none for

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

input.configuration_parameter property (#16579 )


azurerm_linux_virtual_machine - correctly support for the update the
diff_disk_settings.placement property (#14847 )
azurerm_virtual_network_gateway_connection - support for the
custom_bgp_addresses property (#16631 )
azurerm_windows_virtual_machine - correctly support for the update the

diff_disk_settings.placement property (#14847 )

BUG FIXES:

azurerm_app_configuration_feature - allow successful creation of resource without

specifying any optional filters (#16459 )


azurerm_mssql_managed_instance_failover_group - correctly import resource and

sent primary isntance id (#16705 )

3.5.0 (May 05, 2022)


FEATURES:

New Data Source: azurerm_healthcare_dicom_service (#15887 )


New Resource: azurerm_healthcare_dicom_service (#15887 )
New Resource: azurerm_mssql_managed_instance_vulnerability_assessment
(#16639 )
New resource: azurerm_sentinel_data_connector_aws_s3 (#16440 )
New Resource: azurerm_spring_cloud_builder (#16036 )
New Resource: azurerm_spring_cloud_configuration_service (#16087 )

ENHANCEMENTS:

dependencies: updating to v63.4.0 of github.com/Azure/azure-sdk-for-go


(#16533 )
dependencies: updating to v1.5.11 of github.com/hashicorp/go-getter
(#16659 )
dependencies: upgrade recoveryservices to 2021-12-01 (#16001 )
azurerm_linux_virtual_machine_scale_set - improve validation on the

termination_notification.timeout property (#16594 )


azurerm_orchestrated_virtual_machine_scale_set - improve validation on the

termination_notification.timeout property (#16594 )


azurerm_servicebus_namespace - the sku property can now be updated to Basic or

Standard without recreating the resource (#16523 )


azurerm_storage_account - support for the cross_tenant_replication_enabled

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

property can now be specified (#15938 )


azurerm_stream_analytics_output_servicebus_queue - support for the

property_columns and system_property_columns properties (#16572 )

BUG FIXES:

Data Source: azurerm_servicebus_queue_authorization_rule - prevent a possible


crash by setting queue_name correctly (#16561 )
Data Source: azurerm_service_plan: - correctly populate the kind and os_type
attributes (#16431 )
azurerm_data_factory_dataset_delimited_text - set defaults properly for

column_delimiter , quote_character , escape_character , first_row_as_header and

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

from external sources (#16641 )


azurerm_linux_function_app_slot - correctly deduplicate user app_settings

(#15740 )
azurerm_linux_function_app_slot - fix app_settings.WEBSITE_RUN_FROM_PACKAGE

handling from external sources (#16641 )


azurerm_machine_learning_compute_cluster - resource now is deleted instead of

just detached (#16640 )


azurerm_windows_function_app - correctly deduplicate user app_settings

(#15740 )
azurerm_windows_function_app_slot - correctly deduplicate user app_settings

(#15740 )

3.4.0 (April 28, 2022)


FEATURES:

New Resource: azurerm_stream_analytics_output_cosmosdb (#16441 )

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

is renamed to termination_notification (#15570 )


azurerm_windows_virtual_machine_scale_set - the terminate_notification

property is renamed to termination_notification (#15570 )

BUG FIXES:

azurerm_datafactory_dataset_x - fix crash around


azure_blob_storage_location.0.dynamic_container_enabled (#16514 )
azurerm_kubernetes_cluster - allow updates to a cluster running a deprecated

version of kubernetes (#16551 )


azurerm_resource_policy_remediation - no longer tries to cancel a completed

remediation task during deletion (#16478 )

3.3.0 (April 21, 2022)


FEATURES:

New Resource: azurerm_spring_cloud_container_deployment (#16181 )

ENHANCEMENTS:

dependencies: updating to v0.19.0 of github.com/tombuildsstuff/giovanni


(#16460 )
Data Source: azurerm_kubernetes_cluster - exporting the microsoft_defender
block (#16218 )
Data Source: azurerm_storage_account - exporting the nfsv3_enabled attribute
(#16404 )
azurerm_data_factory_linked_service_azure_blob_storage - support for the
storage_kind property (#16403 )
azurerm_data_factory_linked_service_azure_blob_storage - support for the
service_principal_linked_key_vault_key property (#16414 )
data_factory_linked_service_sql_server_resource - support for the user_name

property (#16118 )
azurerm_kubernetes_cluster - support for the microsoft_defender block

(#16218 )
azurerm_redis_enterprise_cluster - support for the linked_database_id and

linked_database_group_nickname properties (#16045 )


azurerm_spring_cloud_service - support for the service_registry_enabled

property (#16277 )
azurerm_stream_analytics_output_mssql - support for the system_property_columns

property (#16425 )
azurerm_stream_analytics_output_servicebus_topic - support for the

max_batch_count and max_writer_count properties (#16409 )


azurerm_stream_analytics_output_table - support for the columns_to_remove

property (#16389 )
azurerm_virtual_hub_connection - the internet_security_enabled property can

now be updated (#16430 )

BUG FIXES:
azurerm_cdn_endpoint - the origin.http and origin.https_ports properties now

have thed efault values of 80 and 443 respectivly (#16143 )


azurerm_key_vault_certificate - now authenticates and manages resources

correctly within the US Gov Cloud (#16455 )


azurerm_key_vault_key - now authenticates and manages resources correctly

within the US Gov Cloud (#16455 )


azurerm_key_vault_managed_storage_account - now authenticates and manages

resources correctly within the US Gov Cloud (#16455 )


azurerm_key_vault_secret - now authenticates and manages resources correctly

within the US Gov Cloud (#16455 )


azurerm_kubernetes_cluster - the role_based_access_control_enabled property

can now be disabled (#16488 )


azurerm_linux_function_app - the ip_address property is now correctly set into

state when the service_tag property is specified (#16426 )


azurerm_linux_function_app - fixa bug in updates to app_settings where settings

could be lost (#16442 )


azurerm_linux_function_app_slot - this ip_address property is now correctly set

into state when the service_tag property is specified (#16426 )


azurerm_linux_web_app - the ip_address property is correctly set into state when

the service_tag property is specified (#16426 )


azurerm_linux_web_app - fixa potential crash when an empty app_stack block is
used (#16446 )
azurerm_linux_web_app_slot - the ip_address property is now correctly set into

state when the service_tag property is specified (#16426 )


azurerm_linux_web_app_slot - fixa potential crash when an empty app_stack block

is used (#16446 )
azurerm_sentinel_alert_rule_fusion - no longer sends the etag property during

updates as it is longer required (#16428 )


azurerm_sentinel_alert_rule_machine_learning_behavior_analytics - no longer

sends the etag property during updates as it is longer required (#16428 )


azurerm_sentinel_alert_rule_ms_security_incident - no longer sends the etag

property during updates as it is longer required (#16428 )


azurerm_sentinel_alert_rule_scheduled - no longer sends the etag property

during updates as it is longer required (#16428 )


azurerm_sentinel_data_connector_aws_cloud_trail - no longer sends the etag

property during updates as it is longer required (#16428 )


azurerm_sentinel_data_connector_microsoft_cloud_app_security - no longer sends

the etag property during updates as it is longer required (#16428 )


azurerm_sentinel_data_connector_office_365 - no longer sends the etag property

during updates as it is longer required (#16428 )


azurerm_storage_account - now updates identity before customer_managed_key

enabling adding a new identity with access to the CMK (#16419 )


azurerm_subnet - the address_prefixes property is now (explicitly) required

(#16402 )
azurerm_windows_function_app - the ip_address property is now correctly set into

state when the service_tag property is specified (#16426 )


azurerm_windows_function_app - fixa bug in updates to app_settings where

settings could be lost (#16442 )


azurerm_windows_function_app_slot - the ip_address property is now correctly set

into state when the service_tag property is specified (#16426 )


azurerm_windows_web_app - the ip_address property is now correctly set into state

when the service_tag property is specified (#16426 )


azurerm_windows_web_app - prevent a potential crash when an empty app_stack

block is used (#16446 )


azurerm_windows_web_app_slot - the ip_address property is now correctly set into

state when the service_tag property is specified (#16426 )


azurerm_windows_web_app_slot - prevent a potential crash when an empty

app_stack block is used (#16446 )

3.2.0 (April 14, 2022)


FEATURES:

New Datasource: azurerm_kusto_database (#16180 )


New Resource: azurerm_container_connected_registry (#15731 )
New Resource: azurerm_managment_group_policy_exemption (#16293 )
New Resource: azurerm_resource_group_policy_exemption (#16293 )
New Resource: azurerm_resource_policy_exemption (#16293 )
New Resource: azurerm_stream_analytics_job_schedule (#16349 )
New Resource: azurerm_subscription_policy_exemption (#16293 )

ENHANCEMENTS:

Data Source: azurerm_stream_analytics_job - support for the last_output_time ,


start_mode , and start_time properties (#16349 )
azurerm_container_group - support for the init_container block (#16204 )
azurerm_machine_learning_workspace - renamed the
public_network_access_enabled property to

public_access_behind_virtual_network_enabled to better reflect what this property

does (#16288 )
azurerm_media_streaming_endpoint support Standard Streaming Endpoints

(#16304 )
azurerm_cdn_endpoint - the url_path_condition property now allows the RegEx

and Wildcard values (#16385 )

BUG FIXES:

Data Source: azurerm_log_analytics_linked_storage_account - correctly set the


data_source_type property (#16313 )
azurerm_lb_outbound_rule - allow 0 for the allocated_outbound_ports property

(#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

and group (#16370 )


azurerm_eventhub_namespace - can now be updated when customer managed keys

are being used (#16371 )


azurerm_postgresql_flexible_server - high_availability blocks can now be

added and removed (#16328 )

3.1.0 (April 07, 2022)


FEATURES:

New Resource: azurerm_container_registry_agent_pool (#16258 )

ENHANCEMENTS:

dependencies: updating to v63.0.0 of github.com/Azure/azure-sdk-for-go


(#16147 )
dependencies: updating digitaltwins to use API Version 2020-12-01 (#16044 )
dependencies: updating streamanalytics to use API Version 2020-03-01
(#16270 )
provider: upgrading to Go 1.18 (#16247 )
Data Source: azurerm_kubernetes_cluster - support for the oidc_issuer_enabled
and oidc_issuer_url properties [#16130 ]
Data Source: azurerm_service_plan - add support for zone_balancing_enabled
(#16156 )
azurerm_application_gateway - add KNOWN-CVES to accepted values for the
rule_group_name property (#16080 )
azurerm_automation_account - the dsc_primary_access_key and

dsc_secondary_access_key properties are now marked as sensitive (#16161 )


azurerm_cognitive_account - support for the

custom_question_answering_search_service_id property (#15804 )


azurerm_consumption_budget_management_group - support for SubscriptionID and

SubscriptionName options in the dimension block (#16074 )


azurerm_cosmosdb_gremlin_graph - the property indexing_mode is now case-

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

oidc_issuer_url properties [#16130 ]


azurerm_kubernetes_cluster - the network_profile block now supports the

ip_versions property (#16088 )


azurerm_mssql_database - support for the ledger_enabled property (#16214 )
azurerm_service_plan - support for the zone_balancing_enabled property

(#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:

azurerm_api_management_api_operation_tag - now retrieves tags from the correct

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

now forces a new resoruce to be created (#16229 )


azurerm_linux_function_app - only one of application_insights_key or

application_insights_connection_string needs to be optionally specified

(#16134 )
azurerm_linux_function_app_slot - only one of application_insights_key or

application_insights_connection_string needs to be optionally specified

(#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

property validation (#16149 )


azurerm_windows_web_app - add support for dotnetcore in site metadata property

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 current_stack (#16129 )


azurerm_windows_web_app_slot - fixdocker windowsFXVersion when
docker_container_registry is specified (#16192 )
azurerm_storage_data_lake_gen2_filesystem - add support for $superuser in

group and owner properties (#16215 )

3.0.2 (March 26, 2022)


BUG FIXES:

azurerm_cosmosdb_account - prevent a panic when the API returns an empty list of

read or write locations (#16031 )


azurerm_cdn_endpoint - prevent a panic when there is an empty country_codes

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

MSI authentication (#16046 )

3.0.1 (March 24, 2022)


BUG FIXES:

provider: the prevent_deletion_if_contains_resources feature flag within the


resource_group block now defaults to true (#16021 )

3.0.0 (March 24, 2022)


NOTES:

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:

New Data Source: azurerm_healthcare_workspace (#15759 )


New Data Source: azurerm_key_vault_encrypted_value (#15873 )
New Data Source: azurerm_managed_api (#15797 )
New Resource: azurerm_api_connection (#15797 )
New Resource: azurerm_healthcare_workspace (#15759 )
New Resource: azurerm_stream_analytics_function_javascript_uda (#15831 )
New Resource:
azurerm_security_center_server_vulnerability_assessment_virtual_machine

(#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

azurerm_api_management should be recovered during creation (#15871 )


provider: added a new feature flag within the key_vault block for
recover_soft_deleted_certificates , for configuring whether a soft-deleted

azurerm_key_vault_certificate should be recovered during creation (#10273 )


provider: added a new feature flag within the key_vault block for
purge_soft_deleted_certificates_on_destroy , for configuring whether a deleted
azurerm_key_vault_certificate should be purged during deletion (#10273 )
provider: added a new feature flag within the key_vault block for
recover_soft_deleted_keys , for configuring whether a soft-deleted
azurerm_key_vault_key should be recovered during creation (#10273 )
provider: added a new feature flag within the key_vault block for
purge_soft_deleted_keys_on_destroy , for configuring whether a deleted

azurerm_key_vault_key should be purged during deletion (#10273 )


provider: added a new feature flag within the key_vault block for
recover_soft_deleted_secrets , for configuring whether a soft-deleted

azurerm_key_vault_secret should be recovered during creation (#10273 )


provider: added a new feature flag within the key_vault block for
purge_soft_deleted_secrets_on_destroy , for configuring whether a deleted
azurerm_key_vault_secret should be purged during deletion (#10273 )
provider: added a new feature flag within the resource_group block for
prevent_deletion_if_contains_resources , for configuring whether Terraform

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

automatically created (#15892 )


azurerm_cdn_endpoint - the host_name property is renamed to fqdn (#15992 )
azurerm_eventgrid_system_topic_event_subscription - support for the

delivery_property property (#15559 )


azurerm_iothub - add support for the authentication_type and identity_id
properties in the file_upload block (#15874 )
azurerm_kubernetes_cluster - the kube_admin_config block is now marked as

sensitive in addition to all items within it (#4105 )


azurerm_kubernetes_cluster - add support for the key_vault_secrets_provider

and open_service_mesh_enabled property in Azure China and Azure Government


(#15878 )
azurerm_linux_function_app - add support for the storage_key_vault_secret_id

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

defaults to 1.2 (#10276 )


azurerm_network_interface - support for the edge_zone property (#15890 )
azurerm_network_security_rule - no longer locks on the network security group

name (#15719 )
azurerm_postgresql_server - the ssl_minimal_tls_version_enforced property now

defaults to 1.2 (#10276 )


azurerm_public_ip - support for the edge_zone property (#15890 )
azurerm_redis_cache - the minimum_tls_version property now defaults to 1.2
(#10276 )
azurerm_resource_group - Terraform now checks during the deletion of a Resource

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

block within the features block. (#13777 )


azurerm_resource_group_policy_assignment - support for User Assigned Identities

(#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

allow_nested_items_to_be_public to better represent what is being enabled

(#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

virtual_router_ips properties (#15741 )


azurerm_windows_function_app - add support for storage_key_vault_secret_id

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:

provider: the recover_soft_deleted_key_vaults feature flag within the key_vault


block now defaults to true (#15984 )
provider: the purge_soft_delete_on_destroy feature flag within the key_vault
block now defaults to true [#15984 ]
azurerm_app_configuration_feature - detecting that the key is gone when the App

Configuration is deleted (#15973 )


azurerm_app_configuration_key - detecting that the key is gone when the App

Configuration is deleted (#15973 )


azurerm_application_gateway - the backend_address_pool block is now a Set rather

than a List (#6896 )


azurerm_application_gateway - the field fqdns within the backend_address_pool

block is now a Set rather than a List (#6896 )


azurerm_application_gateway - the field ip_addresses within the

backend_address_pool block is now a Set rather than a List (#6896 )


azurerm_application_gateway - the backend_http_settings block is now a Set
rather than a List (#6896 )
azurerm_application_gateway - the frontend_port block is now a Set rather than a

List (#6896 )
azurerm_application_gateway - the field host_names within the frontend_port

block is now a Set rather than a List (#6896 )


azurerm_application_gateway - the http_listener block is now a Set rather than a

List (#6896 )
azurerm_application_gateway - the private_endpoint_connection block is now a

Set rather than a List (#6896 )


azurerm_application_gateway - the private_link_configuration block is now a Set

rather than a List (#6896 )


azurerm_application_gateway - the probe block is now a Set rather than a List

(#6896 )
azurerm_application_gateway - the redirect_configuration block is now a Set

rather than a List (#6896 )


azurerm_application_gateway - the request_routing_rule block is now a Set rather

than a List (#6896 )


azurerm_application_gateway - the ssl_certificate block is now a Set rather than

a List (#6896 )
azurerm_container_registry - validate the georepliactions property does not

include the location of the Container Registry (#15847 )


azurerm_cosmosdb_mongo_collection - the default_ttl_seconds property can now

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

Customer Managed Key is removed (#15973 )


azurerm_mssql_database_vulnerability_assessment_rule_baseline - prevent the

resource from being replaced every apply (#14759 )


azurerm_security_center_auto_provisioning - validating the Resource ID during
import [#15989 ]
azurerm_security_center_setting - changing the setting_name property now

forces a new resource (#15983 )


azurerm_synapse_workspace - fixing a bug where workspaces created from a

Dedicated SQL Pool / SQL Data Warehouse couldn't be retrieved (#15829 )


azurerm_synapse_workspace_key - keys can now be correctly rotated (#15897 )
azurerm_windows_function_app - fixed update handling of app_settings for
WEBSITE_CONTENTSHARE and WEBSITE_CONTENTAZUREFILECONNECTIONSTRING (#15907 )
azurerm_windows_function_app_slot - fixed update handling of app_settings for
WEBSITE_CONTENTSHARE and WEBSITE_CONTENTAZUREFILECONNECTIONSTRING (#15907 )

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

2.99.0 (March 11, 2022)


NOTES

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:

New Beta Resource: azurerm_function_app_function (#15605 )


New Beta Resource: azurerm_function_app_hybrid_connection (#15702 )
New Beta Resource: azurerm_web_app_hybrid_connection (#15702 )
New Resource: azurerm_cosmosdb_sql_role_assignment (#15038 )
New Resource: azurerm_cosmosdb_sql_role_definition (#15035 )

ENHANCEMENTS:

dependencies: updating to v62.1.0 of github.com/Azure/azure-sdk-for-go


(#15716 )
dependencies: updating compute to 2021-11-01 (#15099 )
dependencies: updating kubernetescluster to 2022-01-02-preview (#15648 )
dependencies: updating sentinel to 2021-09-01-preview (#14983 )
Data Source: azurerm_kubernetes_cluster - deprecated the addon_profile block in
favour of aci_connector_linux , azure_policy_enabled ,
http_application_routing_enabled , ingress_application_gateway ,

key_vault_secrets_provider , oms_agent and open_service_mesh_enabled properties

(#15584 )
Data Source: azurerm_kubernetes_cluster - deprecated the
role_based_access_control block in favour of
azure_active_directory_role_based_access_control and

role_based_access_control_enabled properties (#15584 )


Data Source: azurerm_servicebus_namespace_authorization_rule - support for the
namespace_id property (#15671 )
Data Source: azurerm_servicebus_namespace_disaster_recovery_config - support
for the namespace_id property (#15671 )
Data Source: azurerm_servicebus_queue - support for the namespace_id property
(#15671 )
Data Source: azurerm_servicebus_queue_authorization_rule - support for the
queue_id property (#15671 )
Data Source: azurerm_servicebus_subscription - support for the topic_id
property (#15671 )
Data Source: azurerm_servicebus_topic - support for the namespace_id property
(#15671 )
Data Source: azurerm_servicebus_topic_authorization_rule - support for the
topic_id property (#15671 )
Data Source: azurerm_virtual_network - support for the tags property (#14882 )
azurerm_batch_account - support for customer managed keys (#14749 )
azurerm_container_registry support for the export_policy_enabled property

(#15036 )
azurerm_kubernetes_cluster - deprecate the role_based_access_control block in

favour of role_based_access_control_enabled and


azure_active_directory_role_based_access_control (#15546 )
azurerm_iothub - deprecate the ip_filter_rule property in favour of the
network_rule_set property (#15590 )
azurerm_lb_nat_rule - the frontend_port and backend_port properties now

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

authentication is enforced (#15771 )


azurerm_resource_policy_assignment - the parameters property can now be

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:

azurerm_backup_protected_vm - the source_vm_id property is now case insensitive

(#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

and dns_config.search_domains properties (#15618 )


azurerm_key_vault_key - correctly set the vault id on import (#15670 )
azurerm_monitor_diagnostic_setting - will now correctly parse the
eventhub_authorization_rule_id property (#15582 )
azurerm_mssql_managed_instance_active_directory_administrator - prevent a

perpetual diff with the instance ID (#15725 )


azurerm_orchestrated_virtual_machine_scale_set - prevent a crash when the 3.0

beta was enabled (#15637 )


azurerm_storage_data_lake_gen2_filesystem - support configuring the group and

owner properties (#15598 )


azurerm_virtual_network_gateway - prevent a panic with
bgp_settings.0.peering_address (#15689 )

2.98.0 (February 25, 2022)


FEATURES:

New Beta Resource: azurerm_function_app_active_slot (#15246 )


New Beta Resource: azurerm_web_app_active_slot (#15246 )

ENHANCEMENTS:

dependencies: upgrading to v0.18.0 of github.com/tombuildsstuff/giovanni


(#15507 )
azurerm_linux_function_app - adds key_vault_reference_identity_id support

(#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:

azurerm_cosmosdb_mongo_collection - can now set the autoscale_settings

property without setting a shard_key when creating an Azure Cosmos DB


MongoDB collection (#15529 )
azurerm_firewall_policy - will not wait for resource to finish provisioning after

creation (#15561 )

2.97.0 (February 18, 2022)


UPGRADE NOTES:

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:

New Data Source: azurerm_extended_locations (#15181 )


New Data Source: azurerm_mssql_managed_instance (#15203 )
New Resource: azurerm_iothub_certificate (#15461 )
New Resource: azurerm_mssql_outbound_firewall_rule (#14795 )
New Resource: azurerm_mssql_managed_database (#15203 )
New Resource: azurerm_mssql_managed_instance (#15203 )
New Resource: azurerm_mssql_managed_instance_active_directory_administrator
(#15203 )
New Resource: azurerm_mssql_managed_instance_failover_group (#15203 )
New Resource: azurerm_spring_cloud_storage (#15375 )

ENHANCEMENTS:

dependencies: upgrading to v0.24.1 of github.com/hashicorp/go-azure-helpers


(#15430 )
azurerm_automation_account - add support for the public_network_access_enabled

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

Assigned Identity (#14181 )


azurerm_monitor_activity_log_alert support for the resource_health block

(#14917 )
azurerm_iothub_dps - support for the ip_filter_rule block and the

public_network_access_enabled property (#15343 )


azurerm_spring_cloud_app - support for the custom_persistent_disk block

(#15400 )
azurerm_servicebus_namespace - support for the identity block (#15371 )
azurerm_storage_account - add support for creating a customer managed key

upon creation of a storage account (#15082 )


azurerm_storage_management_policy - add support for
tier_to_cool_after_days_since_last_access_time_greater_than ,

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:

azurerm_application_gateway - fixing a regression where the identity block

wasn't set into the state (#15412 )


azurerm_automation_account - fixing a crash where the keys weren't returned from

the API (#15482 )


azurerm_kusto_cluster - ranaming the properties enable_auto_stop to

auto_stop_enabled , enable_disk_encryption to disk_encryption_enabled ,

enable_streaming_ingest to streaming_ingestion_enabled , and enable_purge to


purge_enabled with the orginal properties being deprecated (#15368 )
azurerm_log_analytics_linked_storage_account - correct casing for
data_source_type when using ingestion (#15451 )
azurerm_logic_app_integration_account_map - set content_type to text/plain

when map_type is Liquid (#15370 )


azurerm_stream_analytics_cluster - fix an issue where the tags were not being

set in the state (#15380 )


azurerm_virtual_desktop_host_pool - the registration_info info block is

deprecated in favour of the azurerm_virtual_desktop_host_pool_registration_info


resource due to changes in the API (#14953 )
azurerm_virtual_machine_data_disk_attachment - fixing a panic when an incorrect
disk_id is provided (#15470 )
azurerm_web_application_firewall_policy - disabled_rules is now optional

(#15386 )

2.96.0 (February 11, 2022)


FEATURES:

New Data Source: azurerm_portal_dashboard (#15326 )


New Data Source: azurerm_site_recovery_fabric (#15349 )
New Data Source: azurerm_site_recovery_protection_container (#15349 )
New Data Source: azurerm_site_recovery_replication_policy (#15349 )
New Resource: azurerm_disk_pool_iscsi_target_lun (#15329 )
New Resource: azurerm_sentinel_watchlist_item (#14366 )
New Resource: azurerm_stream_analytics_output_function (#15162 )
New Resource: azurerm_web_pubsub_network_acl (#14827 )
New Beta Resource: azurerm_app_service_source_control_slot (#15301 )

ENHANCEMENTS:

dependencies: updating to v0.23.1 of github.com/hashicorp/go-azure-helpers


(#15314 )
azurerm_application_gateway - the type property within the identity block is

now required when an identity block is specified (#15337 )


azurerm_application_insights - support for the

force_customer_storage_for_profiler property (#15254 )


azurerm_automation_account - support for managed identities (#15072 )
azurerm_data_factory - refactoring the identity block to be consistant across

resources (#15344 )
azurerm_kusto_cluster - support for the enable_auto_stop (#15332 )
azurerm_linux_virtual_machine - support the StandardSSD_ZRS and Premium_ZRS

values for the storage_account_type property (#15360 )


azurerm_linux_virtual_machine - full support for Automatic VM Guest Patching

(#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

Guest Patching and Hotpatching (#14935 )


azurerm_windows_virtual_machine - support the StandardSSD_ZRS and Premium_ZRS

values for the storage_account_type property (#15360 )


azurerm_windows_virtual_machine - full support for Automatic VM Guest Patching

and Hotpaching (#14796 )

BUG FIXES:

azurerm_application_insights_api_key - prevent panic by checking for the id of an

existing API Key (#15297 )


azurerm_app_service_active_slot - fix regression in ID set in creation of new

resource (#15291 )
azurerm_firewall - working around an Azure API issue when deleting the Firewall

(#15330 )
azurerm_kubernetes_cluster - unsetting outbound_ip_prefix_ids or

outbound_ip_address_ids with an empty slice will default the


load_balancer_profile to a managed outbound IP (#15338 )
azurerm_orchestrated_virtual_machine_scale_set - fixing a crash when the
computer_name_prefix wasn't specified (#15312 )
azurerm_recovery_services_vault - fixing an issue where the subscription couldn't

be found when running in Azure Government (#15316 )

2.95.0 (February 04, 2022)


FEATURES:

New Data Source: azurerm_container_group (#14946 )


New Data Source: azurerm_logic_app_standard (#15199 )
New Resource: azurerm_disk_pool_iscsi_target (#14975 )
New Beta Resource: azurerm_linux_function_app_slot (#14940 )
New Resource: azurerm_traffic_manager_azure_endpoint (#15178 )
New Resource: azurerm_traffic_manager_external_endpoint (#15178 )
New Resource: azurerm_traffic_manager_nested_endpoint (#15178 )
New Beta Resource: azurerm_windows_function_app_slot (#14940 )
New Beta Resource: azurerm_windows_web_app_slot (#14613 )

ENHANCEMENTS:

dependencies: upgrading to v0.22.0 of github.com/hashicorp/go-azure-helpers


(#15207 )
dependencies: updating backup to API Version 2021-07-01 (#14980 )
azurerm_storage_account - the identity block is no longer computed (#15207 )
azurerm_linux_virtual_machine - support for the dedicated_host_group_id

property (#14936 )
azurerm_recovery_services_vault - support Zone Redundant storage (#14980 )
azurerm_web_pubsub_hub - the managed_identity_id property within the auth block

now accepts UUIDs (#15183 )


azurerm_windows_virtual_machine - support for the dedicated_host_group_id

property (#14936 )

BUG FIXES:

azurerm_container_group - fixing parallel provisioning failures with the same


network_profile_id (#15098 )
azurerm_frontdoor - fixing the validation for resource_group_name (#15174 )
azurerm_kubernetes_cluster - prevent panic when updating sku_tier (#15229 )
azurerm_hdinsight_interactive_query_cluster - support for the

storage_resource_id property to fix missing storage account errors (#15039 )


azurerm_hdinsight_hadoop_cluster - support for the storage_resource_id property

to fix missing storage account errors (#15039 )


azurerm_hdinsight_spark_cluster - support for the storage_resource_id property

to fix missing storage account errors (#15039 )


azurerm_hdinsight_hbase_cluster - support for the storage_resource_id property

to fix missing storage account errors (#15039 )


azurerm_log_analytics_datasource_windows_event - adding a state migration to fix
ID was missing the dataSources element (#15194 )
azurerm_policy_definition - fix the deprecation of management_group_name in

favour of management_group_id (#15209 )


azurerm_policy_set_definition - fix the deprecation of management_group_name in

favour of management_group_id (#15209 )


azurerm_static_site - fixing the creation of a Free tier Static Site (#15141 )
azurerm_storage_share - fixing the ShareBeingDeleted error when the Storage

Share is recreated (#15180 )


2.94.0 (January 28, 2022)
UPGRADE NOTES:

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

rest_proxy block is conditionally required when the use_msal provider property is

enabled (#14403 )

FEATURES:

New Data Source: azurerm_linux_function_app (#15009 )


New Data Source azurerm_web_pubsub (#14731 )
New Data Source azurerm_web_pubsub_hub (#14731 )
New Resource: azurerm_web_pubsub (#14731 )
New Resource: azurerm_web_pubsub_hub (#14731 )
New Resource: azurerm_virtual_desktop_host_pool_registration_info (#14134 )

ENHANCEMENTS:

dependencies: updating to v61.3.0 of github.com/Azure/azure-sdk-for-go


(#15080 )
dependencies: updating to v0.21.0 of github.com/hashicorp/go-azure-helpers
(#15043 )
dependencies: updating kusto to API Version 2021-08-27 (#15040 )
provider: opt-in support for v2 authentication tokens via the use_msal provider
property (#14403 )
azurerm_app_service_slot - support for the storage_account block (#15084 )
azurerm_stream_analytics_stream_input_eventhub - support for the partition_key

property (#15019 )

BUG FIXES:

data.image_source - fix a regression around id (#15119 )


azurerm_api_management_backend fix a crash caused by backend_credentials

(#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

the Azure Provider (#15060 )


azurerm_bastion_host - fix a crash by adding nil check for the copy_paste_enabled

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

updating a cost management export (#15017 )


azurerm_template_deployment - fixes a potential bug occuring during the deletion

of a template deployment (#15085 )


azurerm_eventhub - the partition_count property can now be changed when

using Premium sku (#15088 )

2.93.1 (January 24, 2022)


BUG FIXES:

azurerm_app_service - fix name availability check request (#15062 )

2.93.0 (January 21, 2022)


FEATURES:

New Data Source: azurerm_mysql_flexible_server (#14976 )


New Beta Data Source: azurerm_windows_function_app (#14964 )

ENHANCEMENTS:

dependencies: upgrading to v61.1.0 of github.com/Azure/azure-sdk-for-go


(#14828 )
dependencies: updating containerregistry to API version 2021-08-01-preview
(#14961 )
Data Source azurerm_logic_app_workflow - exporting the identity block
(#14896 )
azurerm_bastion_host - support for the copy_paste_enabled , file_copy_enabled ,

ip_connect_enabled , shareable_link_enabled , and tunneling_enabled properties

(#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 ,

SecureScoresSnapshot , and SubAssessmentsSnapshot (#14996 )


azurerm_static_site - support for the identity block (#14911 )
azurerm_iothub - Support for Identity-Based Endpoints (#14705 )
azurerm_servicebus_namespace_network_rule_set - support for the
public_network_access_enabled property (#14967 )

BUG FIXES:

azurerm_machine_learning_compute_instance - add validation for tenant_id and


object_id properties to prevent null values and subsequent panic (#14982 )
azurerm_linux_function_app - (beta) fix potential panic in application_stack when

that block is not in config (#14844 )


azurerm_storage_share_file changing the content_md5 property will now trigger

recreation and the content_length property of share file will now be set when
updating properties. (#15007 )

2.92.0 (January 14, 2022)


FEATURES:

New Resource: azurerm_api_management_api_tag (#14711 )


New Resource: azurerm_disk_pool_managed_disk_attachment (#14268 )

ENHANCEMENTS:

dependencies: upgrading eventgrid to API version 2021-12-01 (#14433 )


azurerm_api_management_custom_domain - the proxy property has been deprecated

in favour of the gateway for the 3.0 release (#14628 )


azurerm_databricks_workspace_customer_managed_key - allow creation of resource

when infrastructure_encryption_enabled is set to true for the databricks


workspace (#14915 )
azurerm_eventgrid_domain - support for the local_auth_enabled ,
auto_create_topic_with_first_subscription , and

auto_delete_topic_with_last_subscription properties (#14433 )


azurerm_monitor_action_group - support for the event_hub_receiver block

(#14771 )
azurerm_mssql_server_extended_auditing_policy - support storing audit data in

storage account that is behind a firewall and VNet (#14656 )


azurerm_purview_account - export the managed_resources block (#14865 )
azurerm_recovery_services_vault - support for customer-managed keys (CMK)

with the encryption block (#14718 )


azurerm_storage_account - support for the infrastructure_encryption_enabled

property (#14864 )

BUG FIXES:

azurerm_aadb2c_directory - fix importing existing resources (#14879 )


azurerm_consumption_budget_subscription - fix issue in migration logic (#14898 )
azurerm_cosmosdb_account - only force ForceMongo when kind is set to MongoDB

(#14924 )
azurerm_cosmosdb_mongo_collection - now validates that "_id" is included as an

index key (#14857 )


azurem_hdinsight - hdinsight resources using oozie metastore can now be created

without error (#14880 )


azurerm_log_analytics_datasource_windows_performance_counter - state migration

for case conversion of ID element (#14916 )


azurerm_monitor_aad_diagnostic_setting - use the correct parser function for

event hub rule IDs (#14944 )


azurerm_mysql_server_key - fix issue when checking for existing resource on create
(#14883 )
azurerm_spring_cloud_service - fix panic when removing git repos (#14900 )
azurerm_log_analytics_workspace - the reservation_capcity_in_gb_per_day has

been deprecated and renamed to reservation_capacity_in_gb_per_day (#14910 )


azurerm_iothub_dps - fixed default value of allocation_weight to match azure

default (#14943 )
azurerm_iothub - now exports event_hub_events_namespace and has a fallback

route by default (#14942 )

2.91.0 (January 07, 2022)


FEATURES:

New Data Source: azurerm_aadb2c_directory (#14671 )


New Data Source: azurerm_sql_managed_instance (#14739 )
New Resource: azurerm_aadb2c_directory (#14671 )
New Resource: azurerm_app_service_slot_custom_hostname_binding (#13097 )
New Resource: azurerm_data_factory_linked_service_odbc (#14787 )
New Resource: azurerm_disk_pool (#14675 )
New Resource: azurerm_load_test (#14724 )
New Resource: azurerm_virtual_desktop_scaling_plan (#14188 )

ENHANCEMENTS:

dependencies: upgrading appplatform to API version 2021-09-01-preview


(#14365 )
dependencies: upgrading network to API Version 2021-05-01 (#14164 )
dependencies: upgrading to v60.2.0 of github.com/Azure/azure-sdk-for-go
(#14688 ] and [#14667 )
dependencies: upgrading to v2.10.1 of github.com/hashicorp/terraform-plugin-
sdk (#14666 )
azurerm_application_gateway - support for the key_vault_secret_id and
force_firewall_policy_association properties (#14413 )
azurerm_application_gateway - support the fips_enagled property (#14797 )
azurerm_cdn_endpoint_custom_domain - support for HTTPS (#13283 )
azurerm_hdinsight_hbase_cluster - support for the network property (#14825 )
azurerm_iothub - support for the identity block (#14354 )
azurerm_iothub_endpoint_servicebus_queue_resource - depracating the

iothub_name propertyin favour of iothub_id property (#14690 )


azurerm_iothub_endpoint_storage_container_resource - depracating the
iothub_name property in favour of iothub_id property [#14690 ]
azurerm_iot_fallback_route - support for the source property (#14836 )
azurerm_kubernetes_cluster - support for the public_network_access_enabled ,

scale_down_mode , and workload_runtime properties (#14386 )


azurerm_linux_function_app - (Beta Resource) fix the filtering of app_settings for

WEBSITE_CONTENTSHARE and WEBSITE_CONTENTAZUREFILECONNECTIONSTRING (#14815 )


azurerm_linux_virtual_machine - support for the user_data property (#13888 )
azurerm_linux_virtual_machine_scale_set - support for the user_data property

(#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

namespace_name properties have been deprecated in favour of the namespace_id

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

properties have been deprecated in favour of the namespace_id property


(#14784 )
azurerm_servicebus_queue_authorization_rule - the resource_group_name ,

namespace_name , and queue_name properties have been deprecated in favour of the


queue_id property (#14784 )
azurerm_servicebus_subscription - the resource_group_name , namespace_name , and

topic_name properties have been deprecated in favour of the topic_id property


(#14784 )
azurerm_servicebus_subscription_rule - the resource_group_name , namespace_name ,
topic_name , and subscription_name properties have been deprecated in favour of

the subscription_id property (#14784 )


azurerm_servicebus_topic - the resource_group_name and namespace_name

properties have been deprecated in favour of the namespace_id property


(#14784 )
azurerm_servicebus_topic_authorization_rule - the resource_group_name ,

namespace_name , and topic_name properties have been deprecated in favour of the


topic_id property (#14784 )
azurerm_shared_image_version - images can now be sorted by semver (#14708 )
azurerm_virtual_network_gateway_connection - support for the connection_mode

property (#14738 )
azurerm_web_application_firewall_policy - the file_upload_limit_in_mb property

within the policy_settings block can now be set to 4000 (#14715 )


azurerm_windows_virtual_machine - support for the user_data property (#13888 )
azurerm_windows_virtual_machine_scale_set - support for the user_data property

(#13888 )

BUG FIXES:

azurerm_app_service_environment_v3 - fix the default value of the

allow_new_private_endpoint_connections property (#14805 )


azurerm_consumption_budget_subscription - added an additional state migration to

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

the expected format during import (#14753 )


azurerm_storage_management_policy - handle the unexpected deletion of the

storage account (#14799 )

2.90.0 (December 17, 2021)


FEATURES:

New Data Source: azurerm_app_configuration_key (#14484 )


New Resource: azurerm_container_registry_task (#14533 )
New Resource: azurerm_maps_creator (#14566 )
New Resource: azurerm_netapp_snapshot_policy (#14230 )
New Resource: azurerm_synapse_sql_pool_workload_classifier (#14412 )
New Resource: azurerm_synapse_workspace_sql_aad_admin (#14341 )
New Resource: azurerm_vpn_gateway_nat_rule (#14527 )

ENHANCEMENTS:

dependencies: updating apimanagement to API Version 2021-08-01 (#14312 )


dependencies: updating managementgroups to API Version 2020-05-01 (#14635 )
dependencies: updating redisenterprise to use an Embedded SDK (#14502 )
dependencies: updating to v0.19.1 of github.com/hashicorp/go-azure-helpers
(#14627 )
dependencies: updating to v2.10.0 of github.com/hashicorp/terraform-plugin-
sdk (#14596 )
Data Source: azurerm_function_app_host_keys - support for signalr_extension_key
and durabletask_extension_key (#13648 )
azurerm_application_gateway - support for private link configurations (#14583 )
azurerm_blueprint_assignment - support for the lock_exclude_actions property

(#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

favour of data_factory_id for consistency across all data factory integration


runtime resources (#14610 )
azurerm_data_factory_trigger_* - deprecate data_factory_name in favour of

data_factory_id for consistency across all data factory trigger resources

(#14610 )
azurerm_data_factory_pipeline - deprecate data_factory_name in favour of

data_factory_id for consistency across all data factory resources (#14610 )


azurerm_iothub - support for the cloud_to_device block (#14546 )
azurerm_iothub_endpoint_eventhub - the iothub_name property has been

deprecated in favour of the iothub_id property (#14632 )


azurerm_logic_app_workflow - support for the open_authentication_policy block

(#14007 )
azurerm_signalr - support for the live_trace_enabled property (#14646 )
azurerm_xyz_policy_assignment add support for non_compliance_message

(#14518 )

BUG FIXES:

azurerm_cosmosdb_account - will now set a default value for default_identity_type

when the API return a nil value (#14643 )


azurerm_function_app - address app_settings during creation rather than just

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

operations to prevent conflicts (#14607 )

2.89.0 (December 10, 2021)


FEATURES:

New Resource: azurerm_bot_service_azure_bot [#14462 ]


New Resource: azurerm_consumption_budget_management_group [#14411 ]
New Resource: azurerm_sql_managed_instance_active_directory_administrator
(#14104 )
New Resource: azurerm_sql_managed_instance_failover_group (#13974 )
New Beta resource: azurerm_windows_function_app (#14247 )
New Beta Resource: azurerm_linux_web_app_slot (#14305 )

ENHANCEMENTS:

dependencies: updating the Embedded SDK for databricks (#14430 )


dependencies: updating the Embedded SDK for datalake (#14429 )
dependencies: updating the Embedded SDK for frontdoor (#14432 )
azurerm_app_service_environment_v3 - allow updating of tags (#14491 )
azurerm_data_factory_linked_services_* - deprecate data_factory_name in favour

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

versionless_secret_id properties (#14287 )


azurerm_kubernetes_cluster - support for the http_proxy_config block which
contains the http_proxy , https_proxy , no_proxy and trusted_ca properties
(#14177 )
azurerm_kubernetes_cluster - support for the azure_keyvault_secrets_provider

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 ,

vpn_link.connection_mode and traffic_selector_policy properties (#14371 )

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

from Replica to Default mode (#14376 )

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:

remote_debugging renamed to remote_debugging_enabled


number_of_workers renamed to worker_count

detailed_error_logging renamed to detailed_error_logging_enabled

auto_heal renamed to auto_heal_enabled


local_mysql renamed to local_mysql_enabled

client_cert_enabled renamed to client_certificate_enabled


client_cert_mode renamed to client_certificate_mode

2.88.1 (December 03, 2021)


BUG FIXES

Data Source: azurerm_automation_account - fixing a bug where the Resource Group


and Name were set in the wrong order (#14464 )
Data Source: azurerm_api_management - fixing a bug where the Managed Identity
ID's weren't parsed correctly (#14469 )
Data Source: azurerm_kubernetes_cluster - fixing a bug where the Managed
Identity ID's weren't parsed correctly (#14469 )
azurerm_api_management - fixing a bug where the Managed Identity ID's weren't

parsed correctly (#14469 )


azurerm_app_service - fixing a bug where the Managed Identity ID's weren't

parsed correctly (#14469 )


azurerm_app_service_slot - fixing a bug where the Managed Identity ID's weren't

parsed correctly (#14469 )


azurerm_application_gateway - fixing a bug where the Managed Identity ID's

weren't parsed correctly (#14469 )


azurerm_automation_account - fixing a bug where the Resource Group and Name

were set in the wrong order (#14464 )


azurerm_container_group - fixing a bug where the Managed Identity ID's weren't

parsed correctly (#14469 )


azurerm_data_factory - fixing a bug where the Managed Identity ID's weren't

parsed correctly (#14469 )


azurerm_function_app - fixing a bug where the Managed Identity ID's weren't

parsed correctly (#14469 )


azurerm_function_app_slot - fixing a bug where the Managed Identity ID's weren't

parsed correctly (#14469 )


azurerm_kubernetes_cluster - fixing a bug where the Managed Identity ID's

weren't parsed correctly (#14469 )


azurerm_kusto_cluster - fixing a bug where the Managed Identity ID's weren't

parsed correctly (#14469 )


azurerm_mssql_server - fixing a bug where the Managed Identity ID's weren't

parsed correctly (#14469 )

2.88.0 (December 02, 2021)


FEATURES:

New Resource: azurerm_mysql_flexible_database (#14285 )


New Resource: azurerm_synapse_sql_pool_workload_group (#13658 )

ENHANCEMENTS:

dependencies: upgrading storagecache to API Version 2021-09-01 (#14311 )


azurerm_app_service - support for the client_cert_mode property (#14395 )
azurerm_bastion_host - support for sku property (#14370 )
azurerm_batch_pool - deprecate max_task_retry_count and environment in favour

of task_retry_maximum and common_environment_properties for consistency across


batch resources (#14368 )
azurerm_data_factory_managed_private_endpoint - support for the fqdns property

(#14355 )
azurerm_linux_virtual_machine - support the secure_boot_enabled and

vtpm_enabled properties (#13842 )


azurerm_linux_virtual_machine_scale_set - support the secure_boot_enabled and
vtpm_enabled properties (#13842 )
azurerm_mssql_database - add support for transparent data encryption, behind a

3.0 feature flag [#13748 ]


azurerm_point_to_site_vpn_gateway - support for the internet_security_enabled

property (#14345 )
azurerm_subscription - the tags property can now be set and updated (#14445 )

BUG FIXES:

azurerm_container_group - allow search_domains and options under the

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

eventhub auth rule id rather than the relay id (#14406 )


azurerm_kubernetes_cluster - handle incorrect casing of kubernetes cluster

resource ID with a state migration (#14241 )


azurerm_kubernetes_cluster_node_pool - handle incorrect casing of kubernetes

cluster resource ID with a state migration (#14241 )


azurerm_kubernetes_cluster_nodepool reverting the computed behaviour of

node_taints and eviction_policy (#14378 )


azurerm_storage_account - populating the account cache on creation, which fixes

an issue when the storage account occasionally couldn't be found (#14361 )

2.87.0 (November 26, 2021)


FEATURES:

New Resource: azurerm_api_management_notification_recipient_user (#14239 )


New Resource: azurerm_app_service_public_certificate (#14337 )
New Resource: azurerm_service_fabric_managed_cluster (#14131 )
New Resource: azurerm_sentinel_watchlist (#14258 )
New Resource: azurerm_static_site_custom_domain (#12764 )
New Resource: azurerm_stream_analytics_cluster (#14082 )
New Resource: azurerm_stream_analytics_managed_private_endpoint (#14082 )

ENHANCEMENTS:

dependencies: upgrading to v0.18.0 of github.com/hashicorp/go-azure-helpers


(#14261 )
azurerm_automation_rule - support for the expiration property (#14262 )
azurerm_cosmosdb_account - support for the analytical_storage and capacity

blocks, default_identity_type and storage_redundancy properties (#14346 )


azurerm_eventgrid_event_subscription - support the
queue_message_time_to_live_in_seconds and user_assigned_identity properties

(#14318 )
azurerm_firewall_policy - allow cidr ranges for the

threat_intelligence_allowlist property (#14340 )


azurerm_managed_disk - support for the public_network_access_enabled property

(#14199 )
azurerm_mssql_elasticpool - support for the DC family (#14270 )
azurerm_mssql_server - groundwork for the (currently disabled) 3.0 feature to set

the default TLS version to 1.2 (#14229 )


azurerm_mysql_server - groundwork for the (currently disabled) 3.0 feature to set

the default TLS version to 1.2 (#14229 )


azurerm_orchestrated_virtual_machine_scale_set - add extension support

(#14236 )
azurerm_postgresql_server - groundwork for the (currently disabled) 3.0 feature to

set the default TLS version to 1.2 (#14229 )


azurerm_redis_cache - groundwork for the (currently disabled) 3.0 feature to set

the default TLS version to 1.2 (#14229 )


azurerm_service_plan (beta) - add Logic App SKUs to validation. (#14288 )
azurerm_site_recovery_replication_policy - now supports disabling of snapshots

and their retention (#14329 )


azurerm_storage_account - groundwork for the (currently disabled) 3.0 feature to

set the default TLS version to 1.2 (#14229 )


azurerm_stream_analytics_job - compatibility_level now accepts 1.2 (#14294 )

BUG FIXES:

azurerm_function_app_slot - fix a bug in app_settings for WEBSITE_CONTENTSHARE

incorrectly updating (#14211 )


azurerm_monitor_diagnostic_setting - Swap Relay parser and validator with

EventHub (#14277 )
azurerm_stream_analytics_stream_input_eventhub - correctly support creation with

the default eventhub_consumer_group_name (#14264 )


azurerm_synapse_workspace - fix a crash during updates when sql_aad_admin was

configured (#14275 )
azurerm_linux_virtual_machine - the patch_mode property is now properly

supported [GH0-14042]

2.86.0 (November 19, 2021)


FEATURES:

New Beta Resource: azurerm_linux_function_app (#13806 )


New Resource: azurerm_automation_webhook (#13893 )
New Resource: azurerm_resource_group_cost_management_export (#14140 )
New Resource: azurerm_subscription_cost_management_export (#14140 )
New Resource: azurerm_logz_tag_rule (#14020 )
New Resource: azurerm_monitor_private_link_scoped_service (#14119 )
New Resource: azurerm_storage_disks_pool (#14145 )

ENHANCEMENTS:

compute: updating to use API Version 2021-07-01 (#14174 )


databricks: updating the embedded SDK to use the new Resource ID Parsers
(#14157 )
datalake: updating the embedded SDK to use the new Resource ID Parsers
(#14158 )
maps: updating the embedded SDK to use the new Resource ID Parsers (#14155 )
powerbi: updating the embedded SDK to use the new Resource ID Parsers
(#14154 )
relay: updating the embedded SDK to use the new Resource ID Parsers (#14153 )
signalr: updating the embedded SDK to use the new Resource ID Parsers
(#14150 )
storage: updating to use API Version 2021-04-01 (#14083 )
videoanalyzer: updating the embedded SDK to use the new Resource ID Parsers
(#14135 )
Data Source: azurerm_storage_account - support for the
table_encryption_key_type and queue_encryption_key_type attributes (#14080 )
azurerm_container_registry - support for the anonymous_pull_enabled ,

data_endpoint_enabled , and network_rule_bypass_option properties (#14096 )


azurerm_cosmosdb_cassandra_datacenter - support the availabilit_zones_enabled

property (#14235 )
azurerm_cost_management_export_resource_group - has been deprecated in favour

of the azurerm_resource_group_cost_management_export resource (#14140 )


azurerm_disk_encryption_set - add support for the encryption_type property

(#14218 )
azurerm_elastic_pool - support for the Fsv2 family SKUs (#14250 )
azurerm_key_vault_certificate - groundwork for the (currently disabled) 3.0

feature to support more granular configuration of soft-delete and purge


protection (#13682 )
azurerm_key_vault_key - groundwork for the (currently disabled) 3.0 feature to

support more granular configuration of soft-delete and purge protection


(#13682 )
azurerm_key_vault_secret - groundwork for the (currently disabled) 3.0 feature to

support more granular configuration of soft-delete and purge protection


(#13682 )
azurerm_key_vault_certificate - the certificate_policy property is now optional

for imported certificates (#14225 )


azurerm_kubernetes_cluster - support for outbound_type = *NATGateway and the

nat_gateway_profile block (#14142 )


azurerm_linux_web_app - (Beta) add support for
health_check_eviction_time_in_mins and vnet_route_all_enabled (#14202 )
azurerm_managed_disk - support for the on_demand_bursting_enabled property

(#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

public preview (#14003 )


azurerm_postgresql_flexible_server - the zone and standby_availability_zone
properties are no longer computed (#13843 )
azurerm_public_ip_prefix - support for the ip_version property (#14228 )
azurerm_purview_account - support for the managed_resource_group_name property

(#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

health_check_eviction_time_in_mins and vnet_route_all_enabled properties

(#14202 )
azurerm_stream_analytics_output_servicebus_topic - support for the
property_columns property (#14252 )
azurerm_storage_account - support for table_encryption_key_type and

queue_encryption_key_type properties (#14080 )


azurerm_storage_account - (Beta) add a state migration for the renaming of
allow_blob_public_access to allow_nested_items_to_be_public (#13607 )
azurerm_sql_active_directory_administrator - support for the
azuread_authentication_only property (#14172 )
azurerm_virtual_network - support for the flow_timeout_in_minutes property

(#14200 )
azurerm_virtual_desktop_application_group - support for the

default_desktop_display_name property (#14227 )

BUG FIXES:

azurerm_backup_protected_file_share - correctly list file shares that are added to

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

for creation and deletion (#14253 )


azurerm_key_vault_certificate - changing the tags property no longer forces a

new resource to be created (#14079 )


azurerm_linux_virtual_machine_scale_set - changing the

source_image_reference.offer and source_image_reference.publisher now creates

a new resource (#14165 )


azurerm_mssql_database - corrert an error when using OnlineSecondary with

auditing on the primary database (#14192 )


azurerm_network_watcher_flow_log - now locks on the network security group to

prevent AnotherOperationInProgress errors (#14160 )


azurerm_windows_virtual_machine_scale_set - source_image_reference.offer and

source_image_reference.publisher are now ForceNew (#14165 )

2.85.0 (November 12, 2021)


FEATURES:

New Data Source: azurerm_batch_application (#14043 )


New Resource: azurerm_monitor_private_link_scope (#14098 )
New Resource: azurerm_mysql_flexible_server_firewall_rule (#14136 )
New Resource: azurerm_synapse_workspace_aad_admin (#13600 )

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

internet_query_enabled properties (#14035 )


azurerm_backup_protected_vm - support for the exclude_disk_luns and

include_disk_luns properties (#14097 )


azurerm_managed_disk_resource - support for the disk_iops_read_only and

disk_mbps_read_only properties (#14025 )


azurerm_security_center_subscription_pricing - resource_type can now be set to
OpenSourceRelationalDatabases (#14103 )
azurerm_storage_encryption_scope - allow versionless key_vault_key_id

(#14085 )
azurerm_sql_managed_instance - support for the identity block (#14052 )
azurerm_virtual_network_gateway - enable configuration of an active-active zone

redundant gateway with P2S (#14124 )

BUG FIXES:

Data Source: azurerm_redis_cache - parsing the subnet_id response value case-


insensitively (#14108 )
Data Source: azurerm_redis_cache - ensuring that shard_count always has a value
set (#14108 )
Data Source: azurerm_consumption_budget_resource_group - add missing
threshold_type property in the schema (#14125 )
Data Source: azurerm_consumption_budget_subscription - add missing
threshold_type property in the schema (#14125 )
azurerm_api_management_certificate - set subject property from correct field

(#14026 )
azurerm_app_service_virtual_network_swift_connection - fixing a panic when

checking for an existing resource during creation (#14070 )


azurerm_frontdoor_resource - route engines are no longer removed on update

(#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 )

2.84.0 (November 05, 2021)


FEATURES:

New Resource: azurerm_cosmosdb_cassandra_cluster (#14019 )


New Resource: azurerm_cosmosdb_cassandra_datacenter (#14019 )
New Resource: logz_monitor (#13874 )
New Resource: azurerm_stream_analytics_output_synapse (#14013 )

IMPROVEMENTS:

upgrading cosmos to API Version 2021-10-15 (#13785 )


upgrading aks to API Version 2021-08-01 (#13465 )
upgrading purview to API Version 2021-07-01 (#13785 )
Data Source: azurerm_key_vault_key - export the cureve , x , y , public_key_pem ,
and public_key_openssh attributes (#13934 )
azurerm_app_service_slot - support for the key_vault_reference_identity_id

property (#13988 )
azurerm_cosmosdb_account - the backup backup type can now be changed from

Periodic to Continuous without creating a new resource (#13967 )


azurerm_firewall_policy_rule_collection_group - support for the translated_fqdn

property (#13976 )
azurerm_firewall_policy - support for the insights block (#14004 )
azurerm_logic_app_integration_account - support the

integration_service_environment_id property (#14015 )


azurerm_function_app - support for the key_vault_reference_identity_id property

(#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:

azurerm_application_insights - correct vlaidation for the daily_data_cap_in_gb

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

disk_mbps_read_write properties ensures values greater then 0 (#14028 )


azurerm_purview_account - deprecate the sku_name property (#13897 )
azurerm_synapse_workspace_key - deprecated the cusomter_managed_key_name

property in favour of the correctly spelled customer_managed_key_name one


(#13881 )

2.83.0 (October 29, 2021)


FEATURES:

New Data Source: azurerm_eventgrid_system_topic (#13851 )


New Data Source: azurerm_billing_mpa_account_scope (#13723 )
New Resource: azurerm_kusto_script (#13692 )
New Resource: azurerm_iot_time_series_insights_event_source_eventhub
(#13917 )
New Resource: azurerm_stream_analytics_reference_input_mssql (#13822 )
New Resource: azurerm_sentinel_automation_rule (#11502 )
New Resource: azurerm_stream_analytics_output_table (#13854 )

IMPROVEMENTS:

upgrading mysql to API Version 2021-05-01 (#13818 )


azurerm_application_gateway - support for the priority property (#13498 )
azurerm_firewall_application_rule_collection - the port property is now

required instead of optional (#13869 )


azurerm_kubernetes_cluster - expose the portal_fqdn attribute (#13887 )
azurerm_linux_virtual_machine_scale_set - support for

automatic_upgrade_enabled in extensions (#13394 )


azurerm_linux_virtual_machine_scale_set - added feature for

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

trusted_services_allowed property (#13853 )


azurerm_windows_virtual_machine_scale_set - added feature for
scale_to_zero_before_deletion (#13635 )
azurerm_synapse_workspace - support for the linking_allowed_for_aad_tenant_ids ,
compute_subnet_id , public_network_access_enabled , purview_id , and

last_commit_id properties (#13817 )


azurerm_spring_cloud_java_deployment – the cpu and memory_in_gb properties
have been deprecated in favour of the quota block (#12924 )
azurerm_vpn_gateway - support for the routing_preference property (#13882 )
azurerm_virtual_hub - support for the default_route_table_id property

(#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:

azurerm_automation_schedule_resource - allow Etc/UTC for the timezone property

(#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

waiting for creats (#13925 )


azurerm_data_factory - can now read global parameter values (#13519 )
azurerm_firewall_policy - will now correctly import (#13862 )
azurerm_firewall_policy - changing the identity will no longer create a new

resource (#13904 )

2.82.0 (October 21, 2021)


FEATURES:

New Resource: azurerm_mysql_flexible_server_configuration (#13831 )


New Resource: azurerm_synapse_sql_pool_vulnerability_assessment_baseline
(#13744 )
New Resource: azurerm_virtual_hub_route_table_route (#13743 )

IMPROVEMENTS:

dependencies: upgrading to v58.0.0 of github.com/Azure/azure-sdk-for-go


(#13613 )
upgrading netapp to API Version 2021-06-01 (#13812 )
upgrading servicebus to API Version 2021-06-01-preview (#13701 )
Data Source: azurerm_disk_encryption_set - support for the
auto_key_rotation_enabled property (#13747 )
Data Source: azurerm_virtual_machine - expose IP addresses as data source
outputs (#13773 )
azurerm_batch_account - support for the identity block (#13742 )
azurerm_batch_pool - support for the identity block (#13779 )
azurerm_container_registry - supports for the regiononal_endpoint_enabled

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

disabled_data_sources properties (#13783 )


azurerm_kubernetes_cluster - support for the open_service_mesh block (#13462 )
azurerm_lb - support for the gateway_load_balancer_frontend_ip_configuration_id

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

favour of the backend_address_pool_ids property (#13559 )


azurerm_lb_nat_pool - support for the floating_ip_enabled , tcp_reset_enabled ,

and idle_timeout_in_minutes properties (#13674 )


azurerm_mssql_server - support for the azuread_authentication_only property

(#13754 )
azurerm_network_interface - support for the

gateway_load_balancer_frontend_ip_configuration_id property (#13559 )


azurerm_synapse_spark_pool - support for the cache_size ,
compute_isolation_enabled , dynamic_executor_allocation_enabled ,

session_level_packages_enabled and spark_config properties (#13690 )

BUG FIXES:

azurerm_app_configuration_feature - fix default value handling for percentage

appconfig feature filters. (#13771 )


azurerm_cosmosdb_account - force MongoEnabled feature when enabling

MongoDBv3.4 . (#13757 )
azurerm_mssql_server - will now configure the azuread_administrator during

resource creation (#13753 )


azurerm_mssql_database - fix failure by preventing extended_auditing_policy from
being configured for secondaries (#13799 )
azurerm_postgresql_flexible_server - changing the standby_availability_zone

no longer forces a new resource (#13507 )


azurerm_servicebus_subscription - the name field can now start & end with an

underscore (#13797 )

2.81.0 (October 14, 2021)


FEATURES:

New Data Source: azurerm_consumption_budget_resource_group (#12538 )


New Data Source: azurerm_consumption_budget_subscription (#12540 )
New Resource: azurerm_data_factory_linked_service_cosmosdb_mongoapi
(#13636 )
New Resource: azurerm_mysql_flexible_server (#13678 )

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

primary_user_assigned_identity_id properties (#13683 )


azurerm_network_connection_monitor - add support for the

destination_port_behavior property (#13518 )


azurerm_security_center_workspace - now supports the Free pricing tier

(#13710 )
azurerm_kusto_attached_database_configuration - support for the sharing

property (#13487 )

BUG FIXES:

Data Source: azurerm_cosmosdb_account - prevent a panic from an index out of


range error (#13560 )
azurerm_function_app_slot - the client_affinity property has been deprecated
as it is no longer configurable in the service's API (#13711 )
azurerm_kubernetes_cluster - the kube_config and kube_admin_config blocks can

now be marked entirely as Sensitive via an environment variable (#13732 )


azurerm_logic_app_workflow - will not check for nil and empty access control

properties (#13689 )
azurerm_management_group - will not nil check child management groups when

deassociating a subscription from a management group (#13540 )


azurerm_subnet_resource - will now lock the virtual network and subnet on

updates (#13726 )
azurerm_app_configuration_key - can now mix labeled and unlabeled keys

(#13736 )

2.80.0 (October 08, 2021)


FEATURES:

New Data Source: backup_policy_file_share (#13444 )


IMPROVEMENTS:

Data Source azurerm_public_ips - deprecate the attached property infavour of the


attachment_status property to improve filtering (#13500 )
Data Source azurerm_public_ips - return public IPs associated with NAT gateways
when attached set to true or attachment_status set to Attached (#13610 )
azurerm_kusto_eventhub_data_connection supports - support for the identity_id

property (#13488 )
azurerm_managed_disk - support for the logical_sector_size property (#13637 )
azurerm_service_fabric_cluster - support for the

service_fabric_zonal_upgrade_mode and service_fabric_zonal_upgrade_mode

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:

azurerm_function_app - fix regressions in function app storage introduced in v2.77

(#13580 )
azurerm_managed_application - fixed typecasting bug (#13641 )

2.79.1 (October 01, 2021)


BUG FIXES:

azurerm_managed_disk - the max_shares propety is now Computed to account for

managed disks that are already managed by Terraform (#13587 )

2.79.0 (October 01, 2021)


FEATURES:

New Resource: azurerm_app_configuration_feature (#13452 )


New Resource: azurerm_logic_app_standard (#13196 )

IMPROVEMENTS:

Data Source: azurerm_key_vault_certificate - exporting the expires and


not_before attributes (#13527 )
Data Source: azurerm_key_vault_certificate_data - exporting the not_before
attribute (#13527 )
azurerm_communication_service - export the primary_connection_string ,
secondary_connection_string , primary_key , and secondary_key attributes

(#13549 )
azurerm_consumption_budget_subscription support for the Forecasted threshold

type (#13567 )
azurerm_consumption_budget_resource_group support for the Forecasted`

threshold type (#13567 )


azurerm_managed_disk - support for the max_shares property (#13571 )
azurerm_mssql_database - will now update replicated databases SKUs first

(#13478 )
azurerm_virtual_hub_connection - optimized state change refresh function

(#13548 )

BUG FIXES:

azurerm_cosmosdb_account - the mongo_server_version can now be changed

without creating a new resouce (#13520 )


azurerm_iothub - correctly suppress diffs for the connection_string property

(#13517 )
azurerm_kubernetes_cluster - explicitly setting upgrade_channel to None when it's

unset to workaround a breaking behavioural change in AKS (#13493 )


azurerm_linux_virtual_machine_scale_set - will not correctly ignore the

protected_setting block withing the extension block (#13440 )


azurerm_windows_virtual_machine_scale_set - will not correctly ignore the

protected_setting block withing the extension block (#13440 )


azurerm_app_configuration_key - correctly set the etag property (#13534 )

2.78.0 (September 23, 2021)


UPGRADE NOTES

The azurerm_data_factory_dataset_snowflake has been updated to set the correct


schema_column api property with the correct schema - to retain the old behaviour

please switch to the structure_column property (#13344 )

FEATURES:

New Resource: azurerm_frontdoor_rules_engine (#13249 )


New Resource: azurerm_key_vault_managed_storage_account (#13271 )
New Resource: azurerm_key_vault_managed_storage_account_sas_token_definition
(#13271 )
New Resource: azurerm_mssql_failover_group (#13446 )
New Resource: azurerm_synapse_sql_pool_extended_auditing_policy (#12952 )
New Resource: azurerm_synapse_workspace_extended_auditing_policy (#12952 )

ENHANCEMENTS:

upgrading iothub to API Version 2021-03-31 (#13324 )


Data Source: azurerm_private_endpoint_connection - Export network_interface
attributes from private endpoints (#13421 )
azurerm_app_service - support for the vnet_route_all_enabled property

(#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 ,

public_network_access_enabled , and discovery_url properties (#13268 )


azurerm_private_endpoint_connection - export the network_interface attribute

from private endpoints (#13421 )


azurerm_storage_account_network_rules - Deprecate storage_account_name and
resource_group_name in favor of storage_account_id (#13307 )
azurerm_storage_share_file - will now recreate and upload deleted/missing files

(#13269 )
azurerm_synapse_workspace - the tenant_id property is now computed (#13464 )

BUG FIXES:

Data Source: azurerm_app_service_certificate - prevent panics if the API returns a


nil issue_date or expiration_date (#13401 )
azurerm_app_service_certificate - prevent panics if the API returns a nil

issue_date or expiration_date (#13401 )


azurerm_app_service_certificate_binding - reverted a change that introduced a

bug in certificate selection for non-managed certificates (#13455 )


azurerm_container_group - allow creation of shared volume between containers in

multi container group (#13374 )


azurerm_kubernetes_cluster - changing the private_cluster_public_fqdn_enabled

no longer created a new resource (#13413 )


azurerm_app_configuration_key - fix nil pointer for removed key (#13483 )

2.77.0 (September 17, 2021)


FEATURES:

New Data Source: azurerm_policy_virtual_machine_configuration_assignment


(#13311 )
New Resource: azurerm_synapse_integration_runtime_self_hosted (#13264 )
New Resource: azurerm_synapse_integration_runtime_azure (#13341 )
New Resource: azurerm_synapse_linked_service (#13204 )
New Resource: azurerm_synapse_sql_pool_security_alert_policy (#13276 )
New Resource: azurerm_synapse_sql_pool_vulnerability_assessment (#13276 )
New Resource: azurerm_synapse_workspace_security_alert_policy (#13276 )
New Resource: azurerm_synapse_workspace_vulnerability_assessment (#13276 )

ENHANCEMENTS:

Data Source: azurerm_mssql_elasticpool - export the sku block (#13336 )


azurerm_api_management - now supports purging soft deleted instances via the

purge_soft_delete_on_destroy provider level feature (#12850 )


azurerm_data_factory_trigger_schedule - support for the activated property

(#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

ssh_public_access_enabled enhancement property and the identity and ssh

blocks (#12833 )
azurerm_spring_cloud_service - support for the connection_string property

(#13262 )

BUG FIXES:

azurerm_app_service_certificate_binding - rework for removal of thumbprint

from service (#13379 )


azurerm_app_service_managed_certificate : Fix for empty issue_date (#13357 )
azurerm_cosmosdb_sql_container : fix crash when deleting (#13339 )
azurerm_frontdoor - Fix crash when cache is disabled (#13338 )
azurerm_function_app - fix app_settings for WEBSITE_CONTENTSHARE (#13349 )
azurerm_function_app_slot - fix app_settings for WEBSITE_CONTENTSHARE

(#13349 )
azurerm_kubernetes_cluster_node_pool - os_sku is now computed (#13321 )
azurerm_linux_virtual_machine_scale_set - fixed crash when automatic_os_policy

was nil (#13335 )


azurerm_lb - support for adding or replacing a frontend_ip_configuration with an
availability_zone (#13305 )
azurerm_virtual_hub_connection - fixing race condition in the creation of virtual

network resources (#13294 )

2.76.0 (September 10, 2021)


NOTES

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:

New Data Source: azurerm_eventgrid_domain (#13033 )


New Resource: azurerm_data_protection_backup_instance_blob_storage
(#12683 )
New Resource: azurerm_logic_app_integration_account_assembly (#13239 )
New Resource: azurerm_logic_app_integration_account_batch_configuration
(#13215 )
New Resource: azurerm_logic_app_integration_account_agreement (#13287 )
New Resource: azurerm_sql_managed_database (#12431 )

ENHANCEMENTS:

upgrading cdn to API Version 2021-09-01 (#13282 )


upgrading cosmos to API Version 2021-06-15 (#13188 )
azurerm_app_service_certificate - support argument app_service_plan_id for

usage with ASE (#13101 )


azurerm_application_gateway - mTLS support for Application Gateways (#13273 )
azurerm_cosmosdb_account support for the local_authentication_disabled

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 ,

destination_addresses , destination_urls , terminate_tls , and web_categories

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

delivery_identity and dead_letter_identity blocks (#12945 )


azurerm_eventgrid_domain support for the identity block (#12951 )
azurerm_eventgrid_topic support for the identity block (#12951 )
azurerm_eventgrid_system_topic support for the identity block (#12951 )
azurerm_kubernetes_cluster - support for the os_sku property (#13284 )
azurerm_synapse_workspace - support for the tenant_id property (#13290 )
azurerm_site_recovery_network_mapping - refactoring to use an ID Formatter/Parser

(#13277 )
azurerm_stream_analytics_output_blob - support for the Parquet type and the

batch_max_wait_time and batch_min_rows properties (#13245 )


azurerm_virtual_network_gateway_resource - support for multiple vpn
authentication types (#13228 )

BUG FIXES:

Data Source: azurerm_kubernetes_cluster - correctly read resource when


local_account_disabled is true (#13260 )
azurerm_api_management_subscription - relax subscription_id validation

(#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 )

2.75.0 (September 02, 2021)


FEATURES:

New Data Source: azurerm_cosmosdb_mongo_database (#13123 )


New Resource: azurerm_cognitive_account_customer_managed_key (#12901 )
New Resource: azurerm_logic_app_integration_account_partner (#13157 )
New Resource: azurerm_logic_app_integration_account_map (#13187 )
New Resource: azurerm_app_configuration_key (#13118 )

ENHANCEMENTS:

dependencies: upgrading to v57.0.0 of github.com/Azure/azure-sdk-for-go


(#13160 )
upgrading dataprotection to API Version 2021-07-01 (#13161 )
azurerm_application_insights - support the local_authentication_disabled

property (#13174 )
azurerm_data_factory_linked_service_azure_blob_storage - support for the

key_vault_sas_token property (#12880 )


azurerm_data_factory_linked_service_azure_function support for the

key_vault_key block (#13159 )


azurerm_data_protection_backup_instance_postgresql - support the

database_credential_key_vault_secret_id property (#13183 )


azurerm_hdinsight_hadoop_cluster - support for the security_profile block

(#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

assignment_type , content_uri , and content_hash properties (#13176 )


azurerm_storage_account - handle nil values for AllowBlobPublicAccess (#12689 )
azurerm_synapse_spark_pool - add support spark for 3.1 (#13181 )

2.74.0 (August 27, 2021)


FEATURES:

New Resource: azurerm_logic_app_integration_account_schema (#13100 )


New Resource: azurerm_relay_namespace_authorization_rule (#13116 )
New Resource: azurerm_relay_hybrid_connection_authorization_rule (#13116 )
ENHANCEMENTS:

dependencies: upgrading monitor to API Version 2021-07-01-preview (#13121 )


dependencies: upgrading devtestlabs to API Version 2018-09-15 (#13074 )
Data Source: azurerm_servicebus_namespace_authorization_rule - support for the
primary_connection_string_alias and secondary_connection_string_alias

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

and dynamic_path_enabled properties (#13117 )


azurerm_data_factory_dataset_json - support for dynamic_path_enabled and

dynamic_path_enabled properties (#13117 )


azurerm_data_factory_dataset_parquet - support for dynamic_path_enabled and

dynamic_path_enabled properties (#13117 )


azurerm_firewall_policy - support for the intrusion_detection , identity and

tls_certificate blocks (#12769 )


azurerm_kubernetes_cluster - support for the pod_subnet_id property (#12313 )
azurerm_kubernetes_cluster_node_pool - support for the pod_subnet_id property

(#12313 )
azurerm_monitor_autoscale_setting - support for the field

divide_by_instance_count within the metric_trigger block (#13121 )


azurerm_redis_enterprise_cluster - the tags property can now be updated

(#13084 )
azurerm_storage_account - add support for shared_key_access_enabled property

(#13014 )
azurerm_servicebus_namespace_authorization_rule - support for the

primary_connection_string_alias and secondary_connection_string_alias


properties (#12997 )
azurerm_servicebus_topic_authorization_rule - support for the

primary_connection_string_alias and secondary_connection_string_alias

properties (#12997 )
azurerm_dev_test_global_vm_shutdown_schedule - support for the mail property

(#13074 )

BUG FIXES:

azurerm_data_factory_dataset_delimited_text - support empty values for the


column_delimiter , row_delimiter , quote_character , escape_character , and

encoding propeties (#13149 )


azurerm_cosmosdb_cassandra_table - correctly update throughput (#13102 )
azurerm_private_dns_a_record - fix regression in name validation and add max

recordset limit validation (#13093 )


azurerm_postgresql_flexible_server_database the charset and collation

properties are now optional (#13110 )


azurerm_spring_cloud_app - Fix crash when identity is not present (#13125 )

2.73.0 (August 20, 2021)


FEATURES:

New Data Source: azurerm_vpn_gateway (#12844 )


New Data Source: azurerm_data_protection_backup_vault (#13062 )
New Resource: azurerm_api_management_notification_recipient_email (#12849 )
New Resource: azurerm_logic_app_integration_account_session (#12982 )
New Resource: azurerm_machine_learning_synapse_spark (#13022 )
New Resource: azurerm_machine_learning_compute_instance (#12834 )
New Resource: azurerm_vpn_gateway (#13003 )

ENHANCEMENTS:

Dependencies: upgrade github.com/Azure/azure-sdk-for-go to v56.2.0


(#12969 )
Dependencies: updating frontdoor to use API version 2020-05-01 (#12831 )
Dependencies: updating web to use API version 2021-02-01 (#12970 )
Dependencies: updating kusto to use API version 2021-01-01 (#12967 )
Dependencies: updating machinelearning to use API version 2021-07-01
(#12833 )
Dependencies: updating network to use API version 2021-02-01 (#13002 )
appconfiguration: updating to use the latest embedded SDK (#12950 )
eventhub: updating to use the latest embedded SDK (#12946 )
Data Source: azurerm_iothub - support for the property hostname (#13001 )
Data Source: azurerm_application_security_group - refactoring to use an ID
Formatter/Parser (#13028 )
azurerm_active_directory_domain_service - export the resource_id attribute

(#13011 )
azurerm_app_service_environment_v3 - updated for GA changes, including support

for internal_load_balancing_mode , zone_redundant , dedicated_host_count , and


several new exported properties (#12932 )
azurerm_application_security_group - refactoring to use an ID Formatter/Parser

(#13028 )
azurerm_data_lake_store - support for the identity block (#13050 )
azurerm_kubernetes_cluster - support for the ultra_ssd_enabled and

private_cluster_public_fqdn_enabled properties (#12780 )


azurerm_kubernetes_cluster_node_pool - supportfor the ultra_ssd_enabled

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:

azurerm_frontdoor - expose support for cache_duration and

cache_query_parameters fields (#12831 )


azurerm_network_watcher_flow_log - correctly truncate name by ensuring it doesn't

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

Microsoft Entra profile is now nil (#13043 )


azurerm_redis_enterprise_cluster - changing the tags property no longer creates

a new resource (#12956 )


azurerm_storage_account - allow 0 for the cors.max_age_in_seconds property

(#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

rolling_upgrade_policy block (#13029 )

2.72.0 (August 12, 2021)


UPGRADE NOTES

This version of the Azure Provider introduces the


prevent_deletion_if_contains_resources feature flag (which is disabled by default)

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:

New Resource: azurerm_video_analyzer (#12665 )


New Resource: azurerm_video_analyzer_edge_module (#12911 )

ENHANCEMENTS:

azurerm_api_management_named_value - support for system managed identities

(#12938 )
azurerm_application_insights_smart_detection_rule - support all currenly availible

rules in the SDK (#12857 )


azurerm_function_app - add support for dotnet_framework_version in (#12883 )
azurerm_resource_group - conditionally (based on the

prevent_deletion_if_contains_resources features flag - see the 'Upgrade Notes'


section) checking for nested Resources during deletion of the Resource Group and
raising an error if Resources are found (#12657 )

BUG FIXES:

Data Source: azurerm_key_vault_certificate_data - updating the PEM Header


when using a RSA Private Key so this validates with OpenSSL (#12896 )
azurerm_active_directory_domain_service - removing an unnecessary check

during deletion (#12879 )


azurerm_app_service_environment - removing an unnecessary check during

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

values to the API (#12921 )


azurerm_data_lake_analytics_account - removing an unnecessary check during
deletion (#12879 )
azurerm_data_lake_store - removing an unnecessary check during deletion

(#12879 )
azurerm_data_protection_backup_instance_disk - removing an unnecessary check

during deletion (#12879 )


azurerm_database_migration_service - removing an unnecessary check during

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

check during deletion (#12879 )


azurerm_eventgrid_system_topic - removing an unnecessary check during deletion

(#12879 )
azurerm_eventgrid_topic - removing an unnecessary check during deletion

(#12879 )
azurerm_express_route_circuit_authorization - removing an unnecessary check

during deletion (#12879 )


azurerm_express_route_circuit_peering - removing an unnecessary check during

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

check during deletion (#12879 )


azurerm_kubernetes_cluster - prevent nil panic when rbac config is empty

(#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

during deletion (#12879 )


azurerm_private_dns_zone_virtual_network_link - removing an unnecessary check

during deletion (#12879 )


azurerm_private_endpoint - removing an unnecessary check during deletion

(#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

during deletion (#12879 )


azurerm_virtual_wan - removing an unnecessary check during deletion (#12879 )
azurerm_vpn_gateway_connection - removing an unnecessary check during deletion

(#12879 )
azurerm_web_application_firewall_policy - removing an unnecessary check

during deletion (#12879 )

2.71.0 (August 06, 2021)


FEATURES:

New Data Source: azurerm_databricks_workspace_private_endpoint_connection


(#12543 )
New Resource: azurerm_api_management_tag (#12535 )
New Resource: azurerm_bot_channel_line (#12746 )
New Resource: azurerm_cdn_endpoint_custom_domain (#12496 )
New Resource: azurerm_data_factory_data_flow (#12588 )
New Resource: azurerm_postgresql_flexible_server_database (#12550 )

ENHANCEMENTS:

dependencies: upgrading to v56.0.0 of github.com/Azure/azure-sdk-for-go


(#12781 )
dependencies: updating appinsights to use API Version 2020-02-02 (#12818 )
dependencies: updating containerservice to use API Version 2021-05-1
(#12747 )
dependencies: updating machinelearning to use API Version 2021-04-01
(#12804 )
dependencies: updating databricks to use API Version 2021-04-01-preview
(#12543 )
PowerBI: refactoring to use an Embedded SDK (#12787 )
SignalR: refactoring to use an Embedded SDK (#12785 )
azurerm_api_management_api_diagnostic - support for the operation_name_format

property (#12782 )
azurerm_app_service - support for the acr_use_managed_identity_credentials and

acr_user_managed_identity_client_id properties (#12745 )


azurerm_app_service - support v6.0 for the dotnet_framework_version property

(#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

Managed Services (#12799 )


azurerm_data_factory_linked_service_data_lake_storage_gen2 - don't send a

secure connection string when using a managed identity (#12359 )


azurerm_function_app - support for the elastic_instance_minimum ,
app_scale_limit , and runtime_scale_monitoring_enabled properties (#12741 )
azurerm_kubernetes_cluster - support for the local_account_disabled property

(#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

tenant_settings properties and blocks (#12820 )


azurerm_redis_enterprise_cluster - this can now be provisioned in Canada
Central (#12842 )
azurerm_static_site - support Standard SKU (#12510 )

BUG FIXES:

Data Source azurerm_ssh_public_key - normalising the SSH Public Key (#12800 )


azurerm_api_management_api_subscription - fixing the default scope to be /apis

rather than all_apis as required by the latest API (#12829 )


azurerm_app_service_active_slot - fix 404 not found on read for slot (#12792 )
azurerm_linux_virtual_machine_scale_set - fix crash in checking for latest image

(#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

when using non-top level items (#12421 )


azurerm_subscription_template_deployment - fixing deletion of nested items when

using non-top level items (#12421 )


azurerm_virtual_machine_extension - changing the publisher property now

creates a new resource (#12790 )

2.70.0 (July 30, 2021)


FEATURES:

New Data Source azurerm_storage_share (#12693 )


New Resource azurerm_bot_channel_alexa (#12682 )
New Resource azurerm_bot_channel_direct_line_speech (#12735 )
New Resource azurerm_bot_channel_facebook (#12709 )
New Resource azurerm_bot_channel_sms (#12713 )
New Resource azurerm_data_factory_trigger_custom_event (#12448 )
New Resource azurerm_data_factory_trigger_tumbling_window (#12437 )
New Resource azurerm_data_protection_backup_instance_disk (#12617 )

ENHANCEMENTS:

dependencies: Upgrade web (App Service) API to 2021-01-15 (#12635 )


analysisservices: refactoring to use an Embedded SDK (#12771 )
maps: refactoring to use an Embedded SDK (#12716 )
msi: refactoring to use an Embedded SDK (#12715 )
relay: refactoring to use an Embedded SDK (#12772 )
vmware: refactoring to use an Embedded SDK (#12751 )
Data Source: azurerm_storage_account_sas - support for the property
ip_addresses (#12705 )
azurerm_api_management_diagnostic - support for the property

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

encryption_in_transit_enabled property (#12767 )


azurerm_hdinsight_spark_cluster - support for the encryption_in_transit_enabled

property (#12767 )
azurerm_firewall_polcy - support for property private_ip_ranges (#12696 )

BUG FIXES:

azurerm_cdn_endpoint - fixing a crash when the future is nil (#12743 )


azurerm_private_endpoint - working around a casing issue in

private_connection_resource_id for MariaDB, MySQL and PostgreSQL resources

(#12761 )
2.69.0 (July 23, 2021)
FEATURES:

New Data Source azurerm_active_directory_domain_service (#10782 )


New Resource azurerm_active_directory_domain_service (#10782 )
New Resource azurerm_active_directory_domain_service_replica_set (#10782 )
New Resource azurerm_api_management_gateway_api (#12398 )
New Resource azurerm_batch_job (#12573 )
New Resource azurerm_bot_channel_web_chat (#12672 )
New Resource azurerm_data_factory_managed_private_endpoint (#12618 )
New Resource azurerm_data_protection_backup_policy_blob_storage (#12362 )
New Resource azurerm_signalr_service_network_acl (#12434 )
New Resource azurerm_virtual_network_dns_servers (#10782 )

ENHANCEMENTS:

dependencies: Updgrading to v55.6.0 of github.com/Azure/azure-sdk-for-go


(#12565 )
azurerm_api_management_named_value - the field secret_id can now be set to a

versionless Key Vault Key (#12641 )


azurerm_data_factory_integration_runtime_azure_ssis - support for the
public_ips , express_custom_setup , package_store , and proxy blocks (#12545 )
azurerm_data_factory_integration_runtime_azure_ssis - support for the
key_vault_password , and key_vault_license blocks (#12659 )
azurerm_bot_channels_registration - support for the cmk_key_vault_url ,

description , icon_url , and isolated_network_enabled (#12560 )


azurerm_data_factory_integration_runtime_azure - support for the

virtual_network_enabled property (#12619 )


azurerm_eventgrid_event_subscription - support for the

advanced_filtering_on_arrays_enabled property (#12609 )


azurerm_eventgrid_system_topic_event_subscription - support for the
advanced_filtering_on_arrays_enabled property (#12609 )
azurerm_eventhub_namespace - support for Azure Event Hubs Namespace Premium

tier (#12695 )
azurerm_kubernetes_cluster - support for downgrading sku_tier from Paid to

Free without recreating the Cluster (#12651 )


azurerm_kusto_eventgrid_data_connection - Add supported data_format

APACHEAVRO, ORC, PARQUET, TSVE and W3CLOGFILE to validation function.


(#12687 )
azurerm_postgresql_flexible_server - support for the high_availability block

(#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

without specifying subnet_resource_id (#12658 )


azurerm_storage_account - fixed account_replication_type validation (#12645 )

2.68.0 (July 16, 2021)


FEATURES:

New Data Source azurerm_local_network_gateway (#12579 )


New Resource azurerm_api_management_api_release (#12562 )
New Resource azurerm_data_protection_backup_policy_disk (#12361 )
New Resource azurerm_data_factory_custom_dataset (#12484 )
New Resource azurerm_data_factory_dataset_binary (#12369 )
New Resource azurerm_maintenance_assignment_virtual_machine_scale_set
(#12273 )
New Resource azurerm_postgresql_flexible_server_configuration (#12294 )
New Resource azurerm_synapse_private_link_hub (#12495 )

ENHANCEMENTS:

dependencies: upgrading to v55.5.0 of github.com/Azure/azure-sdk-for-go


(#12435 )
dependencies: updating bot to use API Version 2021-03-01 (#12449 )
dependencies: updating maintenance to use API Version 2021-05-01 (#12273 )
azurerm_api_management_named_value - support for the value_from_key_vault block

(#12309 )
azurerm_api_management_api_diagnostic - support for the data_masking 1 property

(#12419 )
azurerm_cognitive_account - support for the identity , storage ,

disable_local_auth , fqdns , public_network_access_enabled , and


restrict_outbound_network_access properties (#12469 )
azurerm_cognitive_account - the virtual_network_subnet_ids property has been

deprecated in favour of virtual_network_rules block to supoport the


ignore_missing_vnet_service_endpoint property (#12600 )
azurerm_container_registry - now exports the principal_id and tenant_id

attributes in the identity block (#12378 )


azurerm_data_factory - support for the managed_virtual_network_enabled property

(#12343 )
azurerm_linux_virtual_machine_scale_set - Fix un-necessary VMSS instance rolling

request (#12590 )
azurerm_maintenance_configuration - support for the window , visibility , and

properties blocks (#12273 )


azurerm_powerbi_embedded - support for the mode property (#12394 )
azurerm_redis_cache - support for the maintenance_window property in the

patch_schedule block (#12472 )


azurerm_storage_account_customer_managed_key - support for the

user_assigned_identity_id property (#12516 )

BUG FIXES:

azurerm_api_management - no longer forces a new resource when changing the


subnet_id property (#12611 )
azurerm_function_app - set a default value for os_type and allow a blank string to

be specified as per documentation (#12482 )


azurerm_key_vault_access_policy - prevent a possible panic on delete (#12616 )
azurerm_postgresql_flexible_server - add new computed property
private_dns_zone_id to work around an upcomming breaking change in the API

(#12288 )
machine_learning_compute_cluster - make the subnet_resource_id property

actually optional (#12558 )


azurerm_mssql_database - don't allow license_type to be set for serverless SQL

databases (#12555 )
azurerm_subnet_network_security_group_association - prevent potential deadlocks

when using multiple association resources (#12267 )

2.67.0 (July 09, 2021)


FEATURES:

New Data Source azurerm_api_management_gateway (#12297 )


New Resource azurerm_api_management_gateway (#12297 )
New Resource azurerm_databricks_workspace_customer_managed_key (#12331 )

ENHANCEMENTS:

dependencies: updating postgresqlflexibleservers to use API Version 2021-06-01


(#12405 )
azurerm_databricks_workspace - add support for machine_learning_workspace_id ,
customer_managed_key_enabled , infrastructure_encryption_enabled and

storage_account_identity (#12331 )
azurerm_security_center_assessment_policy - support for the categories propety

(#12383 )

BUG FIXES:

azurerm_api_management - fix an issue where changing the location of an

additional_location would force a new resource (#12468 )


azurerm_app_service - fix crash when resource group or ASE is missing. (#12518 )
azurerm_automation_variable_int - fixed value parsing order causing 1 to be

considered a bool (#12511 )


azurerm_automation_variable_bool - fixed value parsing order causing 1 to be

considered a bool (#12511 )


azurerm_data_factory_dataset_parquet - the
azure_blob_storage_location.filename property cis now optional (#12414 )
azurerm_kusto_eventhub_data_connection - APACHEAVRO can now be used as a
data_format option (#12480 )
azurerm_site_recovery_replicated_vm - Fix potential crash in reading

managed_disk properties (#12509 )


azurerm_storage_account - account_replication_type can now be updated

(#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

from documentation (#12481 )

DEPRECATIONS:

azurerm_postgresql_flexible_server - the cmk_enabled property has been

deprecated as it has been removed from the API (#12405 )


azurerm_virtual_machine_configuration_policy_assignment - has been deprecated

and renamed to azurerm_policy_virtual_machine_configuration_assignment


(#12497 )

2.66.0 (July 02, 2021)


FEATURES:

New Resource azurerm_api_management_api_operation_tag (#12384 )


New Resource azurerm_data_factory_linked_custom_service (#12224 )
New Resource azurerm_data_factory_trigger_blob_event (#12330 )
New Resource azurerm_express_route_connection (#11320 )
New Resource azurerm_express_route_circuit_connection (#11303 )
New Resource azurerm_management_group_policy_assignment (#12349 )
New Resource azurerm_resource_group_policy_assignment (#12349 )
New Resource azurerm_resource_policy_assignment (#12349 )
New Resource azurerm_subscription_policy_assignment (#12349 )
New resource azurerm_tenant_configuration (#11697 )
Cognitive Service now supports purging soft delete accounts (#12281 )

ENHANCEMENTS:

dependencies: updating cognitive to use API Version 2021-03-01 (#12281 )


dependencies: updating trafficmanager to use API Version 2018-08-01 (#12400 )
azurerm_api_management_backend - support for the client_certificate_id property

(#12402 )
azurerm_api_management_api - support for the revision_description ,

version_description , and source_api_id properties (#12266 )


azurerm_batch_account - support for the public_network_access_enabled property

(#12401 )
azurerm_eventgrid_event_subscription - support for additional advanced filters
string_not_begins_with , string_not_ends_with , string_not_contains ,

is_not_null , is_null_or_undefined , number_in_range and number_not_in_range

(#12167 )
azurerm_eventgrid_system_topic_event_subscription - support for additional

advanced filters string_not_begins_with , string_not_ends_with ,


string_not_contains , is_not_null , is_null_or_undefined , number_in_range and
number_not_in_range (#12167 )
azurerm_kubernetes_cluster - support for the fips_enabled , kubelet_disk_type ,

and license properties (#11835 )


azurerm_kubernetes_cluster_node_pool - support for the fips_enabled , and

kubelet_disk_type properties (#11835 )


azurerm_lighthouse_definition - support for the plan block (#12360 )
azurerm_site_recovery_replicated_vm - Add support for

target_disk_encryption_set_id in managed_disk (#12374 )


azurerm_traffic_manager_endpoint - supports for the

minimum_required_child_endpoints_ipv4 and
minimum_required_child_endpoints_ipv6 (#12400 )

BUG FIXES:

azurerm_app_service - fix app_setting and SCM setting ordering (#12280 )


azurerm_hdinsight_kafka_cluster - will no longer panic from an empty

component_version property (#12261 )


azurerm_spatial_anchors_account - the tags property can now be updated

without creating a new resource (#11985 )


Data Source azurerm_app_service_environment_v3 - fix id processing for Read
(#12436 )

2.65.0 (June 25, 2021)


FEATURES:

New Resource azurerm_data_protection_backup_instance_postgresql (#12220 )


New Resource azurerm_hpc_cache_blob_nfs_target (#11671 )
New Resource azurerm_nat_gateway_public_ip_prefix_association (#12353 )

ENHANCEMENTS:

dependencies: updating to v2.6.1 of github.com/hashicorp/terraform-plugin-sdk


(#12209 )
dependencies: upgrading to v55.3.0 of github.com/Azure/azure-sdk-for-go
(#12263 )
dependencies: updating to v0.11.19 of github.com/Azure/go-autorest/autorest
(#12209 )
dependencies: updating to v0.9.14 of github.com/Azure/go-
autorest/autorest/adal (#12209 )
dependencies: updating the embedded SDK for Eventhub Namespaces to use API
Version 2021-01-01-preview (#12290 )
azurerm_express_route_circuit_peering - support for the bandwidth_in_gbps and

express_route_port_id properties (#12289 )


azurerm_kusto_iothub_data_connection - support for the data_format ,

mapping_rule_name and table_name properties (#12293 )


azurerm_linux_virtual_machine - updating proximity_placement_group_id will no

longer create a new resoruce (#11790 )


azurerm_security_center_assessment_metadata - support for the categories

property (#12278 )
azurerm_windows_virtual_machine - updating proximity_placement_group_id will no

longer create a new resoruce (#11790 )

BUG FIXES:

azurerm_data_factory - fix a bug where the name property was stored with the

wrong casing (#12128 )

2.64.0 (June 18, 2021)


FEATURES:

New Data Source azurerm_key_vault_secrets (#12147 )


New Resource azurerm_api_management_redis_cache (#12174 )
New Resource azurerm_data_factory_linked_service_odata (#11556 )
New Resource azurerm_data_protection_backup_policy_postgresql (#12072 )
New Resource azurerm_machine_learning_compute_cluster (#11675 )
New Resource azurerm_eventhub_namespace_customer_managed_key (#12159 )
New Resource azurerm_virtual_desktop_application (#12077 )

ENHANCEMENTS:

dependencies: updating to v55.2.0 of github.com/Azure/azure-sdk-for-go


(#12153 )
dependencies: updating synapse to use API Version 2021-03-01 (#12183 )
azurerm_api_management - support for the client_certificate_enabled ,

gateway_disabled , min_api_version , and zones propeties (#12125 )


azurerm_api_management_api_schema - prevent plan not empty after apply for json

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

linux_os_config blocks (#11119 )


azurerm_monitor_metric_alert - support the StartsWith dimension operator

(#12181 )
azurerm_private_link_service - changing

load_balancer_frontend_ip_configuration_ids list no longer creates a new

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

data_exfiltration_protection_enabled property (#12183 )


azurerm_synapse_role_assignment - support for scopes and new role types
(#11690 )

BUG FIXES:

azurerm_synapse_role_assignment - support new roles and scopes (#11690 )


azurerm_lb - fix zone behaviour bug introduced in recent API upgrade (#12208 )

2.63.0 (June 11, 2021)


FEATURES:

New Resource azurerm_data_factory_linked_service_azure_search (#12122 )


New Resource azurerm_data_factory_linked_service_kusto (#12152 )

ENHANCEMENTS:

dependencies: updating streamanalytics to use API Version 2020-03-01-preview


(#12133 )
dependencies: updating virtualdesktop to use API Version 2020-11-02-preview
(#12160 )
data.azurerm_synapse_workspace - support for the identity attribute (#12098 )
azurerm_cosmosdb_gremlin_graph - support for the composite_index and

partition_key_version properties (#11693 )


azurerm_data_factory_dataset_azure_blob - support for the

dynamic_filename_enabled and dynamic_path_enabled properties (#12034 )


azurerm_data_factory_dataset_delimited_text - supports the
azure_blob_fs_location property (#12041 )
azurerm_data_factory_linked_service_azure_sql_database - support for the
key_vault_connection_string property (#12139 )
azurerm_data_factory_linked_service_sql_server - add

key_vault_connection_string argument (#12117 )


azurerm_data_factory_linked_service_data_lake_storage_gen2 - supports for the

storage_account_key property (#12136 )


azurerm_eventhub - support for the status property (#12043 )
azurerm_kubernetes_cluster - support migration of service_principal to

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

vaults in remote subscription (#12142 )


azurerm_virtual_desktop_host_pool - support for the start_vm_on_connect

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:

azurerm_role_assignment - use the correct ID when assigning roles to resources

(#12076 )

2.62.0 (June 04, 2021)


FEATURES:

New Resource azurerm_data_protection_backup_vault (#11955 )


New Resource azurerm_postgresql_flexible_server_firewall_rule (#11834 )
New Resource azurerm_vmware_express_route_authorization (#11812 )
New Resource azurerm_storage_object_replication_policy (#11744 )

ENHANCEMENTS:

dependencies: updating network to use API Version 2020-11-01 (#11627 )


azurerm_app_service_environment - support for the internal_ip_address ,

service_ip_address , and outbound_ip_addresses properties (#12026 )


azurerm_api_management_api_subscription - support for the api_id property

(#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

ssl.leaf_domain_label and ssl.overwrite_existing_domain properties (#11830 )


azurerm_role_assignment - support the delegated_managed_identity_resource_id

property (#11848 )

BUG FIXES:

azuerrm_postgres_server - do no update password unless its changed (#12008 )


azuerrm_storage_acount - prevent containerDeleteRetentionPolicy and

lastAccessTimeTrackingPolicy not supported in AzureUSGovernment errors


(#11960 )

2.61.0 (May 27, 2021)


FEATURES:

New Data Source: azurerm_spatial_anchors_account (#11824 )

ENHANCEMENTS:

dependencies: updating to v54.3.0 of github.com/Azure/azure-sdk-for-go


(#11813 )
dependencies: updating mixedreality to use API Version 2021-01-01 (#11824 )
refactor: switching to use an embedded SDK for appconfiguration (#11959 )
refactor: switching to use an embedded SDK for eventhub (#11973 )
provider: support for the Virtual Machine skip_shutdown_and_force_delete feature
(#11216 )
provider: support for the Virtual Machine Scale Set force_delete feature
(#11216 )
provider: no longer auto register the Microsoft.DevSpaces RP (#11822 )
Data Source: azurerm_key_vault_certificate_data - support certificate bundles
and add support for ECDSA keys (#11974 )
azurerm_data_factory_linked_service_sftp - support for hostkey related

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:

azurerm_cdn_endpoint - do not send an empty origin_host_header to the api

(#11852 )
azurerm_linux_virtual_machine_scale_set : changing the

disable_automatic_rollback and enable_automatic_os_upgrade properties no

longer created a new resource (#11723 )


azurerm_storage_share : Fix ID for resource_manager_id (#11828 )
azurerm_windows_virtual_machine_scale_set : changing the
disable_automatic_rollback and enable_automatic_os_upgrade properties no

longer created a new resource (#11723 )

2.60.0 (May 20, 2021)


FEATURES:

New Data Source: azurerm_eventhub_cluster (#11763 )


New Data Source: azurerm_redis_enterprise_database (#11734 )
New Resource: azurerm_static_site (#7150 )
New Resource: azurerm_machine_learning_inference_cluster (#11550 )

ENHANCEMENTS:

dependencies: updating aks to use API Version 2021-03-01 (#11708 )


dependencies: updating eventgrid to use API Version 2020-10-15-preview
(#11746 )
azurerm_cosmosdb_mongo_collection - support for the analytical_storage_ttl

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

Service Health alerts (#11802 )


azurerm_netapp_volume - support for the security_style property - (#11684 )
azurerm_redis_cache - suppot for the replicas_per_master peoperty (#11714 )
azurerm_spring_cloud_service - support for the required_network_traffic_rules

block (#11633 )
azurerm_storage_account_management_policy - the name property can now contain

- (#11792 )

BUG FIXES:

azurerm_frontdoor - added a check for nil to avoid panic on destroy (#11720 )


azurerm_linux_virtual_machine_scale_set - the extension blocks are now a set

(#11425 )
azurerm_virtual_network_gateway_connection - fix a bug where shared_key was

not being updated (#11742 )


azurerm_windows_virtual_machine_scale_set - the extension blocks are now a set

(#11425 )
azurerm_windows_virtual_machine_scale_set - changing the license_type will no

longer create a new resource (#11731 )

2.59.0 (May 14, 2021)


FEATURES:

New Resource: azurerm_consumption_budget_resource_group (#9201 )


New Resource: azurerm_consumption_budget_subscription (#9201 )
New Resource: azurerm_monitor_aad_diagnostic_setting (#11660 )
New Resource:
azurerm_sentinel_alert_rule_machine_learning_behavior_analytics (#11552 )
New Resource: azurerm_servicebus_namespace_disaster_recovery_config
(#11638 )

ENHANCEMENTS:

dependencies: updating to v54.4.0 of github.com/Azure/azure-sdk-for-go


(#11593 )
dependencies: updating databox to API version 2020-12-01 (#11626 )
dependencies: updating maps to API version 2021-02-01 (#11676 )
Data Source: azurerm_kubernetes_cluster - Add
ingress_application_gateway_identity export for add-on
ingress_application_gateway (#11622 )
azurerm_cosmosdb_account - support for the identity and cors_rule blocks

(#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

attribute for the ingress_application_gateway add-on (#11622 )


azurerm_managed_disk - support for the tier property (#11634 )
azurerm_storage_account - support for the

azure_files_identity_based_authentication and routing_preference blocks

(#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

Data Source: azurerm_container_registry_token - updating the validation for the


name field (#11607 )
azurerm_bastion_host - updating the ip_configuration block properties now

forces a new resource (#11700 )


azurerm_container_registry_token - updating the validation for the name field

(#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

exposed_headers properties (#11692 )

2.58.0 (May 07, 2021)


UPGRADE NOTES

azurerm_frontdoor - The custom_https_provisioning_enabled field and the


custom_https_configuration block have been deprecated and has been removed

as they are no longer supported. (#11456 )


azurerm_frontdoor_custom_https_configuration - The resource_group_name has

been deprecated and has been removed as it is no longer supported. (#11456 )

FEATURES:

New Data Source: azurerm_storage_table_entity (#11562 )


New Resource: azurerm_app_service_environment_v3 (#11174 )
New Resource: azurerm_cosmosdb_notebook_workspace (#11536 )
New Resource: azurerm_cosmosdb_sql_trigger (#11535 )
New Resource: azurerm_cosmosdb_sql_user_defined_function (#11537 )
New Resource: azurerm_iot_time_series_insights_event_source_iothub
(#11484 )
New Resource: azurerm_storage_blob_inventory_policy (#11533 )

ENHANCEMENTS:

dependencies: updating network-db to API version 2020-07-01 (#10767 )


azurerm_cosmosdb_account - support for the access_key_metadata_writes_enabled ,
mongo_server_version , and network_acl_bypass properties (#11486 )
azurerm_data_factory - support for the customer_managed_key_id property

(#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 ,

excluded_ip_addresses , included_ip_addresses , target_resource_id , and


resource_type propeties (#11540 )

2.57.0 (April 30, 2021)


UPGRADE NOTES

azurerm_api_management_authorization_server - due to a bug in the 2020-12-01

version of the API Management API, changes to resource_owner_username and


resource_owner_password in Azure will not be noticed by Terraform (#11146 )
azurerm_cosmosdb_account - the 2021-02-01 version of Azure Cosmos DB for

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

API/MongoDB version (#10926 )


azurerm_cosmosdb_gremlin_graph and azurerm_cosmosdb_sql_container - the

patition_key_path property is now required (#10926 )

FEATURES:

Data Source: azurerm_container_registry_scope_map (#11350 )


Data Source: azurerm_container_registry_token (#11350 )
Data Source: azurerm_postgresql_flexible_server (#11081 )
Data Source: azurerm_key_vault_managed_hardware_security_module (#10873 )
New Resource: azurerm_container_registry_scope_map (#11350 )
New Resource: azurerm_container_registry_token (#11350 )
New Resource: azurerm_data_factory_dataset_snowflake (#11116 )
New Resource: azurerm_healthbot (#11002 )
New Resource: azurerm_key_vault_managed_hardware_security_module (#10873 )
New Resource: azurerm_media_asset_filter (#11110 )
New Resource: azurerm_mssql_job_agent (#11248 )
New Resource: azurerm_mssql_job_credential (#11363 )
New Resource: azurerm_mssql_transparent_data_encryption (#11148 )
New Resource: azurerm_postgresql_flexible_server (#11081 )
New Resource: azurerm_spring_cloud_app_cosmosdb_association (#11307 )
New Resource:
azurerm_sentinel_data_connector_microsoft_defender_advanced_threat_protection

(#10669 )
New Resource: azurerm_virtual_machine_configuration_policy_assignment
(#11334 )
New Resource: azurerm_vmware_cluster (#10848 )

ENHANCEMENTS:

dependencies: updating to v53.4.0 of github.com/Azure/azure-sdk-for-go


(#11439 )
dependencies: updating to v1.17.2 of github.com/hashicorp/terraform-plugin-
sdk (#11431 )
dependencies: updating cosmos-db to API version 2021-02-01 (#10926 )
dependencies: updating keyvault to API version v7.1 (#10926 )
Data Source: azurerm_healthcare_service - export the
cosmosdb_key_vault_key_versionless_id attribute (#11481 )
Data Source: azurerm_key_vault_certificate - export the curve attribute in the
key_properties block (#10867 )
Data Source: azurerm_virtual_machine_scale_set - now exports the
network_interfaces (#10585 )
azurerm_app_service - support for the site_config.ip_restrictions.headers and

site_config.scm_ip_restrictions.headers properties (#11209 )


azurerm_app_service_slot - support for the site_config.ip_restrictions.headers

and site_config.scm_ip_restrictions.headers properties (#11209 )


azurerm_backup_policy_file_share - support for the retention_weekly ,
retention_monthly , and retention_yearly blocks (#10733 )
azurerm_cosmosdb_sql_container - support for the conflict_resolution_policy

block (#11517 )
azurerm_container_group - support for the exposed_port block (#10491 )
azurerm_container_registry - deprecating the georeplication_locations property

in favour of the georeplications property #11200 ]


azurerm_database_migration - switching to using an ID Formatter (#11378 )
azurerm_database_migration_project - switching to using an ID Formatter

(#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

key_vault_password property (#11436 )


azurerm_dedicated_host_group - support for the automatic_placement_enabled

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

site_config.scm_ip_restrictions.headers properties (#11209 )


azurerm_function_app - support the java_version property (#10495 )
azurerm_hdinsight_interactive_query_cluster - add support for private link

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

cosmosdb_key_vault_key_versionless_id property (#11481 )


azurerm_kubernetes_cluster - support for the ingress_application_gateway addon

(#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 in the key_properties block (#10867 )


azurerm_key_vault_certificate - support the curve property in the
key_properties block (#10867 )
azurerm_key_vault_certificate - the key_size property in the key_properties

block is now optional (#10867 )


azurerm_kubernetes_cluster - support for the dns_prefix_private_cluster

property (#11321 )
azurerm_kubernetes_cluster - support for the max_node_provisioning_time ,

max_unready_percentage , and max_unready_nodes properties (#11406 )


azurerm_storage_encryption_scope - support for the

infrastructure_encryption_required property (#11462 )


azurerm_kubernetes_cluster support for the empty_bulk_delete_max in the
auto_scaler_profile block #(#11060 )
azurerm_lighthouse_definition - support for the delegated_role_definition_ids

property (#11269 )
azurerm_managed_application - support for the parameter_values property

(#8632 )
azurerm_managed_disk - support for the network_access_policy and

disk_access_id properties (#9862 )


azurerm_postgresql_server - wait for replica restarts when needed (#11458 )
azurerm_redis_enterprise_cluster - support for the minimum_tls_version and

hostname properties (#11203 )


azurerm_storage_account - support for the versioning_enabled ,

default_service_version , and last_access_time_enabled properties within the


blob_properties block (#11301 )
azurerm_storage_account - support for the nfsv3_enabled property (#11387 )
azurerm_storage_management_policy - support for the version block (#11163 )
azurerm_synapse_workspace - support for the customer_managed_key_versionless_id

property (#11328 )

BUG FIXES:

azurerm_api_management - will no longer panic with an empty


hostname_configuration (#11426 )
azurerm_api_management_diagnostic - fix a crash with the frontend_request ,

frontend_response , backend_request , backend_response blocks (#11402 )


azurerm_eventgrid_system_topic - remove strict validation on topic_type

(#11352 )
azurerm_iothub - change filter_rule from TypeSet to TypeList to resolve an

ordering issue (#10341 )


azurerm_linux_virtual_machine_scale_set - the default value for the priority

property will no longer force a replacement of the resource (#11362 )


azurerm_monitor_activity_log_alert - fix a persistent diff for the service_health

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

set for replicas (#11465 )


azurerm_postgresql_server - can now correctly disable replication if required when

create_mode is changed (#11467 )


azurerm_virtual_network_gatewa - updating the custom_route block no longer

forces a new resource to be created [GH- 11433]

2.56.0 (April 15, 2021)


FEATURES:

New Resource: azurerm_data_factory_linked_service_azure_databricks


(#10962 )
New Resource: azurerm_data_lake_store_virtual_network_rule (#10430 )
New Resource: azurerm_media_live_event_output (#10917 )
New Resource: azurerm_spring_cloud_app_mysql_association (#11229 )

ENHANCEMENTS:

dependencies: updating github.com/Azure/azure-sdk-for-go to v53.0.0


(#11302 )
dependencies: updating containerservice to API version 2021-02-01 (#10972 )
azurerm_app_service - fix broken ip_restrictions and scm_ip_restrictions

(#11170 )
azurerm_application_gateway - support for configuring firewall_policy_id within

the path_rule block (#11239 )


azurerm_firewall_policy_rule_collection_group - allow * for the
network_rule_collection.destination_ports property (#11326 )
azurerm_function_app - fix broken ip_restrictions and scm_ip_restrictions

(#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

ugrade mode (#9136 )


azurerm_monitor_activity_log_alert - support for service_health (#10978 )
azurerm_mssql_database - support for the geo_backup_enabled property (#11177 )
azurerm_public_ip - support for ip_tags (#11270 )
azurerm_windows_virtual_machine_scale_set - Support health extension for rolling

ugrade mode (#9136 )

BUG FIXES:

azurerm_app_service_slot - fix crash bug when given empty http_logs (#11267 )

2.55.0 (April 08, 2021)


FEATURES:

New Resource: azurerm_api_management_email_template (#10914 )


New Resource: azurerm_communication_service (#11066 )
New Resource: azurerm_express_route_port (#10074 )
New Resource: azurerm_spring_cloud_app_redis_association (#11154 )

ENHANCEMENTS:

Data Source: azurerm_user_assigned_identity - exporting tenant_id (#11253 )


Data Source: azurerm_function_app - exporting client_cert_mode (#11161 )
azurerm_eventgrid_data_connection - support for the table_name ,

mapping_rule_name , and data_format properties (#11157 )


azurerm_hpc_cache - support for configuring dns (#11236 )
azurerm_hpc_cache - support for configuring ntp_server (#11236 )
azurerm_hpc_cache_nfs_target - support for the access_policy_name property

(#11186 )
azurerm_hpc_cache_nfs_target - usage_model can now be set to

READ_HEAVY_CHECK_180 , WRITE_WORKLOAD_CHECK_30 , WRITE_WORKLOAD_CHECK_60 and


WRITE_WORKLOAD_CLOUDWS (#11247 )
azurerm_function_app - support for configuring client_cert_mode (#11161 )
azurerm_netapp_volume - adding root_access_enabled to the export_policy_rule

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

block can now be set to (OWASP) 3.2 (#11244 )

BUG FIXES:

Data Source: azurerm_dns_zone - fixing a bug where the Resource ID wouldn't


contain the Resource Group name when looking this up (#11221 )
azurerm_media_service_account - storage_authentication_type correctly accepts

both ManagedIdentity and System (#11222 )


azurerm_web_application_firewall_policy - http_listener_ids and

path_based_rule_ids are now Computed only (#11196 )

2.54.0 (April 02, 2021)


FEATURES:

New Resource: azurerm_hpc_cache_access_policy (#11083 )


New Resource: azurerm_management_group_subscription_association (#11069 )
New Resource: azurerm_media_live_event (#10724 )

ENHANCEMENTS:

dependencies: updating to v52.6.0 of github.com/Azure/azure-sdk-for-go


(#11108 )
dependencies: updating storage to API version 2021-01-01 (#11094 )
dependencies: updating storagecache (a.k.a hpc ) to API version 2021-03-01
(#11083 )
azurerm_application_gateway - support for rewriting urls with the url block

(#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

and path_based_rule_ids properties (#10860 )

BUG FIXES:

azurerm_api_management - the certificate_password property is now optional

(#11139 )
azurerm_data_factory_linked_service_azure_blob_storage - correct managed

identity implementation by implementing the service_endpoint property


(#10830 )
azurerm_machine_learning_workspace - deprecate the Enterprise sku as it has

been deprecated by Azure (#11063 )


azurerm_machine_learning_workspace - support container registries in other

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 )

2.53.0 (March 26, 2021)


FEATURES:

New Resource: azurerm_management_group_template_deployment (#10603 )


New Resource: azurerm_tenant_template_deployment (#10603 )
New Data Source: azurerm_template_spec_version (#10603 )

ENHANCEMENTS:

dependencies: updating to v52.5.0 of github.com/Azure/azure-sdk-for-go


(#11015 )
Data Source: azurerm_key_vault_secret - support for the versionless_id attribute
(#11091 )
azurerm_container_registry - support for the public_network_access_enabled

property (#10969 )
azurerm_kusto_eventhub_data_connection - support for the

event_system_properties block (#11006 )


azurerm_logic_app_trigger_recurrence - Add support for schedule (#11055 )
azurerm_resource_group_template_deployment - add support for
template_spec_version_id property (#10603 )
azurerm_role_definition - the permissions block is now optional (#9850 )
azurerm_subscription_template_deployment - add support for

template_spec_version_id property (#10603 )

BUG FIXES:

azurerm_frontdoor_custom_https_configuration - fixing a crash during update

(#11046 )
azurerm_resource_group_template_deployment - always sending parameters_content

during an update (#11001 )


azurerm_role_definition - fixing crash when permissions are empty (#9850 )
azurerm_subscription_template_deployment - always sending parameters_content

during an update (#11001 )


azurerm_spring_cloud_app - supports for the tls_enabled property (#11064 )

2.52.0 (March 18, 2021)


FEATURES:

New Resource: azurerm_mssql_firewall_rule (#10954 )


New Resource: azurerm_mssql_virtual_network_rule (#10954 )

ENHANCEMENTS:

dependencies: updating to v52.4.0 of github.com/Azure/azure-sdk-for-go


(#10982 )
azurerm_api_management_subscription - making user_id property optional

[#10638 }

BUG FIXES:

azurerm_cosmosdb_account_resource - marking connection_string as sensitive

(#10942 )
azurerm_eventhub_namespace_disaster_recovery_config - deprecating the

alternate_name property due to a service side API bug (#11013 )


azurerm_local_network_gateway - making the address_space property optional

(#10983 )
azurerm_management_group - validation for subscription_id list property entries

(#10948 )
2.51.0 (March 12, 2021)
FEATURES:

New Resource: azurerm_purview_account (#10395 )


New Resource: azurerm_data_factory_dataset_parquet (#10852 )
New Resource: azurerm_security_center_server_vulnerability_assessment
(#10030 )
New Resource: azurerm_security_center_assessment (#10694 )
New Resource: azurerm_security_center_assessment_policy (#10694 )
New Resource:
azurerm_sentinel_data_connector_azure_advanced_threat_protection (#10666 )
New Resource: azurerm_sentinel_data_connector_azure_security_center
(#10667 )
New Resource: azurerm_sentinel_data_connector_microsoft_cloud_app_security
(#10668 )

ENHANCEMENTS:

dependencies: updating to v52.3.0 of github.com/Azure/azure-sdk-for-go


(#10829 )
azurerm_role_assignment - support enrollment ids in scope argument (#10890 )
azurerm_kubernetes_cluster - support None for the private_dns_zone_id property

(#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

when rolling_upgrade_policy or health_probe_id is updated (#10856 )


azurerm_netapp_volume - support creating from a snapshot via the

create_from_snapshot_resource_id property (#10906 )


azurerm_role_assignment - support for the description , condition , and
condition_version (#10804 )
azurerm_windows_virtual_machine - support for configuring platform_fault_domain

(#10803 )
azurerm_windows_virtual_machine_scale_set - will no longer recreate the resource

when rolling_upgrade_policy or health_probe_id is updated (#10856 )

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

service does not match config / state (#10931 )


azurerm_key_vault_secret - setting the value of the secret after recovering it

(#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 )

2.50.0 (March 05, 2021)


FEATURES:

New Data Source: azurerm_vmware_private_cloud (#9284 )


New Resource: azurerm_kusto_eventgrid_data_connection (#10712 )
New Resource: azurerm_sentinel_data_connector_aws_cloud_trail (#10664 )
New Resource: azurerm_sentinel_data_connector_azure_active_directory
(#10665 )
New Resource: azurerm_sentinel_data_connector_office_365 (#10671 )
New Resource: azurerm_sentinel_data_connector_threat_intelligence (#10670 )
New Resource: azurerm_subscription (#10718 )
New Resource: azurerm_vmware_private_cloud (#9284 )

ENHANCEMENTS:

dependencies: updating to v52.0.0 of github.com/Azure/azure-sdk-for-go


(#10787 )
dependencies: updating compute to API version 2020-12-01 (#10650 )
Data Source: azurerm_dns_zone - updating to use a consistent Terraform Resource
ID to avoid API issues (#10786 )
azurerm_dns_a_record - updating to use a consistent Terraform Resource ID to

avoid API issues (#10786 )


azurerm_dns_aaaa_record - updating to use a consistent Terraform Resource ID to

avoid API issues (#10786 )


azurerm_dns_caa_record - updating to use a consistent Terraform Resource ID to

avoid API issues (#10786 )


azurerm_dns_cname_record - updating to use a consistent Terraform Resource ID to

avoid API issues (#10786 )


azurerm_dns_mx_record - updating to use a consistent Terraform Resource ID to

avoid API issues (#10786 )


azurerm_dns_ns_record - updating to use a consistent Terraform Resource ID to

avoid API issues (#10786 )


azurerm_dns_ptr_record - updating to use a consistent Terraform Resource ID to

avoid API issues (#10786 )


azurerm_dns_srv_record - updating to use a consistent Terraform Resource ID to

avoid API issues (#10786 )


azurerm_dns_txt_record - updating to use a consistent Terraform Resource ID to

avoid API issues (#10786 )


azurerm_dns_zone - updating to use a consistent Terraform Resource ID to avoid
API issues (#10786 )
azurerm_function_app_host_keys - support for event_grid_extension_config_key

(#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

workspaces with the permanently_delete_on_destroy feature flag (#10235 )


azurerm_monitor_action_group - support for secure webhooks via the aad_auth

block (#10509 )
azurerm_mssql_database - support for the log_monitoring_enabled property within

the extended_auditing_policy block (#10324 )


azurerm_mssql_database_extended_auditing_policy - support for the

log_monitoring_enabled property (#10324 )


azurerm_mssql_server - support for the log_monitoring_enabled property within

the extended_auditing_policy block (#10324 )


azurerm_mssql_server_extended_auditing_policy - support for the
log_monitoring_enabled property [#10324 ]
azurerm_signalr_service - support for the upstream_endpoint block (#10459 )
azurerm_sql_server - support for the log_monitoring_enabled property within the
extended_auditing_policy block (#10324 )
azurerm_sql_database - support for the log_monitoring_enabled property within

the extended_auditing_policy block (#10324 )


azurerm_spring_cloud_java_deployment - supporting delta updates (#10729 )
azurerm_virtual_network_gateway - deprecate peering_address in favour of
peering_addresses (#10381 )

BUG FIXES:

Data Source: azurerm_netapp_volume - fixing a crash when setting


data_protection_replication (#10795 )
azurerm_api_management - changing the sku_name property no longer forces a new

resouce to be created (#10747 )


azurerm_api_management - the field tenant_access can only be configured when

not using a Consumption SKU (#10766 )


azurerum_frontdoor - removed the MaxItems validation from the Backend Pools

(#10828 )
azurerm_kubernetes_cluster_resource - allow windows passwords as short as 8

charaters long (#10816 )


azurerm_cosmosdb_mongo_collection - ignore throughput if Azure Cosmos DB

provisioned in 'serverless' capacity mode (#10389 )


azurerm_linux_virtual_machine - parsing the User Assigned Identity ID case-

insensitively to work around an Azure API issue (#10722 )


azurerm_linux_virtual_machine_scale_set - parsing the User Assigned Identity ID

case-insensitively to work around an Azure API issue (#10722 )


azurerm_netapp_volume - fixing a crash when setting data_protection_replication

(#10795 )
azurerm_virtual_machine - parsing the User Assigned Identity ID case-insensitively

to work around an Azure API issue (#10722 )


azurerm_virtual_machine_scale_set - parsing the User Assigned Identity ID case-

insensitively to work around an Azure API issue (#10722 )


azurerm_windows_virtual_machine - parsing the User Assigned Identity ID case-

insensitively to work around an Azure API issue (#10722 )


azurerm_windows_virtual_machine_scale_set - parsing the User Assigned Identity

ID case-insensitively to work around an Azure API issue (#10722 )

2.49.0 (February 26, 2021)


FEATURES:

New Data Source: azurerm_spring_cloud_app (#10678 )


New Resource: azurerm_databox_edge_device (#10730 )
New Resource: azurerm_databox_edge_order (#10730 )
New Resource: azurerm_kusto_iothub_data_connection (#8626 )
New Resource: azurerm_redis_enterprise_cluster (#10706 )
New Resource: azurerm_redis_enterprise_database (#10706 )
New Resource: azurerm_security_center_assessment_metadata (#10124 )
New Resource: azurerm_spring_cloud_custom_domain (#10404 )

ENHANCEMENTS:

dependencies: updating github.com/hashicorp/terraform-plugin-sdk to the latest


1.x branch (#10692 )
dependencies: updating github.com/hashicorp/go-azure-helpers to v0.14.0
(#10740 )
dependencies: updating github.com/Azure/go-autorest/autorest to v0.11.18
(#10740 )
testing: updating the tests to use the Terraform release binaries when running
acceptance tests (#10523 )
azurerm_api_management - support for the tenant_access block (#10475 )
azurerm_api_management_logger - support for configuring a resource_id

(#10652 )
azurerm_data_factory_linked_service_azure_blob_storage - now supports the

sas_uri property (#10551 )


azurerm_data_factory_linked_service_azure_blob_storage - now supports

Managed Identity and Service Principal authentication (#10551 )


azurerm_monitor_smart_detector_alert_rule - supports for the tags property

(#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:

provider: fixing support for Azure Cloud Shell (#10740 )


provider: MSI authentication is explicitly unavailable in Azure App Service and
Function Apps as these are intentionally not supported (#10740 )
provider: only showing the deprecation message if skip_credentials_registration
is explicitly configured (#10699 )
azurerm_batch_certificate - allow empty password when format is pfx (#10642 )
azurerm_data_factory_integration_runtime_azure_ssis - the administrator_login

and administrator_password properties are now optional (#10474 )


azurerm_data_factory_integration_runtime_managed - the administrator_login and

administrator_password properties are now optional (#10640 )


azurerm_eventhub_namespace - the capacity property can now be greater than 50

(#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

forces a new resource to be created (#10640 )


azurerm_lb_outbound_rule - fixing a crash when frontendIPConfigurations is

omitted in the API response (#10696 )


azurerm_media_content_key_policy - fix an encoding bug which prevented

configuring ask in the fairplay_configuration block (#10684 )

2.48.0 (February 18, 2021)


FEATURES:

New Data Source: azurerm_application_gateway (#10268 )

ENHANCEMENTS:

dependencies: updating to build using Go 1.16 which adds support for


darwin/arm64 (Apple Silicon) (#10615 )
dependencies: updating github.com/Azure/azure-sdk-for-go to v51.2.0
(#10561 )
Data Source: azurerm_bastion_host - updating to use a Resource ID Formatter
(#10570 )
Data Source: azurerm_point_to_site_vpn_gateway - updating to use a Resource ID
Formatter (#10570 )
Data Source: azurerm_kubernetes_cluster - exposing the upgrade_settings block
(#10376 )
Data Source: azurerm_kubernetes_cluster_node_pool - exposing the
upgrade_settings block (#10376 )
Data Source: azurerm_route - pdating to use a Resource ID Formatter (#10570 )
Data Source: azurerm_subnet - updating to use a Resource ID Formatter
(#10570 )
Data Source: azurerm_subscriptions - adding the field id to the subscriptions
block (#10598 )
Data Source: azurerm_virtual_network - updating to use a Resource ID Formatter
(#10570 )
azurerm_bastion_host - updating to use a Resource ID Formatter (#10570 )
azurerm_bastion_host - support for enhanced import validation (#10570 )
azurerm_kubernetes_cluster - support for configuring the upgrade_settings block

(#10376 )
azurerm_kubernetes_cluster - support for automatic_channel_upgrade (#10530 )
azurerm_kubernetes_cluster - support for skip_nodes_with_local_storage within

the auto_scaler_profile block (#10531 )


azurerm_kubernetes_cluster - support for skip_nodes_with_system_pods within the
auto_scaler_profile block (#10531 )
azurerm_kubernetes_cluster_node_pool - support for configuring the

upgrade_settings block (#10376 )


azurerm_lighthouse_definition - add support for principal_id_display_name

property (#10613 )
azurerm_log_analytics_workspace - Support for capacity_reservation_level

property and CapacityReservation SKU (#10612 )


azurerm_point_to_site_vpn_gateway - updating to use a Resource ID Formatter

(#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:

azurerm_eventgrid_event_subscription - change the number of possible


advanced_filter items from 5 to 25 (#10625 )
azurerm_key_vault - normalizing the casing on the certificate_permissions ,

key_permissions , secret_permissions and storage_permissions fields within the


access_policy block (#10593 )
azurerm_key_vault_access_policy - normalizing the casing on the
certificate_permissions , key_permissions , secret_permissions and

storage_permissions fields (#10593 )


azurerm_mariadb_firewall_rule - correctly validate the name property (#10579 )
azurerm_postgresql_server - correctly change ssl_minimal_tls_version_enforced

on update (#10606 )
azurerm_private_endpoint - only updating the associated Private DNS Zone Group

when there's changes (#10559 )


azurerm_resource_group_template_deployment - fixing an issue where the API
version for nested items couldn't be found during deletion (#10565 )

2.47.0 (February 11, 2021)


UPGRADE NOTES

azurerm_frontdoor & azurerm_frontdoor_custom_https_configuration - the new

fields backend_pool_health_probes , backend_pool_load_balancing_settings ,


backend_pools , frontend_endpoints , routing_rules have been added to the

azurerm_frontdoor resource, which are a map of name-ID references. An upcoming

version of the Azure Provider will change the blocks backend_pool ,


backend_pool_health_probe , backend_pool_load_balancing , frontend_endpoint and

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

deprecated and is no longer functional - instead the


azurerm_lb_backend_address_pool_address resource offers the same functionality.

(#10488 )
azurerm_linux_virtual_machine_scale_set &

azurerm_windows_virtual_machine_scale_set - the in-line extension block is now

GA - the environment variable ARM_PROVIDER_VMSS_EXTENSIONS_BETA no longer has


any effect and can be removed (#10528 )
azurerm_data_factory_integration_runtime_managed - this resource has been

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:

New Data Source: azurerm_key_vault_certificate_data (#8184 )


New Resource: azurerm_application_insights_smart_detection_rule (#10539 )
New Resource: azurerm_data_factory_integration_runtime_azure (#10236 )
New Resource: azurerm_data_factory_integration_runtime_azure_ssis (#10236 )
New Resource: azurerm_lb_backend_address_pool_address (#10488 )

ENHANCEMENTS:

dependencies: updating github.com/hashicorp/terraform-plugin-sdk to v1.16.0


(#10521 )
azurerm_frontdoor - added the new fields backend_pool_health_probes ,
backend_pool_load_balancing_settings , backend_pools , frontend_endpoints ,

routing_rules which are a map of name-ID references (#9357 )


azurerm_kubernetes_cluster - updating the validation for the
log_analytics_workspace_id field within the oms_agent block within the

addon_profile block (#10520 )


azurerm_kubernetes_cluster - support for configuring

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

available without enabling the beta (#10528 )


azurerm_media_streaming_endpoint - exporting the field host_name (#10527 )
azurerm_mssql_virtual_machine - support for auto_backup (#10460 )
azurerm_windows_virtual_machine_scale_set - the extension block is now GA and

available without enabling the beta (#10528 )


azurerm_site_recovery_replicated_vm - support for the

recovery_public_ip_address_id property and changing target_static_ip or


target_static_ip force a new resource to be created (#10446 )

BUG FIXES:

provider: the provider-block field skip_credentials_validation is now deprecated


since this was non-functional. This will be removed in 3.0 of the Azure Provider
(#10464 )
Data Source: azurerm_shared_image_versions - retrieving all versions of the image
prior to filtering (#10519 )
azurerm_app_service - the ip_restriction.x.ip_address propertynow accepts

anything other than an empty string (#10440 )


azurerm_cosmosdb_account - validate the key_vault_key_id property is versionless

(#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

within the extension block was an empty string (#10528 )


azurerm_linux_virtual_machine_scale_set - fixing a bug when settings within the

extension block was an empty string (#10528 )


azurerm_monitor_diagnostic_setting - changing the log_analytics_workspace_id

property no longer creates a new resource (#10512 )


azurerm_storage_data_lake_gen2_filesystem - do not set/retrieve ACLs when HNS

is not enabled (#10470 )


azurerm_windows_virtual_machine_scale_set - fixing a bug when

protected_settings within the extension block was an empty string (#10528 )


azurerm_windows_virtual_machine_scale_set - fixing a bug when settings within

the extension block was an empty string (#10528 )

2.46.1 (February 05, 2021)


BUG FIXES:

azurerm_lb_backend_address_pool - mark backend_address as computed

(#10481 )

2.46.0 (February 04, 2021)


FEATURES:

New Resource: azurerm_api_management_identity_provider_aadb2c (#10240 )


New Resource: azurerm_cosmosdb_cassandra_table (#10328 )

ENHANCEMENTS:

dependencies: updating recoveryservices to API version 2018-07-10 (#10373 )


azurerm_api_management_diagnostic - support for the always_log_errors ,

http_correlation_protocol , log_client_ip , sampling_percentage and verbosity

properties (#10325 )
azurerm_api_management_diagnostic - support for the frontend_request ,

frontend_response , backend_request and backend_response blocks (#10325 )


azurerm_kubernetes_cluster - support for configuring the field

enable_host_encryption within the default_node_pool block (#10398 )


azurerm_kubernetes_cluster - added length validation to the admin_password field

within the windows_profile block (#10452 )


azurerm_kubernetes_cluster_node_pool - support for enable_host_encryption

(#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

Management Group, Subscription, Resource Group or Resource ID (#10438 )


azurerm_service_fabric_cluster - support for the

reverse_proxy_certificate_common_names block (#10367 )


azurerm_monitor_metric_alert - support for the skip_metric_validation property

(#10422 )

BUG FIXES:

Data Source: azurerm_api_management fix an exception with User Assigned


Managed Identities (#10429 )
azurerm_api_management_api_diagnostic - fix a bug where specifying log_client_ip
= false would not disable the setting (#10325 )
azurerm_key_vault - fixing a race condition when setting the cache (#10447 )
azurerm_key_vault_certificate - fixing a race condition when setting the cache

(#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

API response (#10469 )


azurerm_storage_account_datasource - prevent panics from passing in an empty
name (#10370 )
azurerm_storage_data_lake_gen2_filesystem - change the ace property to a

TypeSet to ensure consistent ordering (#10372 )


azurerm_storage_data_lake_gen2_path - change the ace property to a TypeSet to

ensure consistent ordering (#10372 )

2.45.1 (January 28, 2021)


BUG FIXES:

azurerm_app_service_environment - prevent a panic when the API returns a nil

cluster settings (#10365 )

2.45.0 (January 28, 2021)


FEATURES:

New Data Source azurerm_search_service (#10181 )


New Resource: azurerm_data_factory_linked_service_snowflake (#10239 )
New Resource: azurerm_data_factory_linked_service_azure_table_storage
(#10305 )
New Resource: azurerm_iothub_enrichment (#9239 )
New Resource: azurerm_iot_security_solution (#10034 )
New Resource: azurerm_media_streaming_policy (#10133 )
New Resource: azurerm_spring_cloud_active_deployment (#9959 )
New Resource: azurerm_spring_cloud_java_deployment (#9959 )

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

Key Vault (#10330 )


azurerm_key_vault - support both ipv4 and cidr formats for the

network_acls.ip_rules property (#10266 )


azurerm_key_vault_certificate - optimised loading of and added caching when

retrieving the Key Vault (#10330 )


azurerm_key_vault_key - optimised loading of and added caching when retrieving

the Key Vault (#10330 )


azurerm_key_vault_secret - optimised loading of and added caching when

retrieving the Key Vault (#10330 )


azurerm_key_vault_certificate - support for the certificate_data_base64

attribute (#10275 )
azurerm_linux_virtual_machine - skipping shutdown for a machine in a failed state

(#10189 )
azurerm_media_services_account - support for setting the

storage_authentication_type field to System (#10133 )


azurerm_redis_cache - support multiple availability zones (#10283 )
azurerm_storage_data_lake_gen2_filesystem - support for the ace block (#9917 )
azurerm_servicebus_namespace - will now allow a capacity of 16 for the Premium

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

extensions_time_budget property (#10298 )

BUG FIXES:

azurerm_iot_time_series_insights_reference_data_set - the field


data_string_comparison_behavior is now ForceNew (#10343 )
azurerm_iot_time_series_insights_reference_data_set - the key_property block is

now ForceNew (#10343 )


azurerm_linux_virtual_machine_scale_set - fixing an issue where

protected_settings field within the extension block couldn't be empty (#10351 )


azurerm_linux_virtual_machine_scale_set - fixing an issue where settings field

within the extension block couldn't be empty (#10351 )


azurerm_media_streaming_endpoint - stopping the streaming endpoint prior to

deletion if the endpoint is in a running state (#10216 )


azurerm_role_definition - don't add scope to assignable_scopes unless none are

specified (#8624 )
azurerm_windows_virtual_machine_scale_set - fixing an issue where

protected_settings field within the extension block couldn't be empty (#10351 )


azurerm_windows_virtual_machine_scale_set - fixing an issue where settings field

within the extension block couldn't be empty (#10351 )

2.44.0 (January 21, 2021)


FEATURES:

New Data Source: azurerm_iothub (#10228 )


New Resource: azurerm_media_content_key_policy (#9971 )

IMPROVEMENTS:

dependencies: updating github.com/Azure/go-autorest to v0.11.16 (#10164 )


dependencies: updating appconfiguration to API version 2020-06-01 (#10176 )
dependencies: updating appplatform to API version 2020-07-01 (#10175 )
dependencies: updating containerservice to API version 2020-12-01 (#10171 )
dependencies: updating msi to API version 2018-11-30 (#10174 )
Data Source: azurerm_kubernetes_cluster - support for the field
user_assigned_identity_id within the identity block (#8737 )
azurerm_api_management - support additional TLS ciphers within the security block

(#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

set to UserAssigned (#8737 )


azurerm_kubernetes_cluster - support for the field new_pod_scale_up_delay within

the auto_scaler_profile block (#9291 )


azurerm_kubernetes_cluster - support for the field user_assigned_identity_id

within the identity block (#8737 )


azurerm_monitor_autoscale_setting - now supports the dimensions property

(#9795 )
azurerm_sentinel_alert_rule_scheduled - now supports the
event_grouping_setting property (#10078 )

BUG FIXES:

azurerm_backup_protected_file_share - updating to account for a breaking API

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 )

2.43.0 (January 14, 2021)


FEATURES:

New Data Source: azurerm_sentinel_alert_rule_template (#7020 )

IMPROVEMENTS:

Data Source: azurerm_api_management - ensuring the casing of the identity_ids


field within the identity block (#10105 )
Data Source: azurerm_kubernetes_cluster - ensuring the casing of the
identity_ids field within the identity block (#10105 )
Data Source: azurerm_virtual_machine - ensuring the casing of the identity_ids
field within the identity block (#10105 )
Data Source: azurerm_virtual_machine_scale_set - ensuring the casing of the
identity_ids field within the identity block (#10105 )
azurerm_api_management - adding validation on the identity_ids field within the

identity block (#10105 )


azurerm_app_service - adding validation on the identity_ids field within the

identity block (#10105 )


azurerm_app_service_slot - adding validation on the identity_ids field within the

identity block (#10105 )


azurerm_container_group - adding validation on the identity_ids field within the
identity block (#10105 )
azurerm_cosmosdb_account - support for analytical_storage_enabled property

(#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

key_vault_password block (#10032 )


azurerm_eventgrid_domain - support for the public_network_access_enabled and
inbound_ip_rule properties (#9922 )
azurerm_eventgrid_topic - support for the public_network_access_enabled and
inbound_ip_rule properties (#9922 )
azurerm_eventhub_namespace - support the trusted_service_access_enabled

property (#10169 )
azurerm_function_app - adding validation on the identity_ids field within the

identity block (#10105 )


azurerm_function_app_slot - adding validation on the identity_ids field within

the identity block (#10105 )


azurerm_kusto_cluster - adding validation on the identity_ids field within the

identity block (#10105 )


azurerm_linux_virtual_machine - adding validation on the identity_ids field

within the identity block (#10105 )


azurerm_linux_virtual_machine_scale_set - adding validation on the identity_ids

field within the identity block (#10105 )


azurerm_security_center_automation - the field event_source within the source

block now supports SecureScoreControls and SecureScores (#10126 )


azurerm_synapse_workspace - support for the sql_identity_control_enabled

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

within the identity block (#10105 )


azurerm_windows_virtual_machine - adding validation on the identity_ids field

within the identity block (#10105 )


azurerm_windows_virtual_machine_scale_set - adding validation on the

identity_ids field within the identity block (#10105 )

BUG FIXES:

Data Source: azurerm_log_analytics_workspace - returning the Resource ID in the


correct casing (#10162 )
azurerm_advanced_threat_protection - fix a regression in the Resouce ID format

(#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

the identity block (#10105 )


azurerm_application_gateway - ensuring the casing on identity_ids within the

identity block (#10031 )


azurerm_blueprint_assignment - ensuring the casing of the identity_ids field

within the identity block (#10105 )


azurerm_container_group - ensuring the casing of the identity_ids field within the

identity block (#10105 )


azurerm_databricks_workspace - changing the sku no longer always forces a new

resource to be created (#9541 )


azurerm_function_app - ensuring the casing of the identity_ids field within the
identity block (#10105 )
azurerm_function_app_slot - ensuring the casing of the identity_ids field within

the identity block (#10105 )


azurerm_kubernetes_cluster - ensuring the casing of the

user_assigned_identity_id field within the kubelet_identity block (#10105 )


azurerm_kusto_cluster - ensuring the casing of the identity_ids field within the

identity block (#10105 )


azurerm_linux_virtual_machine - ensuring the casing of the identity_ids field

within the identity block (#10105 )


azurerm_linux_virtual_machine_scale_set - ensuring the casing of the
identity_ids field within the identity block (#10105 )
azurerm_monitor_diagnostic_setting - handling mixed casing of the EventHub

Namespace Authorization Rule ID (#10104 )


azurerm_mssql_virtual_machine - address persistent diff and use relative expiry for

service principal password (#10125 )


azurerm_role_assignment - fix race condition in read after create (#10134 )
azurerm_role_definition - address eventual consistency issues in update and

delete (#10170 )
azurerm_virtual_machine - ensuring the casing of the identity_ids field within the

identity block (#10105 )


azurerm_virtual_machine_scale_set - ensuring the casing of the identity_ids field

within the identity block (#10105 )


azurerm_windows_virtual_machine - ensuring the casing of the identity_ids field

within the identity block (#10105 )


azurerm_windows_virtual_machine_scale_set - ensuring the casing of the
identity_ids field within the identity block (#10105 )

2.42.0 (January 08, 2021)


BREAKING CHANGES

azurerm_key_vault - the field soft_delete_enabled is now defaulted to true to

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:

New Data Source: azurerm_eventgrid_domain_topic (#10050 )


New Data Source: azurerm_ssh_public_key (#9842 )
New Resource: azurerm_data_factory_linked_service_synapse (#9928 )
New Resource: azurerm_disk_access (#9889 )
New Resource: azurerm_media_streaming_locator (#9992 )
New Resource: azurerm_sentinel_alert_rule_fusion (#9829 )
New Resource: azurerm_ssh_public_key (#9842 )

IMPROVEMENTS:

batch: updating to API version 2020-03-01 (#10036 )


dependencies: upgrading to v49.2.0 of github.com/Azure/azure-sdk-for-go
(#10042 )
dependencies: upgrading to v0.15.1 of github.com/tombuildsstuff/giovanni
(#10035 )
Data Source: azurerm_hdinsight_cluster - support for the
kafka_rest_proxy_endpoint property (#8064 )
Data Source: azurerm_databricks_workspace - support for the tags property
(#9933 )
Data Source: azurerm_subscription - support for the tags property (#8064 )
azurerm_app_service - now supports detailed_error_mesage_enabled and

failed_request_tracing_enabled logs settings (#9162 )


azurerm_app_service - now supports service_tag in ip_restriction blocks

(#9609 )
azurerm_app_service_slot - now supports detailed_error_mesage_enabled and

failed_request_tracing_enabled logs settings (#9162 )


azurerm_batch_pool support for the public_address_provisioning_type property
(#10036 )
azurerm_api_management - support Consumption_0 for the sku_name property

(#6868 )
azurerm_cdn_endpoint - only send content_types_to_compress and geo_filter to

the API when actually set (#9902 )


azurerm_cosmosdb_mongo_collection - correctly read back the _id index when

MongoDB 3.6 (#8690 )


azurerm_container_group - support for the volume.empty_dir property (#9836 )
azurerm_data_factory_linked_service_azure_file_storage - support for the
file_share property (#9934 )
azurerm_dedicated_host - support for addtional sku_name values (#9951 )
azurerm_devspace_controller - deprecating since new DevSpace Controllers can

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

kafka_management_node blocks (#8064 )


azurerm_key_vault - the field soft_delete_enabled is now defaulted to true to

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

validate functions (#9950 )


azurerm_monitor_diagnostic_setting - validation that

eventhub_authorization_rule_id is an EventHub Namespace Authorization Rule ID

(#9914 )
azurerm_monitor_diagnostic_setting - validation that log_analytics_workspace_id

is a Log Analytics Workspace ID (#9914 )


azurerm_monitor_diagnostic_setting - validation that storage_account_id is a

Storage Account ID (#9914 )


azurerm_network_security_rule - increase allowed the number of

application_security_group blocks allowed (#9884 )


azurerm_sentinel_alert_rule_ms_security_incident - support the

alert_rule_template_guid and display_name_exclude_filter properties (#9797 )


azurerm_sentinel_alert_rule_scheduled - support for the
alert_rule_template_guid property (#9712 )
azurerm_sentinel_alert_rule_scheduled - support for creating incidents (#8564 )
azurerm_spring_cloud_app - support the properties https_only , is_public , and

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 )

azurerm_application_gateway - allow 750 for file_upload_limit_mb when the sku

is WAF_v2 (#8753 )
azurerm_firewall_policy_rule_collection_group - correctly validate the

network_rule_collection.destination_ports property (#9490 )


azurerm_cdn_endpoint - changing many delivery_rule condition match_values to

optional (#8850 )
azurerm_cosmosdb_account - always include key_vault_id in update requests for

azure policy enginer compatibility (#9966 )


azurerm_cosmosdb_table - do not call the throughput api when serverless

(#9749 )
azurerm_key_vault - the field soft_delete_retention_days is now defaulted to 90

days to match the Azure API behaviour. (#10088 )


azurerm_kubernetes_cluster - parse oms log_analytics_workspace_id to ensure

correct casing (#9976 )


azurerm_role_assignment fix crash in retry logic (#10051 )
azurerm_storage_account - allow hns when account_tier is Premium (#9548 )
azurerm_storage_share_file - allowing files smaller than 4KB to be uploaded

(#10035 )

2.41.0 (December 17, 2020)


UPGRADE NOTES:

azurerm_key_vault - Azure will be introducing a breaking change on December

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:

New Resource: azurerm_eventgrid_system_topic_event_subscription (#9852 )


New Resource: azurerm_media_job (#9859 )
New Resource: azurerm_media_streaming_endpoint (#9537 )
New Resource: azurerm_subnet_service_endpoint_storage_policy (#8966 )
New Resource: azurerm_synapse_managed_private_endpoint (#9260 )

IMPROVEMENTS:

azurerm_app_service - Add support for outbound_ip_address_list and


possible_outbound_ip_address_list (#9871 )
azurerm_disk_encryption_set - support for updating key_vault_key_id (#7913 )
azurerm_iot_time_series_insights_gen2_environment - exposing data_access_fqdn

(#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

for traffic_routing_method to be MultiValue (#9487 )


BUG FIXES:

azurerm_key_vault_certificate - reading dns_names and emails within the

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

the Resource ID (#9853 )

2.40.0 (December 10, 2020)


FEATURES:

New Resource: azurerm_app_service_certificate_binding (#9415 )


New Resource: azurerm_digital_twins_endpoint_eventhub (#9673 )
New Resource: azurerm_digital_twins_endpoint_servicebus (#9702 )
New Resource: azurerm_media_asset (#9387 )
New Resource: azurerm_media_transform (#9663 )
New Resource: azurerm_resource_provider (#7951 )
New Resource: azurerm_stack_hci_cluster (#9134 )
New Resource: azurerm_storage_share_file (#9406 )
New Resource: azurerm_storage_sync_cloud_endpoint (#8540 )

IMPROVEMENTS:

dependencies: upgrading github.com/Azure/go-autorest/validation to v0.3.1


(#9783 )
dependencies: updating Log Analytics to API version 2020-08-01 (#9764 )
internal: disabling the Azure SDK's validation since it's superfluous (#9783 )
azurerm_app_service - support for PHP version 7.4 (#9727 )
azurerm_bot_channel_directline - support for enhanced import validation

(#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

valid Redis Cache ID (#9771 )


azurerm_security_center_automation - support for the description and tags

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:

azurerm_app_service_managed_certificate - create certificate in service plan

resource group to prevent diff loop (#9701 )


azurerm_bot_channel_directline - the field bot_name is now ForceNew to match

the documentation/API behaviour (#9690 )


azurerm_bot_channel_ms_teams - the field bot_name is now ForceNew to match the

documentation/API behaviour (#9690 )


azurerm_bot_channel_slack - the field bot_name is now ForceNew to match the

documentation/API behaviour (#9690 )


azurerm_bot_connection - the field bot_name is now ForceNew to match the

documentation/API behaviour (#9690 )


azurerm_frontdoor - working around an upstream API issue by rewriting the

returned ID's within Terraform (#9750 )


azurerm_frontdoor_custom_https_configuration - working around an upstream API

issue by rewriting the returned ID's within Terraform (#9750 )


azurerm_frontdoor_firewall_policy - working around an upstream API issue by

rewriting the returned ID's within Terraform (#9750 )


azurerm_media_services_account - fixing a bug where
storage_authentication_type wasn't set (#9663 )
azurerm_media_service_account - checking for the presence of an existing account

during creation (#9802 )


azurerm_postgresql_server - changing the geo_redundant_backup_enabled property

now forces a new resource (#9694 )


azurerm_postgresql_server - Fix issue when specifying empty threat detection list

attributes (#9739 )
azurerm_signar_service - having an empty allowed_origins in the cors block will

no longer cause a panic (#9671 )

2.39.0 (December 04, 2020)


FEATURES:

New Resource: azurerm_api_management_policy (#9215 )


New Resource: azurerm_digital_twins_endpoint_eventgrid (#9489 )
New Resource: azurerm_iot_time_series_insights_gen2_environment (#9616 )

IMPROVEMENTS:

azurerm_dashboard - adding validation at import time to ensure the ID is for a

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

to ensure the ID is for a Notification Hub Authorization Rule (#9529 )


azurerm_notification_hub_namespace - adding validation at import time to ensure

the ID is for a Notification Hub Namespace (#9529 )


azurerm_postgresql_active_directory_administrator - validating during import

that the ID is for a PostgreSQL Active Directory Administrator (#9532 )


azurerm_postgresql_configuration - validating during import that the ID is for a

PostgreSQL Configuration (#9532 )


azurerm_postgresql_database - validating during import that the ID is for a

PostgreSQL Database (#9532 )


azurerm_postgresql_firewall_rule - validating during import that the ID is for a

PostgreSQL Firewall Rule (#9532 )


azurerm_postgresql_virtual_network_rule - validating during import that the ID is

for a PostgreSQL Virtual Network Rule (#9532 )


azurerm_traffic_manager_profile - allow up to 2147483647 for the ttl property

(#9522 )

BUG FIXES:

azurerm_security_center_workspace - fixing the casing on the workspace_id

(#9651 )
azurerm_eventhub_dedicated_cluster - the sku_name capacity can be greater then
1 (#9649 )

2.38.0 (November 27, 2020)


FEATURES:

New Resource azurerm_app_service_managed_certificate (#9378 )


New Data Source: azurerm_digital_twins_instance (#9430 )
New Data Source: azurerm_virtual_wan (#9382 )
New Resource: azurerm_digital_twins_instance (#9430 )

IMPROVEMENTS:

dependencies: updating App Service to API version 2020-06-01 (#9409 )


Data Source azurerm_app_service now exports the custom_domain_verification_id
attribute (#9378 )
Data Source azurerm_function_app now exports the custom_domain_verification_id
attribute (#9378 )
Data Source: azurerm_spring_cloud_service - now exports the
outbound_public_ip_addresses attribute (#9261 )
azurerm_app_service now exports custom_domain_verification_id (#9378 )
azurerm_application_insights - validating the resource ID is correct during import

(#9446 )
azurerm_application_insights_web_test - validating the resource ID is correct

during import (#9446 )


azurerm_express_route_circuit_peering - support for the ipv6 block (#9235 )
azurerm_function_app now exports the custom_domain_verification_id attribute

(#9378 )
azurerm_vpn_server_configuration - deprecate the radius_server block in favour

of the radius block which supports multiple servers (#9308 )


azurerm_spring_cloud_service - now exports the outbound_public_ip_addresses

attribute (#9261 )
azurerm_virtual_network_gateway - support for the dpd_timeout_seconds and

local_azure_ip_address_enabled properties (#9330 )


azurerm_virtual_network_gateway_connection - support for the

private_ip_address_enabled propeties and the custom_route block (#9330 )

BUG FIXES:

azurerm_api_management - fixing an issue where developer portal certificates are

updated on every apply (#7299 )


azurerm_cosmosdb_account - corrently updates the zone_redundant property during

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

breaking change when upgrading from v2.35.0 or later (#9495 )


azurerm_virtual_desktop_host_pool - adding a state migration to avoid a breaking

change when upgrading from v2.35.0 or later (#9495 )


azurerm_virtual_desktop_workspace - adding a state migration to avoid a breaking

change when upgrading from v2.35.0 or later (#9495 )


azurerm_virtual_desktop_workspace_application_group_association - adding 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

the default value (#9495 )

2.37.0 (November 20, 2020)


FEATURES:
New Data Source: azurerm_servicebus_subscription (#9272 )
New Data Source: azurerm_storage_encryption_scope (#8894 )
New Resource: azurerm_log_analytics_cluster (#8946 )
New Resource: azurerm_log_analytics_cluster_customer_managed_key (#8946 )
New Resource: azurerm_security_center_automation (#8781 )
New Resource: azurerm_storage_data_lake_gen2_path (#7521 )
New Resource: azurerm_storage_encryption_scope (#8894 )
New Resource: azurerm_vpn_gateway_connection (#9160 )

IMPROVEMENTS:

storage: foundational improvements to support toggling between the Data Plane


and Resource Manager Storage API's in the future (#9314 )
Data Source: azurerm_firewall - exposing dns_servers , firewall_policy_id ,
sku_name , sku_tier , threat_intel_mode , virtual_hub and zones (#8879 )
Data Source: azurerm_firewall - exposing public_ip_address_id and
private_ip_address_id within the ip_configuration block (#8879 )
Data Source: azurerm_firewall - exposing name within the
management_ip_configuration block (#8879 )
Data Source: azurerm_kubernetes_node_pool - exposing os_disk_type (#9166 )
azurerm_api_management_api_diagnostic - support for the always_log_errors ,

http_correlation_protocol , log_client_ip and verbosity attributes (#9172 )


azurerm_api_management_api_diagnostic - support the frontend_request ,
frontend_response , backend_request and backend_response blocks (#9172 )
azurerm_container_group - support for secret container volumes with the
container.#.volume.#.secret attribute (#9117 )
azurerm_cosmosdb_account - support for the public_network_access_enabled

property (#9236 )
azurerm_cosmosdb_cassandra_keyspace - throughput can now be set to higher than

1000000 if enabled by Azure Support (#9050 )


azurerm_cosmosdb_gremlin_database - throughput can now be set to higher than

1000000 if enabled by Azure Support (#9050 )


azurerm_cosmosdb_mongo_database - throughput can now be set to higher than

1000000 if enabled by Azure Support (#9050 )


azurerm_cosmosdb_sql_container - max_throughput within the autoscale_settings

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

1000000 if enabled by Azure Support (#9050 )


azurerm_cosmosdb_table - throughput can now be set to higher than 1000000 if

enabled by Azure Support (#9050 )


azurerm_dns_zone - support for the soa_record block (#9319 )
azurerm_firewall - support for firewall_policy_id , sku_name , sku_tier and

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

now be set to a maximum value of 1000 (#9227 )


azurerm_kubernetes_cluster - min_count within the default_node_pool block can

now be set to a maximum value of 1000 (#9227 )


azurerm_kubernetes_cluster - node_count within the default_node_pool block can

now be set to a maximum value of 1000 (#9227 )


azurerm_kubernetes_cluster - the block http_application_routing within the

addon_profile block can now be updated/removed (#9358 )


azurerm_kubernetes_node_pool - support for configuring os_disk_type (#9166 )
azurerm_kubernetes_node_pool - max_count can now be set to a maximum value of

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

a new resource (#9264 )


azurerm_linux_virtual_machine - support for graceful shutdowns (via the features

block) (#8470 )
azurerm_linux_virtual_machine_scale_set - support for the

platform_fault_domain_count , disk_iops_read_write , and disk_mbps_read_write

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

forces a new resource (#9264 )


azurerm_windows_virtual_machine - support for graceful shutdowns (via the

features block) (#8470 )


azurerm_windows_virtual_machine - support for the patch_mode property (#9258 )
azurerm_windows_virtual_machine_scale_set - support for the
platform_fault_domain_count , disk_iops_read_write , and disk_mbps_read_write

properties (#9262 )

BUG FIXES:

Data Source: azurerm_key_vault_certificate - fixing a crash when serializing the


certificate policy block (#9355 )
azurerm_api_management - the field xml_content within the policy block now

supports C#/.net interpolations (#9296 )


azurerm_cosmosdb_sql_container - no longer attempts to get throughput settings

when Azure Cosmos DB account is serverless (#9311 )


azurerm_firewall_policy - deprecate the dns.network_rule_fqdn_enabled property

as the API no longer allows it to be set (#9332 )


azurerm_key_vault_certificate - fixing a crash when serializing the certificate

policy block (#9355 )


azurerm_mssql_virtual_machine - fixing a crash when serializing auto_patching

(#9388 )
azurerm_resource_group_template_deployment - fixing an issue during deletion

where the API version of nested resources couldn't be determined (#9364 )

2.36.0 (November 12, 2020)


UPGRADE NOTES:

azurerm_network_connection_monitor - has been updated to work with v2 of the

resource as the service team is deprecating v1 - all v1 properties have been


deprecated and will be removed in version 3.0 of the provider and v2 propeties
added. (#8640 )

FEATURES:

New Data Source: azurerm_data_share_dataset_kusto_database (#8544 )


New Data Source: azurerm_traffic_manager_profile (#9229 )
New Resource: azurerm_api_management_custom_domain (#8228 )
New Resource: azurerm_data_share_dataset_kusto_database (#8544 )
New Resource: azurerm_log_analytics_storage_insights (#9014 )
New Resource: azurerm_monitor_smart_detector_alert_rule (#9032 )
New Resource: azurerm_virtual_hub_security_partner_provider (#8978 )
New Resource: azurerm_virtual_hub_bgp_connection (#8959 )

IMPROVEMENTS:

dependencies: upgrading to v0.4.2 of github.com/Azure/go-


autorest/autorest/azure/cli (#9168 )
dependencies: upgrading to v48.1.0 of github.com/Azure/azure-sdk-for-go
(#9213 )
dependencies: upgrading to v0.13.0 of github.com/hashicorp/go-azure-helpers
(#9191 )
dependencies: upgrading to v0.14.0 of github.com/tombuildsstuff/giovanni
(#9189 )
storage: upgrading the Data Plane API's to API Version 2019-12-12 (#9192 )
Data Source azurerm_kubernetes_node_pool - exporting
proximity_placement_group_id (#9195 )
azurerm_app_service support v5.0 for the dotnet_framework_version (#9251 )
azurerm_availability_set - adding validation to the name field (#9279 )
azurerm_cosmosdb_account - support for the key_vault_key_id property allowing
use of Customer Managed Keys (#8919 )
azurerm_eventgrid_domain - adding validation to the name field (#9281 )
azurerm_eventgrid_domain_topic - adding validation to the name field (#9281 )
azurerm_eventgrid_domain_topic - adding validation to the domain_name field

(#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

the storage_account_uri property empty (#8917 )


azurerm_linux_virtual_machine_scale_set - support for managed boot diagnostics

by leaving the storage_account_uri property empty (#8917 )


azurerm_log_analytics_workspace - support for the internet_ingestion_enabled

and internet_query_enabled properties (#9033 )


azurerm_logic_app_workflow added logicapp name validation (#9282 )
azurerm_kubernetes_cluster - support for proximity_placement_group_id within

the default_node_pool block (#9195 )


azurerm_kubernetes_node_pool - support for proximity_placement_group_id

(#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

leaving the storage_account_uri property empty (#8917 )


azurerm_windows_virtual_machine_scale_set - support for managed boot

diagnostics by leaving the storage_account_uri property empty (#8917 )

BUG FIXES:

azurerm_cosmosdb_sql_database no longer attempts to get throughput settings

when Azure Cosmos DB account is serverless (#9187 )


azurerm_kubernetes_cluster - changing the field availability_zones within the

default_node_pool block now requires recreating the resource to match the

behaviour of the Azure API (#8814 )


azurerm_kubernetes_cluster_node_pool - changing the field availability_zones

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

can now be configured up to 4095 (#9202 )


azurerm_linux_virtual_machine_scale_set - the field disk_size_gb within the

os_disk block can now be configured up to 4095 (#9202 )


azurerm_linux_virtual_machine_scale_set - the field computer_name_prefix can

now end with a dash (#9182 )


azurerm_windows_virtual_machine - the field disk_size_gb within the os_disk

block can now be configured up to 4095 (#9202 )


azurerm_windows_virtual_machine_scale_set - the field disk_size_gb within the
os_disk block can now be configured up to 4095 (#9202 )

2.35.0 (November 05, 2020)


UPGRADE NOTES:

azurerm_kubernetes_cluster - the field enable_pod_security_policy and

node_taints (within the default_node_pool block) can no longer be configured -

see below for more details (#8982 )

FEATURES:

New Data Source: azurerm_images (#8629 )


New Resource: azurerm_firewall_policy_rule_collection_group (#8603 )
New Resource: azurerm_virtual_hub_ip_configuration (#8912 )
New Resource: azurerm_virtual_hub_route_table (#8939 )

IMPROVEMENTS:

dependencies: updating containerservice to API version 2020-09-01 (#8982 )


dependencies: updating iottimeseriesinsights to API Version 2020-05-15
(#9129 )
azurerm_data_factory_linked_service_data_lake_storage_gen2 - Supports

managed identity auth through use_managed_identity (#8938 )


azurerm_firewall - support the dns_servers property (#8878 )
azurerm_firewall_network_rule_collection - support the destination_fqdns

property in the rule block (#8878 )


azurerm_virtual_hub_connection - support for the routing block (#8950 )

BUG FIXES:

Fixed regression that prevented Synapse client registering in all Azure


environments (#9100 )
azurerm_cosmosdb_mongo_database no longer attempts to get throughput settings

when Azure Cosmos DB account is serverless (#8673 )


azurerm_key_vault_access_policy - check access policy consistency before

committing to state (#9125 )


azurerm_kubernetes_cluster - the field enable_pod_security_policy can no longer

be set, due to this functionality being removed from AKS as of 2020-10-15


(#8982 )
azurerm_kubernetes_cluster - the field node_taints can no longer be set on the
default_node_pool block, to match the behaviour of AKS (#8982 )
azurerm_virtual_desktop_application_group - adding validation to the
host_pool_id field (#9057 )
azurerm_virtual_desktop_workspace_application_group_association - adding

validation to the application_group_id field (#9057 )


azurerm_virtual_desktop_workspace_application_group_association - adding

validation to the workspace_id field (#9057 )


azurerm_virtual_desktop_workspace_application_group_association - validating

the ID during import is a Workspace Application Group Association ID (#9057 )


azurerm_postgresql_firewall_rule - add validation for start_ip_address and
end_ip_address properties (#8963 )

2.34.0 (October 29, 2020)


UPGRADE NOTES

azurerm_api_management_api - fixing a regression introduced in v2.16 where this

value for subscription_required was defaulted to false instead of true (#7963 )

FEATURES:

New Data Source: azurerm_cognitive_account (#8773 )


New Resource: azurerm_log_analytics_data_export_rule (#8995 )
New Resource: azurerm_log_analytics_linked_storage_account (#9002 )
New Resource: azurerm_security_center_auto_provisioning (#8595 )
New Resource: azurerm_synapse_role_assignment (#8863 )
New Resource: azurerm_vpn_site (#8896 )

IMPROVEMENTS:

Data Source: azurerm_policy_definition - can now look up built-in policy by name


(#9078 )
azurerm_backup_policy_vm - support for the property

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

value for subscription_required was defaulted to false instead of true (#7963 )


azurerm_app_service - fixing a crash when provisioning an app service inside an

App Service Environment which doesn't exist (#8993 )


azurerm_cdn_endpoint - disable persisting default value for

is_compression_enabled to state file (#8610 )


azurerm_databricks_workspace correctly validate the name property (#8997 )
azurerm_dev_test_policy - now correctly deletes (#9077 )
azurerm_log_analytics_workspace - support for the daily_quota_gb property

(#8861 )
azurerm_local_network_gateway - support for the gateway_fqdn property (#8998 )
azurerm_key_vault - prevent unwanted diff due to inconsistent casing for the

sku_name property (#8983 )


azurerm_kubernetes_cluster - fix issue where min_count and max_count couldn't
be equal (#8957 )
azurerm_kubernetes_cluster - min_count can be updated when
enable_auto_scaling is set to true (#8619 )
azurerm_private_dns_zone_virtual_network_link - fixes case issue in name

(#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 )

2.33.0 (October 22, 2020)


UPGRADE NOTES

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:

New Resource: azurerm_service_fabric_mesh_secret (#8933 )


New Resource: azurerm_service_fabric_mesh_secret_value (#8933 )

IMPROVEMENTS:

Data Source: azurerm_shared_image_version - exposing os_disk_image_size_gb


(#8904 )
azurerm_app_configuration - support for the identity block (#8875 )
azurerm_cosmosdb_sql_container - support for composite indexes (#8792 )
azurerm_mssql_database - do not set longterm and shortterm retention policies

when using the DW SKUs (#8899 )


azurerm_mysql_firewall_rule - validating the start_ip_address and

end_ip_address fields are IP Addresses (#8948 )


azurerm_redis_firewall_rule - validating the start_ip and end_ip fields are IP

Addresses (#8948 )
azurerm_search_service - support for the identity block (#8907 )
azurerm_sql_firewall_rule - adding validation for the start_ip_address and

end_ip_address fields (#8935 )

BUG FIXES:

azurerm_application_gateway - now supports ignore_changes for ssl_certificate

when using pre-existing certificates (#8761 )


azurerm_mssql_database - working around a breaking change/regression in the

Azure API (#8975 )


azurerm_mssql_database_extended_auditing_policy - working around a breaking

change/regression in the Azure API (#8975 )


azurerm_mssql_server - working around a breaking change/regression in the Azure

API (#8975 )
azurerm_mssql_server_extended_auditing_policy - working around a breaking

change/regression in the Azure API (#8975 )


azurerm_sql_database - working around a breaking change/regression in the Azure

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 )

2.32.0 (October 15, 2020)


FEATURES:

New data source: azurerm_mysql_server (#8787 )


New resource: azurerm_security_center_setting (#8783 )
New Resource: azurerm_service_fabric_mesh_local_network (#8838 )
New resource: azurerm_eventgrid_system_topic (#8735 )

IMPROVEMENTS:

azurerm_container_registry - support for the trust_policy and retention_policy

blocks (#8698 )
azurerm_security_center_contact - override SDK creat function to handle 201

response code (#8774 )

2.31.1 (October 08, 2020)


IMPROVEMENTS:

azurerm_cognitive_account - kind now supports Personalizer (#8860 )


azurerm_search_service - sku now supports storage_optimized_l1 and
storage_optimized_l2 (#8859 )
azurerm_storage_share - set metadata to Computed and set acl start and expiry

to Optional (#8811 )

BUG FIXES:

azurerm_dedicated_hardware_security_module - stamp_id now optional to allow

use in Locations which use zones (#8826 )


azurerm_storage_account - large_file_share_enabled marked as computed to

prevent existing storage shares from attempting to disable the default (#8807 )

2.31.0 (October 08, 2020)


UPGRADE NOTES

This release updates the azurerm_security_center_subscription_pricing resource


to use the latest version of the Security API which now allows configuring multiple
Resource Types - as such a new field resource_type is now available.
Configurations default the resource_type to VirtualMachines which matches the
behaviour of the previous release - but your Terraform Configuration may need
updating.

FEATURES:

New Resource: azurerm_service_fabric_mesh_application (#6761 )


New Resource: azurerm_virtual_desktop_application_group (#8605 )
New Resource:
azurerm_virtual_desktop_workspace_application_group_association (#8605 )
New Resource: azurerm_virtual_desktop_host_pool (#8605 )
New Resource: azurerm_virtual_desktop_workspace (#8605 )

IMPROVEMENTS:

dependencies: updating github.com/Azure/azure-sdk-for-go to v46.4.0 (#8642 )


data.azurerm_application_insights - support for the connection_string property

(#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

properties can now be set to 0 (#8300 )


azurerm_mssql_database - the min_capacity property can now be set to 0

(#8308 )
azurerm_mssql_database - support for long_term_retention_policy and

short_term_retention_policy blocks [#8765 ]


azurerm_mssql_server - support the minimum_tls_version property (#8361 )
azurerm_mssql_virtual_machine - support for storage_configuration_settings

(#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:

azurerm_function_app - mark the app_settings block as computed (#8682 )


azurerm_function_app_slot - mark the app_settings block as computed (#8682 )
azurerm_policy_set_definition - corrects issue with empty parameter_values

attribute (#8668 )
azurerm_policy_definition - mode property now enforces correct case (#8795 )

2.30.0 (October 01, 2020)


UPGRADE NOTES

This release renames certain fields within the azurerm_cosmosdb_account (data


source & resource) and azurerm_function_app_host_keys data source to follow
HashiCorp's inclusive language guidelines - where fields have been renamed,
existing fields will continue to remain available until the next major version of the
Azure Provider ( v3.0 )

FEATURES:

New Data Source: azurerm_cosmosdb_sql_storedprocedure (#6189 )


New Data Source: azurerm_ip_groups (#8556 )
New Resource: azurerm_ip_groups (#8556 )
New Resource: azurerm_resource_group_template_deployment (#8672 )
New Resource: azurerm_subscription_template_deployment (#8672 )

IMPROVEMENTS:

dependencies: updating iothub to 2020-03-01 (#8688 )


dependencies: updating storagecache to 2020-03-01 (#8078 )
dependencies: updating resources to API Version 2020-06-01 (#8672 )
azurerm_analysis_services_server - support for the S8v2 and S9v2 SKU's

(#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

property in the index block (#8602 )


azurerm_hpc_cache - support the mtu and root_squash_enabled properties

(#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

correlation_filter.properties property (#8646 )


azurerm_storage_management_policy - support the appendBlob value for blob_types

(#8659 )

BUG FIXES:

azurerm_monitor_metric_alert - property wait when creating/updating multiple

monitor metric alerts (#8667 )


azurerm_linux_virtual_machine_scale_set - fix empty JSON error in settings and

protected_settings when these values are not used (#8627 )

2.29.0 (September 24, 2020)


UPGRADE NOTES:

azurerm_api_management - the value None has been removed from the identity

block to match other resources, to specify an API Management Service with no


Managed Identity remove the identity block (#8411 )
azurerm_container_registry - the storage_account_id property now forces a new

resource as required by the updated API version (#8477 )


azurerm_virtual_hub_connection - deprecating the field
vitual_network_to_hub_gateways_traffic_allowed since due to a breaking change

in the API behaviour this is no longer used (#7601 )


azurerm_virtual_hub_connection - deprecating the field
hub_to_vitual_network_traffic_allowed since due to a breaking change in the API
behaviour this is no longer used (#7601 )
azurerm_virtual_wan - deprecating the field allow_vnet_to_vnet_traffic since due

to a breaking change in the API behaviour this is no longer used (#7601 )

FEATURES:

New Data Source: azurerm_data_share_dataset_kusto_cluster (#8464 )


New Data Source: azurerm_databricks_workspace (#8502 )
New Data Source: azurerm_firewall_policy (#7390 )
New Data Source: azurerm_storage_sync_group (#8462 )
New Data Source: azurerm_mssql_server (#7917 )
New Resource: azurerm_data_share_dataset_kusto_cluster (#8464 )
New Resource: azurerm_firewall_policy (#7390 )
New Resource: azurerm_mysql_server_key (#8125 )
New Resource: azurerm_postgresql_server_key (#8126 )

IMPROVEMENTS:

dependencies: updating github.com/Azure/azure-sdk-for-go to v46.3.0 (#8592 )


dependencies: updating containerregistry to 2019-05-01 (#8477 )
Data Source: azurerm_api_management - export the private_ip_addresses attribute
for primary and additional locations (#8290 )
azurerm_api_management - support the virtual_network_configuration block for

additional locations (#8290 )


azurerm_api_management - export the private_ip_addresses attribute for additional
locations (#8290 )
azurerm_cosmosdb_account - support the Serverless value for the capabilities

property (#8533 )
azurerm_cosmosdb_sql_container - support for the indexing_policy property

(#8461 )
azurerm_mssql_server - support for the recover_database_id and

restore_dropped_database_id properties (#7917 )


azurerm_policy_set_definition - support for typed parameter values other then

string in the policy_definition_reference block deprecating parameters in favour


of parameter_vcaluess (#8270 )
azurerm_search_service - Add support for allowed_ips (#8557 )
azurerm_service_fabric_cluster - Remove two block limit for
client_certificate_thumbprint (#8521 )
azurerm_signalr_service - support for delta updates (#8541 )
azurerm_spring_cloud_service - support for configuring the network block

(#8568 )
azurerm_virtual_hub_connection - deprecating the field
vitual_network_to_hub_gateways_traffic_allowed since due to a breaking change

in the API behaviour this is no longer used (#7601 )


azurerm_virtual_hub_connection - deprecating the field
hub_to_vitual_network_traffic_allowed since due to a breaking change in the API

behaviour this is no longer used (#7601 )


azurerm_virtual_hub_connection - switching to use the now separate API for

provisioning these resources (#7601 )


azurerm_virtual_wan - deprecating the field allow_vnet_to_vnet_traffic since due

to a breaking change in the API behaviour this is no longer used (#7601 )


azurerm_windows_virtual_machine - support for updating the license_type field

(#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 )

2.28.0 (September 17, 2020)


UPGRADE NOTES

The id field for the azurerm_role_definition changed in release 2.27.0 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
from this version of the Azure Provider.

FEATURES:

New Data Source: azurerm_data_share_dataset_data_lake_gen2 [#7907 ]


New Data Source: azurerm_servicebus_queue_authorization_rule (#8438 )
New Data Source: azurerm_storage_sync [#7843 ]
New Resource: azurerm_data_share_dataset_data_lake_gen2 (#7907 )
New Resource: azurerm_lighthouse_definition (#6560 )
New Resource: azurerm_lighthouse_assignment (#6560 )
New Resource: azurerm_mssql_server_extended_auditing_policy (#8447 )
New Resource: azurerm_storage_sync (#7843 )
New Resource: azurerm_synapse_sql_pool (#8095 )

IMPROVEMENTS:

Data Source: azurerm_app_service_environment - Expose vip information of an app


service environment (#8487 )
Data Source: azurerm_function_app - export the identity block (#8389 )
azurerm_app_service_hybrid_connection - support relays in different namespaces

(#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:

Data Source: azurerm_function_app_host_keys - Fix a crash when null ID sometimes


returned by API (#8430 )
azurerm_cognitive_account - correctly wait on update logic (#8386 )
azurerm_eventhub_consumer_group - allow the name property to be set to $Default

(#8388 )
azurerm_kubernetes_cluster - ensure the OMS Agent Log Analytics Workspace

case is preserved after disabling/enabling (#8374 )


azurerm_management_group_id - loosen case restritions during parsing of

management group ID (#8024 )


azurerm_packet_capture - fix to ID path to match change in API (#8167 )
azurerm_role_definition - expose role_definition_resource_id (#8492 )

2.27.0 (September 10, 2020)


UPGRADE NOTES

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:

New Data Source: azurerm_attestation_provider (#7885 )


New Data Source: azurerm_function_app_host_keys (#7902 )
New Data Source: azurerm_lb_rule (#8365 )
New Resource: azurerm_mssql_database_extended_auditing_policy (#7793 )
New Resource: azurerm_attestation_provider (#7885 )
New Resource: azurerm_api_management_api_diagnostic (#7873 )
New Resource: azurerm_data_factory_linked_service_azure_sql_database
(#8349 )

IMPROVEMENTS:

Data Source: azurerm_virtual_network_gateway - exposing aad_audience ,


aad_issuer and aad_tenant within the vpn_client_configuration block (#8294 )
azurerm_cosmosdb_account - supporting the value AllowSelfServeUpgradeToMongo36

for the name field within the capabilities block (#8335 )


azurerm_linux_virtual_machine - Add support for encryption_at_host_enabled

(#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

aad_tenant within the vpn_client_configuration block (#8294 )


azurerm_windows_virtual_machine - Add support for encryption_at_host_enabled

(#8322 )
azurerm_windows_virtual_machine_scale_set - Add support for
encryption_at_host_enabled (#8322 )

BUG FIXES:

azurerm_api_management_x.y.api_name - validation fix (#8409 )


azurerm_application_insights_webtests - Fix an issue where the kind property is

sometimes set to null (#8372 )


azurerm_cognitive_account - Fixes a crash when provisioning a QnAMaker and

supports AnomalyDetector (#8357 )


azurerm_linux_virtual_machine - Add WaitForState on VM delete (#8383 )
azurerm_network_security_group - fixed issue where updates would fail for

resource (#8384 )
azurerm_role_definition - fixed delete operation when role is scoped to

Management Group (#6107 )


azurerm_windows_virtual_machine - Add WaitForState on VM delete (#8383 )

2.26.0 (September 04, 2020)


UPGRADE NOTES:

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:

New Resource: azurerm_log_analytics_saved_search (#8253 )

IMPROVEMENTS:

dependencies: updating loganalytics to 2020-03-01-preview (#8234 )


azurerm_api_management_subscription - Support allow_tracing property

(#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:

azurerm_cdn_endpoint - fixing the casing of the Resource ID to be consistent

(#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

updating metadata (#8304 )


azurerm_linux_virtual_machine - allow updating allow_extension_operations

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

Network Interface being deleted during a refresh (#8267 )


azurerm_network_interface_application_security_group_association - handling

the Network Interface being deleted during a refresh (#8267 )


azurerm_network_interface_backend_address_pool_association - handling the

Network Interface being deleted during a refresh (#8267 )


azurerm_network_interface_nat_rule_association_resource - handling the Network

Interface being deleted during a refresh (#8267 )


azurerm_network_interface_network_security_group_association - handling the

Network Interface being deleted during a refresh (#8267 )


azurerm_windows_virtual_machine - allow updating allow_extension_operations

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:

azurerm_container_group - The secure_environment_variables field within the

container now maps keys with empty values, which differs from previous versions

of this provider which ignored empty values (#8151 )

FEATURES:

New Resource azurerm_spring_cloud_certificate (#8067 )

IMPROVEMENTS:

dependencies: updating keyvault to 2019-09-01 (#7822 )


azurerm_app_service_slot_virtual_network_swift_connection - adding validation

that the app_service_id is an App Service / Function App ID (#8111 )


azurerm_app_service_slot_virtual_network_swift_connection - adding validation

that the subnet is a Subnet ID (#8111 )


azurerm_batch_pool - Remove network_configuration from update payload

(#8189 )
azurerm_frontdoor_firewall_policy - match_variable within the match_condition

block can now be set to SocketAddr (#8244 )


azurerm_linux_virtual_machine_scale_set - upgrade_mode="Automatic" no longer

requires health probe (#6667 )


azurerm_key_vault - support for soft_delete_retention_days (#7822 )
azurerm_shared_image - Support for purchase_plan (#8124 )
azurerm_shared_image_gallery - validating at import time that the ID is for a

Shared Image Gallery (#8240 )


azurerm_windows_virtual_machine_scale_set - upgrade_mode="Automatic" no longer

requires health probe (#6667 )

BUG FIXES:

Data Source: azurerm_app_service - ensuring the site_config block is correctly set


into the state (#8212 )
Enhanced Validation: supporting "centralindia", "southindia" and "westindia" as
valid regions in Azure Public (working around invalid data from the Azure API)
(#8217 )
azurerm_application_gateway - allow setting ip_addresses within the

backend_address_pool block to an empty list (#8210 )


azurerm_application_gateway - adding validation to the zone field (#8233 )
azurerm_container_group - the secure_environment_variables field within the
container now maps keys with empty values (#8151 )
azurerm_dedicated_host - waiting for the resource to be gone 20 times rather than

10 to work around an API issue (#8221 )


azurerm_dedicated_host_group - adding validation to the zone field (#8233 )
azurerm_firewall - adding validation to the zone field (#8233 )
azurerm_hardware_security_module - adding validation to the zone field (#8233 )
azurerm_lb - adding validation to the zone field (#8233 )
azurerm_linux_virtual_machine - support for updating ultra_ssd_enabled within

the additional_capabilities block without recreating the virtual machine


(#8015 )
azurerm_linux_virtual_machine_scale_set - adding validation to the zone field

(#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

the additional_capabilities block without recreating the virtual machine


(#8015 )
azurerm_windows_virtual_machine_scale_set - adding validation to the zone field

(#8233 )

2.24.0 (August 20, 2020)


FEATURES:

New Resource: azurerm_synapse_spark_pool (#7886 )

IMPROVEMENTS:

dependencies: update containerinstance to API version 2019-12-01 (#8110 )


azurerm_api_management_api - now supports oauth2_authorization and

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

ensure they're reliable (#8146 )


azurerm_frontdoor_custom_https_configuration - ensuring all fields are set into the

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

Resource ID's to ensure they're reliable (#8146 )


azurerm_frontdoor_custom_https_configuration - updating the ID to use the

frontendEndpoint's Resource ID rather than a custom Resource ID (#8146 )


azurerm_lb - switching to use API version 2020-03-01 to workaround a bug in API

version 2020-05-01 (#8006 )


azurerm_lb_backend_address_pool - adding more specific validation for the Load
Balancer ID field (#8172 )
azurerm_lb_backend_address_pool - ensuring all fields are always set into the state

(#8172 )
azurerm_lb_backend_address_pool - switching to use API version 2020-03-01 to

workaround a bug in API version 2020-05-01 (#8006 )


azurerm_lb_nat_pool - adding more specific validation for the Load Balancer ID

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

bug in API version 2020-05-01 (#8006 )


azurerm_lb_nat_rule - adding more specific validation for the Load Balancer ID

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

bug in API version 2020-05-01 (#8006 )


azurerm_lb_outbound_rule - adding more specific validation for the Load Balancer

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

workaround a bug in API version 2020-05-01 (#8006 )


azurerm_lb_probe - adding more specific validation for the Load Balancer ID field

(#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

in API version 2020-05-01 (#8006 )


azurerm_lb_rule - adding more specific validation for the Load Balancer ID field

(#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

API version 2020-05-01 (#8006 )


azurerm_storage_account - only sending allow_blob_public_access and

min_tls_version in Azure Public since these are currently not supported in other

regions (#8148 )

2.23.0 (August 13, 2020)


FEATURES:

New Resource: azurerm_integration_service_environment (#7763 )


New Resource: azurerm_redis_linked_server (#8026 )
New Resource: azurerm_synapse_firewall_rule (#7904 )

IMPROVEMENTS:

dependencies: updating containerservice to 2020-04-01 (#7894 )


dependencies: updating mysql to 2020-01-01 (#8062 )
dependencies: updating postgresql to 2020-01-01 (#8045 )
Data Source: azurerm_app_service now exports source_control configuration
(#7945 )
Data Source: azurerm_function_app now exports source_control configuration
(#7945 )
Data Source: azurerm_function_app now exports site_config configuration
(#7945 )
azurerm_app_service now supports source_control configuration (#7945 )
azurerm_function_app now supports source_control configuration (#7945 )
azurerm_function_app now supports full ip_restriction configuration (#7945 )
azurerm_function_app now supports full scm_ip_restriction configuration

(#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

network_interface on failover (#5688 )


azurerm_storage_account - support static_website for BlockBlobStorage account

type (#7890 )
azurerm_storage_account - filter allow_blob_public_access and min_tls_version

from Azure US Government (#8092 )

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

an API issue (#8041 )


azurerm_iothub - the endpoint and route lists can now be cleared by setting them
to [] (#8028 )
azurerm_linux_virtual_machine - handling machines which are already

stopped/deallocated (#8000 )
azurerm_mariadb_virtual_network_rule will now work across subscriptions

(#8100 )
azurerm_monitor_metric_alert_resource - continue using

SingleResourceMultiMetricCriteria for existing alerts (#7995 )


azurerm_mysql_server - prevent a non empty plan when 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

stopped/deallocated [#8000 ]'


azurerm_data_factory_dataset_delimited_text - fix issue with property
azure_blob_storage_account (#7953 )

2.22.0 (August 07, 2020)


DEPENDENCIES:

updating github.com/Azure/azure-sdk-for-go to v44.2.0 (#7933 )

IMPROVEMENTS:

azurerm_cosmosdb_account - support DisableRateLimitingResponses with the


capabilities property (#8016 )
azurerm_storage_account - support for the min_tls_version property (#7879 )
azurerm_storage_account_sas - support for the signed_version attribute property

(#8020 )
azurerm_servicebus_queue - support for the enable_batched_operations , status ,
forward_to , and forward_dead_lettered_messages_to (#7990 )

BUG FIXES:

Data Source: azurerm_key_vault_certificate - fixing a crash when using acmebot


certificates (#8029 )
azurerm_iothub_shared_access_policy - prevent primary_connection_string &
secondary_connection_string from regenerating during every apply (#8017 )

2.21.0 (July 31, 2020)


DEPENDENCIES:

updating search to 2020-03-13 (#7867 )


updating go-azure-helpers to v0.11.2 (#7911 )

FEATURES:

New Data Source: azurerm_data_share_dataset_data_lake_gen1 (#7840 )


New Resource: azurerm_dedicated_hardware_security_module (#7727 )

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

is now sent as empty to allow for Azure's default to take effect(#7838 )


azurerm_search_service - support for the public_network_access_enabled property

(#7867 )
azurerm_servicebus_subscription - support for the status property (#7852 )

BUG FIXES:

azurerm_automation_runbook - allow publish_content_link resource to not be set

(#7824 )
azurerm_api_management_named_value - the value has been marked as sensitive to

hide secret values (#7819 )


azurerm_cognitive_account - allow qname_runtime_endpoint to not be set

(#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

readonly in the API (#7871 )


azurerm_kubernetes_cluster - updates will no longer fail when using managed

Microsoft Entra integration (#7874 )

2.20.0 (July 23, 2020)


UPGRADE NOTES

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

azurerm_storage_account - will now default allow_blob_public_access to false to

align with the portal and be secure by default (#7784 )

DEPENDENCIES:

updating github.com/Azure/azure-sdk-for-go to v44.1.0 (#7774 )


updating cosmos to 2020-04-01 (#7597 )

FEATURES:

New Data Source: azurerm_synapse_workspace (#7517 )


New Resource: azurerm_data_share_dataset_data_lake_gen1 - add
dataset_data_lake_gen1 suppport for azurerm_data_share (#7511 )
New Resource: azurerm_frontdoor_custom_https_configuration - move the front
door custom_https_configuration to its own resource to allow for parallel
creation/update of custom https certificates. (#7498 )
New Resource: azurerm_kusto_cluster_customer_managed_key (#7520 )
New Resource: azurerm_synapse_workspace (#7517 )

IMPROVEMENTS:

azurerm_cosmos_db_account - add support for the enable_free_tier property


(#7814 )

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

as service no longer accepts it as an input since Apr 25, 2019 (#7597 )


azurerm_monitor_autoscale_setting - fix crash in notification (#7835 )
azurerm_storage_account - will now default allow_blob_public_access to false to

align with the portal and be secure by default (#7784 )

2.19.0 (July 16, 2020)


UPGRADE NOTES:

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

azurerm_hdinsight_storm_cluster resources are deprecated and will be removed in

the next major version of the Azure Provider. (#7706 )


provider: no longer auto register the Microsoft.StorageCache RP (#7768 )

FEATURES:

New Data source: azurerm_route_filter (#6341 )


New Resource: azurerm_route_filter (#6341 )

IMPROVEMENTS:

dependencies: updating to v44.0.0 of github.com/Azure/azure-sdk-for-go


(#7616 )
dependencies: updating the machinelearning API to version 2020-04-01 (#7703 )
Data Source: azurerm_storage_account - exposing allow_blob_public_access
(#7739 )
Data Source: azurerm_dns_zone - now provides feedback if a resource_group_name
is needed to resolve ambiguous zone (#7680 )
azurerm_automation_schedule - Updated validation for timezone strings (#7754 )
azurerm_express_route_circuit_peering - support for the route_filter_id

property (#6341 )
azurerm_kubernetes_cluster - no longer sending the kubernetes_dashboard addon

in Azure China since this is not supported in this region (#7714 )


azurerm_local_network_gateway - address_space order can now be changed

(#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

name has not completed its delete operation (#7179 )


azurerm_storage_share - share creation will retry if a share of the same name has

not completed its previous delete operation (#7179 )


azurerm_virtual_network_gateway_connection - support for the

traffic_selector_policy block (#6586 )


azurerm_orchestrated_virtual_machine_scale_set - support for the

proximity_placement_group_id property (#7510 )

BUG FIXES:

provider: deprecating metadata_url to metadata_host since this is a hostname


(#7740 )
azurerm_*_virtual_machine - allow_extensions_operations can now be updated

(#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

Workspace has been fully deleted (#7635 )


azurerm_mysql_server - ssl_minimal_tls_version_enforced now correctly set in

updates (#7307 )
azurerm_notification_hub - validating that the ID is in the correct format when

importing the resource (#7690 )


azurerm_redis_cache - fixing a bug when provisioning with authentication disabled

(#7734 )
azurerm_virtual_hub - the field address_prefix is now ForceNew to match the

behaviour of the Azure API (#7713 )


azurerm_virtual_hub_connection - using the delete timeout if specified (#7731 )

2.18.0 (July 10, 2020)


FEATURES:

metadata_url can be set at the provider level to use an environment provided by a

specific url (#7664 )


New Data Source: azurerm_key_vault_certificate_issuer (#7074 )
New Data Source: azurerm_web_application_firewall_policy (#7469 )
New Resource: azurerm_automation_connection (#6847 )
New Resource: azurerm_automation_connection_certificate (#6847 )
New Resource: azurerm_automation_connection_classic_certificate (#6847 )
New Resource: azurerm_automation_connection_service_pricipal (#6847 )
New Resource: azurerm_app_service_slot_virtual_network_swift_connection
(#5916 )
New Resource: azurerm_data_factory_dataset_azure_blob (#6366 )
New Resource: azurerm_data_factory_dataset_cosmosdb_sqlapi (#6366 )
New Resource: azurerm_data_factory_dataset_delimited_text (#6366 )
New Resource: azurerm_data_factory_dataset_http (#6366 )
New Resource: azurerm_data_factory_dataset_json (#6366 )
New Resource: azurerm_data_factory_linked_service_azure_blob_storage
(#6366 )
New Resource: azurerm_data_factory_linked_service_azure_file_storage
(#6366 )
New Resource: azurerm_data_factory_linked_service_azure_file_storage
(#6366 )
New Resource: azurerm_data_factory_linked_service_cosmosdb (#6366 )
New Resource: azurerm_data_factory_linked_service_sftp (#6366 )
New Resource: azurerm_data_factory_linked_service_sftp (#6366 )
New Resource: azurerm_key_vault_certificate_issuer (#7074 )
New Resource: azurerm_kusto_attached_database_configuration (#7377 )
New Resource: azurerm_kusto_database_principal_assignment (#7484 )
New Resource: azurerm_mysql_active_directory_administrator (#7621 )

IMPROVEMENTS:

dependencies: updating github.com/tombuildsstuff/giovanni to v0.11.0


(#7608 )
dependencies: updating network to 2020-05-01 (#7585 )
Data Source: azurerm_eventhub_namespace - exposing the dedicated_cluster_id
field (#7548 )
azurerm_cosmosdb_account - support for the ignore_missing_vnet_service_endpoint

property (#7348 )
azurerm_application_gateway - support for the firewall_policy_id attribute within

the http_listener block (#7580 )


azurerm_eventhub_namespace - support for configuring the dedicated_cluster_id

field (#7548 )
azurerm_eventhub_namespace - support for setting partition_count to 1024 when

using a Dedicated Cluster (#7548 )


azurerm_eventhub_namespace - support for setting retention_count to 90 when

using a Dedicated Cluster (#7548 )


azurerm_hdinsight_hadoop_cluster - now supports Azure Monitor (#7045 )
azurerm_hdinsight_hbase_cluster - now supports external metastores (#6969 )
azurerm_hdinsight_hbase_cluster - now supports Azure Monitor (#7045 )
azurerm_hdinsight_interactive_query_cluster - now supports external metastores

(#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

for the HS (HyperScale) family (#7559 )


azurerm_web_application_firewall_policy - allow setting version to 0.1 (for

when type is set to Microsoft_BotManagerRuleSet ) (#7579 )


azurerm_web_application_firewall_policy - support the transforms property in

the custom_rules.match_conditions block (#7545 )


azurerm_web_application_firewall_policy - support the request_body_check ,

file_upload_limit_in_mb , and max_request_body_size_in_kb properties in the


policy_settings block (#7363 )

BUG FIXES:
azurerm_api_management_api_operation_policy - correctly parse XLM (#7345 )
azurerm_application_insights_api_key - now correctly checks if the resource exists

upon creation (#7650 )


azurerm_api_management_identity_provider_aad - fix perpetual diff on the

client_secret property (#7529 )


azurerm_eventhub_namespace_authorization_rule - correctly update old resource

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

storage account was deleted (#7378 )

2.17.0 (July 03, 2020)


UPGRADE NOTES:

azurerm_hdinsight_hadoop_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_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

change in the Azure API (#7111 )


azurerm_hdinsight_kafka_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_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:

New Resource: azurerm_kusto_cluster_principal_assignment (#7533 )

IMPROVEMENTS:

dependencies: updating to v43.2.0 of github.com/Azure/azure-sdk-for-go


(#7546 )
Data Source: azurerm_eventhub_namespace - exposing the zone_redundant property
(#7534 )
Data Source: azurerm_postgresql_server - exposing sku_name (#7523 )
azurerm_app_service_environment - the property user_whitelisted_ip_ranges has

been deprecated and renamed to allowed_user_ip_cidrs to clarify the function


and expected format (#7499 )
azurerm_eventhub_namespace - support for the zone_redundant property (#7534 )
azurerm_key_vault_certificate - exposing the certificate_attribute block

(#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

specialized property (#7277 )


azurerm_spring_cloud_service - support for sku_name (#7531 )
azurerm_spring_cloud_service - support for the trace block (#7531 )

BUG FIXES:

azurerm_api_management_named_value - polling until the property is fully created

(#7547 )
azurerm_api_management_property - polling until the property is fully created

(#7547 )
azurerm_linux_virtual_machine_scale_set - using the provider feature

roll_instances_when_required when upgrade_mode is set to Manual (#7513 )


azurerm_marketplace_agreement - fix issue around import (#7515 )
azurerm_windows_virtual_machine_scale_set - using the provider feature

roll_instances_when_required when upgrade_mode is set to Manual (#7513 )


2.16.0 (June 25, 2020)
DEPENDENCIES:

updating github.com/Azure/go-autorest/azure/cli to v0.3.1 (#7433 )

FEATURES:

New Resource: azurerm_postgresql_active_directory_administrator (#7411 )

IMPROVEMENTS:

authentication: Azure CLI - support for access tokens in custom directories


(#7433 )
azurerm_api_management_api - support for the subscription_required property

(#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

replicated after creating (#7473 )


azurerm_monitor_activity_log_alert - support for the fields

recommendation_category , recommendation_impact and recommendation_type in the


criteria block (#7458 )
azurerm_mssql_database - support up to 5 for the min_capacity property

(#7457 )
azurerm_mssql_database - support GP_S_Gen5 SKUs up to GP_S_Gen5_40 (#7453 )

BUG FIXES:

azurerm_api_management_api - allowing dots as a prefix of the name field (#7478 )


azurerm_function_app - state fixes for app_settings (#7440 )
azurerm_hdinsight_hadoop_cluster - fixes for node and instance count validation

(#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

the resource (#7456 )


azurerm_network_interface_security_group_association - is now considered delete

whtn the network interfact is notfound (#7459 )


azurerm_role_definition - terraform import now sets scope to prevent a force

recreate (#7424 )
azurerm_storage_account_network_rules - corretly clear ip_rules ,

virtual_network_subnet_ids when set to [] (#7385 )

2.15.0 (June 19, 2020)


UPGRADE NOTES:

azurerm_orchestrated_virtual_machine_scale_set - the single_placement_group

property is now required to be false by the service team in the 2019-12-01


compute API (#7188 )

DEPENDENCIES

updating to v43.1.0 of github.com/Azure/azure-sdk-for-go (#7188 )


upgrading kusto to 2019-12-01 (#7101 )
upgrading kusto to 2020-02-15 (#6838 )

FEATURES

New Data Source: azurerm_data_share_dataset_blob_storage (#7107 )


New Resource: azurerm_data_factory_integration_runtime_self_hosted (#6535 )
New Resource: azurerm_data_share_dataset_blob_storage (#7107 )
New Resource: azurerm_eventhub_cluster (#7306 )
New Resource: azurerm_maintenance_assignment_dedicated_host (#6713 )
New Resource: azurerm_maintenance_assignment_virtual_machine (#6713 )

IMPROVEMENTS:

Data Source: azurerm_management_group - support lookup via display_name


(#6845 )
azurerm_api_management - support for the developer_portal_url property

(#7263 )
azurerm_app_service - support for scm_ip_restriction (#6955 )
azurerm_app_service_certificate - support for the

hosting_environment_profile_id propety (#7087 )


azurerm_app_service_environment - support for the user_whitelisted_ip_ranges

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:

azurerm_api_management_api - correctly wait for future on create/update (#7273 )


azurerm_bot_connection - adding a runtime check for the available service

providers in the Azure Region being used (#7279 )


azurerm_healthcare_service - the access_policy_object_ids property is now

optional (#7296 )
azurerm_hdinsight_cluster - deprecating the min_instance_count property

(#7272 )
azurerm_network_watcher_flow_log - propertly disable the flowlog on destroy

(#7154 )

2.14.0 (June 11, 2020)


UPGRADE NOTES:

azurerm_kubernetes_cluster - the Azure Policy add-on now only supports v2 (as

per the Azure API) (#7233 )


DEPENDENCIES:

containerservice - updating to 2020-03-01 (#7233 )


policy - updating to 2019-09-01 (#7211 )

FEATURES:

New Data Source: azurerm_blueprint_definition (#6930 )


New Data Source: azurerm_blueprint_published_version (#6930 )
New Data Source: azurerm_key_vault_certificate (#7285 )
New Data Source: azurerm_kubernetes_cluster_node_pool (#7233 )
New Resource: azurerm_blueprint_assignment (#6930 )
New Resource: azurerm_data_factory_linked_service_key_vault (#6971 )
New Resource: azurerm_iot_time_series_insights_access_policy (#7202 )
New Resource: azurerm_iot_time_series_insights_reference_data_set (#7112 )
New Resource: azurerm_app_service_hybrid_connection (#7224 )

ENHANCEMENTS:

Data Source: azurerm_kubernetes_cluster - exposing the version of the Azure


Policy add-on (#7233 )
Data Source: azurerm_kubernetes_cluster - exposing the orchestrator_version
being used for each Node Pool (#7233 )
Data Source: azurerm_kubernetes_cluster - exposing the disk_encryption_set_id
field (#7233 )
azurerm_api_management_api - ensuring wsdl_selector is populated when
content_format is wsdl (#7076 )
azurerm_cosmosdb_account modifying geo_location no longer triggers a recreation

of the resource (#7217 )


azurerm_eventgrid_event_subscription - support for azure_function_endpoint

(#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

webhook_endpoint block (#7207 )


azurerm_kubernetes_cluster - support for configuring/updating the version of

Kubernetes used in the Default Node Pool (#7233 )


azurerm_kubernetes_cluster - support for Microsoft Entra ID (Managed)

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

and idle_timeout_in_minutes within the load_balancer_profile block (#7233 )


azurerm_kubernetes_cluster - support for the Uptime SLA / Paid SKU (#7233 )
azurerm_kubernetes_cluster - exposing the private_fqdn of the cluster (#7233 )
azurerm_kubernetes_cluster_node_pool - support for configuring/updating the

version of Kubernetes (#7233 )


azurerm_kubernetes_cluster_node_pool - support for Spot Node Pools (#7233 )
azurerm_kubernetes_cluster_node_pool - support for System & User Node Pools

(#7233 )
azurerm_web_application_firewall_policy - Add support for GeoMatch operator in

request filter (#7181 )

BUG FIXES:

Data Source: azurerm_kubernetes_cluster - fixing an issue where some read-only


fields were unintentionally marked as user-configurable (#7233 )
azurerm_application_gateway - support for specifying the ID of a Key Vault Secret

without a version (#7095 )


azurerm_bot_channel_ms_teams - only sending calling_web_hook when it's got a

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

China and no longer sent (#7233 )


azurerm_kubernetes_cluster - the Azure Policy add-on is not supported in Azure

US Government and no longer sent (#7233 )


azurerm_kubernetes_cluster - the Kubernetes Dashboard add-on is not supported

in Azure US Government and no longer sent (#7233 )


azurerm_kubernetes_cluster - searching for a system node pool when importing

the default_node_pool (#7233 )


azurerm_kubernetes_cluster_node_pool - changes to the node_taints field now

force a new resource, matching the updated API behaviour (#7233 )


azurerm_management_group - using the Subscription ID rather than Subscription

Resource ID when detaching Subscriptions from Management Groups during


deletion (#7216 )
azurerm_windows_virtual_machine_scale_set - adding validation for the
max_bid_price field (#7233 )

2.13.0 (June 04, 2020)


FEATURES:

New Data Source: azurerm_logic_app_integration_account (#7099 )


New Data Source: azurerm_virtual_machine_scale_set (#7141 )
New Resource: azurerm_logic_app_integration_account (#7099 )
New Resource: azurerm_monitor_action_rule_action_group (#6563 )
New Resource: azurerm_monitor_action_rule_suppression (#6563 )

IMPROVEMENTS:

azurerm_data_factory_pipeline - Support for activities (#6224 )


azurerm_eventgrid_event_subscription - support for advanced filtering (#6861 )
azurerm_signalr_service - support for EnableMessagingLogs feature (#7094 )

BUG FIXES:

azurerm_app_service - default priority now set on ip restricitons when not explicitly

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

hybrid_connection_endpoint block (#7203 )


azurerm_function_app - correctly set Kind when os_type is linux (#7140 )
azurerm_key_vault_certificate - always setting the certificate_data and
thumbprint fields (#7204 )
azurerm_role_assignment - support for Preview role assignments (#7205 )
azurerm_virtual_network_gateway - vpn_client_protocols is now also computed to

prevent permanent diffs (#7168 )

2.12.0 (May 28, 2020)


FEATURES:

New Data Source: azurerm_advisor_recommendations (#6867 )


New Resource: azurerm_dev_test_global_shutdown_schedule (#5536 )
New Resource: azurerm_nat_gateway_public_ip_association (#6450 )

IMPROVEMENTS:

Data Source: azurerm_kubernetes_cluster - exposing the oms_agent_identity


block within the addon_profile block (#7056 )
Data Source: azurerm_kubernetes_cluster - exposing the identity and
kubelet_identity properties (#6527 )
azurerm_batch_pool - support the container_image_names property (#6689 )
azurerm_eventgrid_event_subscription - support for the expiration_time_utc ,
service_bus_topic_endpoint , and service_bus_queue_endpoint , property (#6860 )
azurerm_eventgrid_event_subscription - the eventhub_endpoint was deprecated in

favour of the eventhub_endpoint_id property (#6860 )


azurerm_eventgrid_event_subscription - the hybrid_connection_endpoint was

deprecated in favour of the hybrid_connection_endpoint_id property (#6860 )


azurerm_eventgrid_topic - support for input_schema , input_mapping_fields , and

input_mapping_default_values (#6858 )
azurerm_kubernetes_cluster - exposing the oms_agent_identity block within the

addon_profile block (#7056 )


azurerm_logic_app_action_http - support for the run_after property (#7079 )
azurerm_storage_account - support RAGZRS and GZRS for the

account_replication_type property (#7080 )

BUG FIXES:

azurerm_api_management_api_version_set - handling changes to the Azure

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

properties length (#7061 )


azurerm_linux_virtual_machine - allow setting virtual_machine_scale_set_id in

non-zonal deployment (#7057 )


azurerm_servicebus_topic - support for numbers in the name field (#7027 )
azurerm_shared_image_version - target_region.x.storage_account_type is now

defaulted and multiple target_region s can be added/removed (#6940 )


azurerm_sql_virtual_network_rule - updating the validation for the name field

(#6968 )
azurerm_windows_virtual_machine - allow setting virtual_machine_scale_set_id in

non-zonal deployment (#7057 )


azurerm_windows_virtual_machine - correctly validating the rsa ssh public_key

properties length (#7061 )

2.11.0 (May 21, 2020)


DEPENDENCIES:

updating github.com/Azure/azure-sdk-for-go to v42.1.0 (#6725 )


updating network to 2020-03-01 (#6727 )

FEATURES:

Opt-In/Experimental Enhanced Validation for Locations: This allows validating


that the location field being specified is a valid Azure Region within the Azure
Environment being used - which can be caught via terraform plan rather than
terraform apply . This can be enabled by setting the Environment Variable

ARM_PROVIDER_ENHANCED_VALIDATION to true and will be enabled by default in a

future release of the AzureRM Provider (#6927 )


Data Source: azurerm_data_share (#6789 )
New Resource: azurerm_data_share (#6789 )
New Resource: azurerm_iot_time_series_insights_standard_environment
(#7012 )
New Resource: azurerm_orchestrated_virtual_machine_scale_set (#6626 )

IMPROVEMENTS:

Data Source: azurerm_platform_image - support for version filter (#6948 )


azurerm_api_management_api_version_set - updating the validation for the name

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

the cors_rule block within the blob_properties block (#6964 )

BUG FIXES:

Data Source: azurerm_api_management_group - raising an error when the Group


cannot be found (#7024 )
Data Source: azurerm_image - raising an error when the Image cannot be found
(#7024 )
Data Source: azurerm_data_lake_store - raising an error when Data Lake Store
cannot be found (#7024 )
Data Source: azurerm_data_share_account - raising an error when Data Share
Account cannot be found (#7024 )
Data Source: azurerm_hdinsight_cluster - raising an error when the HDInsight
Cluster cannot be found (#7024 )
Data Source: azurerm_healthcare_service - raising an error when the HealthCare
Service cannot be found (#7024 )
Data Source: azurerm_healthcare_service - ensuring all blocks are set in the
response (#7024 )
Data Source: azurerm_firewall - raising an error when the Firewall cannot be
found (#7024 )
Data Source: azurerm_maintenance_configuration - raising an error when the
Maintenance Configuration cannot be found (#7024 )
Data Source: azurerm_private_endpoint_connection - raising an error when the
Private Endpoint Connection cannot be found (#7024 )
Data Source: azurerm_resources - does not return all matched resources
sometimes (#7036 )
Data Source: azurerm_shared_image_version - raising an error when the Image
Version cannot be found (#7024 )
Data Source: azurerm_shared_image_versions - raising an error when Image
Versions cannot be found (#7024 )
Data Source: azurerm_user_assigned_identity - raising an error when the User
Assigned Identity cannot be found (#7024 )
azurerm_api_management_subscription - fix the export of primary_key and
secondary_key (#6938 )
azurerm_eventgrid_event_subscription - correctly parsing the ID (#6958 )
azurerm_healthcare_service - ensuring all blocks are set in the response (#7024 )
azurerm_linux_virtual_machine - allowing name to end with a capital letter

(#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

sku is basic (#7015 )


azurerm_windows_virtual_machine - allowing name to end with a capital (#7023 )
azurerm_windows_virtual_machine_scale_set - allowing name to end with a capital

(#7023 )

2.10.0 (May 14, 2020)


DEPENDENCIES:

updating eventgrid to 2020-04-01-preview (#6837 )


updating iothub to 2019-03-22-preview (#6875 )

FEATURES:

New Data Source: azurerm_eventhub (#6841 )


New Resource: azurerm_eventgrid_domain_topic (#6859 )

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

changing the bandwidth reduction (#6601 )


azurerm_frontdoor - expose the header_frontdoor_id attribute (#6916 )
azurerm_log_analytics_workspace - add support for rentention_in_days for Free

Tier (#6844 )
azurerm_mariadb_server - support for the create_mode property allowing the

creation of replicas, point in time restores, and geo restors (#6865 )


azurerm_mariadb_server - support for the public_network_access_enabled property

(#6865 )
azurerm_mariadb_server - all properties in the storage_profile block have been

moved to the top level (#6865 )


azurerm_mariadb_server - the following properties were renamed and changed to

a boolean type: ssl_enforcement to ssl_enforcement_enabled ,


geo_redundant_backup to geo_redundant_backup_enabled , and auto_grow
azurerm_mysql_server - support for the create_mode property allowing the

creation of replicas, point in time restores, and geo restors (#6833 )


azurerm_mysql_server - support for the public_network_access_enabled property

(#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

boolean type: ssl_enforcement to ssl_enforcement_enabled , geo_redundant_backup


to geo_redundant_backup_enabled , and auto_grow to auto_grow_enabled (#6833 )
azurerm_mssql_server - add support for the azuread_administrator property

(#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:

Data Source: azurerm_automation_account - using the ID of the Automation


Account, rather than the ID of the Automation Account's Registration Info
(#6848 )
Data Source: azurerm_security_group - fixing crash where id is nil (#6910 )
Data Source: azurerm_mysql_server - remove administrator_login_password
property as it is not returned from the api (#6865 )
azurerm_api_management - fixing a crash when policy is nil (#6862 )
azurerm_api_management - only sending the hostname_configuration properties if

they are not empty (#6850 )


azurerm_api_management_diagnostic - can now be provision again by supporting

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

auto_grow is enabled (#6865 )


azurerm_mysql_server - the storage_mb property is now optional when auto_grow

is enabled (#6833 )
azurerm_role_assignment - added evential consistency check to assignment

creation (#6925 )
azurerm_windows_virtual_machine_scale_set - support for updating the

do_not_run_extensions_on_overprovisioned_machines property (#6917 )

2.9.0 (May 07, 2020)


FEATURES:

New Data Source: azurerm_data_share_account (#6575 )


New Resource: azurerm_data_share_account (#6575 )
New Resource: azurerm_function_app_slot (#6435 )
New Resource: azurerm_sentinel_alert_rule_scheduled (#6650 )

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

the features flag recover_soft_deleted_key_vaults is set to true (#6716 )


azurerm_key_vault_key - support for recovering a soft-deleted key if the features

flag recover_soft_deleted_key_vaults is set to true (#6716 )


azurerm_key_vault_secret - support for recovering a soft-deleted secret if the
features flag recover_soft_deleted_key_vaults is set to true (#6716 )
azurerm_linux_virtual_machine_scale_set - support for configuring create_mode

for data disks (#6744 )


azurerm_monitor_diagnostic_setting - log_analytics_destination_type supports

AzureDiagnostics (#6769 )
azurerm_windows_virtual_machine_scale_set - support for configuring create_mode

for data disks (#6744 )

BUG FIXES:

provider: raising an error when the environment is set to AZURESTACKCLOUD


(#6817 )
azurerm_analysis_services_server - ip restriction name field no longer case

sensitive (#6774 )
azurerm_automation_runbook - the publish_content_link property is now optional

(#6813 )
azurerm_eventhub_namespace_authorization_rule - lock to prevent multiple

resources won't clash (#6701 )


azurerm_network_interface - changes to dns servers no longer use incremental

update (#6624 )
azurerm_policy_assignment - allow polices with scopes without subscription/<id>

(built-in policies) (#6792 )


azurerm_policy_definition - changes to the dynamic fields ( createdBy , createdOn ,
updatedBy , updatedOn ) keys in the metadata field are excluded from diff's

(#6734 )
azurerm_redis_cache - ensure rdb_storage_connection_string is set when

rdb_backup_enabled is enabled (#6819 )


azurerm_site_recovery_network_mapping - handling an API Error when checking for
the presence of an existing Network Mapping (#6747 )

2.8.0 (April 30, 2020)


FEATURES:

New Data Source: azurerm_sentinel_alert_rule_ms_security_incident (#6606 )


New Data Source: azurerm_shared_image_versions (#6700 )
New Resource: azurerm_managed_application (#6386 )
New Resource: azurerm_mssql_server (#6677 )
New Resource: azurerm_sentinel_alert_rule_ms_security_incident (#6606 )

IMPROVEMENTS:

azurerm_api_management - sku_name supports the Consumption value for sku

(#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:

azurerm_key_vault - can now be created without subscription level permissions

(#6260 )
azurerm_linux_virtual_machine - fix validation for name to allow full length

resource names (#6639 )


azurerm_linux_virtual_machine_scale_set - fix validation for name to allow full

length resource names (#6639 )


azurerm_monitor_diagnostic_setting - make retention_policy and

retention_policy optional (#6603 )


azurerm_redis_cache - correctly build connection strings when SSL is disabled
(#6635 )
azurerm_sql_database - prevent extended auditing policy for secondary databases

(#6402 )
azurerm_web_application_firewall_policy - support for the managed_rules

property which is required by the new API version (#6126 )


azurerm_windows_virtual_machine - fix validation for name to allow full length

resource names (#6639 )


azurerm_windows_virtual_machine_scale_set - fix validation for name to allow full

length resource names (#6639 )


azurerm_virtual_network_gateway_connection - shared_key is now optional when

type is IPSec (#6565 )

2.7.0 (April 23, 2020)


FEATURES:

New Data Source: azurerm_private_dns_zone (#6512 )


New Resource: azurerm_maintenance_configuration (#6038 )
New Resource: azurerm_servicebus_namespace_network_rule_set (#6379 )
New Resource: azurerm_spring_cloud_app (#6384 )

DEPENDENCIES:

updating apimanagement to 2019-12-01 (#6479 )


updating the fork of github.com/Azure/go-autorest (#6509 )

IMPROVEMENTS:

Data Source: app_service_environment - export the location property (#6538 )


Data Source: azurerm_notification_hub_namespace - export tags (#6578 )
azurerm_api_management - support for virtual network integrations (#5769 )
azurerm_cosmosdb_mongo_collection - support for the index and system_index

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

moved to the top level (#6459 )


azurerm_postgres_server - the following properties were renamed and changed to

a boolean type: ssl_enforcement to ssl_enforcement_enabled ,


geo_redundant_backup to geo_redundant_backup_enabled , and auto_grow to
auto_grow_enabled (#6459 )
azurerm_private_endpoint - Add support for tags (#6574 )
azurerm_shared_image - support hyper_v_generation property (#6511 )
azurerm_linux_virtual_machine_scale_set - support for the

automatic_instance_repair property (#6346 )


azurerm_windows_virtual_machine_scale_set - support for the
automatic_instance_repair property (#6346 )

BUG FIXES:

Data Source: azurerm_private_link_service - fixing a crash when parsing the


response (#6504 )
azurerm_application_gateway - prevent panic by disallowing empty values for
backend_address_pool.#.fqdns (#6549 )
azurerm_application_gateway - block reordering without changes no longer causes

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

auto_grow is enabled (#6459 )


azurerm_public_ip_prefix - update prefix_length validation to accept all valid

IPv4 address ranges (#6589 )


azurerm_route - add validation to the name and route_table_name propeties
(#6055 )
azurerm_virtual_network_gateway - per api requirements, public_ip_address_id is

required (#6548 )

2.6.0 (April 16, 2020)


FEATURES:

New Data Source: azurerm_policy_set_definition (#6305 )

DEPENDENCIES:

updating github.com/Azure/azure-sdk-for-go to v41.2.0 (#6419 )

IMPROVEMENTS:

Data Source: azurerm_policy_definition - can now lookup with name (#6275 )


Data Source: azurerm_policy_definition - the field management_group_id has been
deprecated and renamed to management_group_name (#6275 )
azurerm_application_insights - support for the disable_ip_masking property

(#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

managed_outbound_ip_count , outbound_ip_prefix_ids and outbound_ip_address_ids

fields within the load_balancer_profile block (#5847 )


azurerm_network_interface - export the internal_domain_name_suffix property

(#6455 )
azurerm_policy_definition - the management_group_id has been deprecated and

renamed to management_group_name (#6275 )


azurerm_sql_server - support for the connection_policy property (#6438 )
azurerm_virtual_network - export the guid attribute (#6445 )

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

Security Restriction (#6442 )


azurerm_machine_learning_workspace - the Enterprise sku will now properly work

(#6397 )
azurerm_managed_disk - fixing a bug where the machine would be stopped

regardless of whether it was currently shut down or not (#4690 )

2.5.0 (April 09, 2020)


BREAKING CHANGES:

Azure Kubernetes Service


Due to a breaking change in the AKS API, the azurerm_kubernetes_cluster
resource features a significant behavioural change where creating Mixed-Mode
Authentication clusters (e.g. using a Service Principal with a Managed Identity) is
no longer supported.
The AKS Team have confirmed that existing clusters will be updated by the
Azure API to use only MSI when a change is made to the Cluster (but not the
Node Pool). Whilst Terraform could perform this automatically some
environments have restrictions on which tags can be added/removed - as such
this operation will need to be performed out-of-band. Instead, upon detecting a
Mixed-Mode Cluster which has not yet been updated - or upon detecting a
former Mixed-Mode Cluster where the Terraform Configuration still contains a
service_principal block - Terraform will output instructions on how to

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:

dependencies: updating to use version 2020-02-01 of the Containers API (#6095 )


New Resource: azurerm_private_dns_txt_record (#6309 )
azurerm_kubernetes_cluster - making the service_principal block optional - so

it's now possible to create MSI-only clusters (#6095 )


azurerm_kubernetes_cluster - making the windows_profile block computed as

Windows credentials are now generated by Azure if unspecified (#6095 )


azurerm_kubernetes_cluster - support for outbound_type within the
network_profile block (#6120 )
azurerm_linux_virtual_machine - OS disk encryption settings can no be updated

(#6230 )
azurerm_windows_virtual_machine - OS disk encryption settings can no be updated

(#6230 )

BUG FIXES:

azurerm_kubernetes_cluster - requiring that min_count and max_count within the

default_node_pool block are set to null rather than 0 when auto-scaling is

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

block for Azure China (#6370 )


azurerm_kubernetes_cluster - conditionally sending the http_application_routing

block for Azure China & Azure US Government (#6370 )


azurerm_kubernetes_cluster_node_pool - requiring that min_count and max_count

are set to null rather than 0 when auto-scaling is disabled (#6095 )


azurerm_linux_virtual_machine - if the priority property on read is empty

assume it to be Regular (#6301 )


azurerm_windows_virtual_machine - if the priority property on read is empty

assume it to be Regular (#6301 )

2.4.0 (April 02, 2020)


FEATURES:
New Data Source: azurerm_managed_application_definition (#6211 )
New Resource: azurerm_hpc_cache_nfs_target (#6191 )
New Resource: azurerm_log_analytics_datasource_windows_event (#6321 )
New Resource: azurerm_log_analytics_datasource_windows_performance_counter
(#6274 )
New Resource: azurerm_managed_application_definition (#6211 )
New Resource: azurerm_spring_cloud_service (#4928 )

IMPROVEMENTS:

azurerm_network_interface - always send enable_accelerated_networking to the

api (#6289 )
azurerm_management_group - deprecated and rename the group_id property to
name to better match what it represents (#6276 )

BUGS:

azurerm_application_gateway - can now set include_path with target_url

(#6175 )
azurerm_policy_set_definition - mark metadata as computed (#6266 )

2.3.0 (March 27, 2020)


FEATURES:

New Data Source: azurerm_mssql_database (#6083 )


New Data source: azurerm_network_service_tags (#6229 )
New Resource: azurerm_custom_resource_provider (#6234 )
New Resource: azurerm_hpc_cache_blob_target (#6035 )
New Resource: azurerm_machine_learning_workspace (#5696 )
New Resource: azurerm_mssql_database (#6083 )
New Resource: azurerm_mssql_virtual_machine (#5263 )
New resource: azurerm_policy_remediation (#5746 )

IMPROVEMENTS:

dependencies: updating github.com/Azure/azure-sdk-for-go to v40.3.0 (#6134 )


dependencies: updating github.com/terraform-providers/terraform-provider-
azuread to v0.8.0 (#6134 )
dependencies: updating github.com/tombuildsstuff/giovanni to v0.10.0
(#6169 )
all resources using the location field - adding validation to ensure this is not an
empty string where this field is Required (#6242 )
Data Source azurerm_storage_container - exposing the resource_manager_id field
(#6170 )
azurerm_automation_schedule - adding validation for the timezone field (#5759 )
azurerm_cognitive_account - support for the qna_runtime_endpoint property

(#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:

azurerm_analysis_server - switching the ipv4_firewall_rule block to a Set rather

than a List to handle this being unordered (#6179 )


azurerm_linux_virtual_machine - making the custom_data field sensitive (#6225 )
azurerm_linux_virtual_machine_scale_set - making the custom_data field sensitive

(#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

base_blob block (#6250 )


azurerm_virtual_machine_data_disk_attachment - detecting the disk attachment as

gone when the VM is no longer available (#6237 )


azurerm_windows_virtual_machine - making the custom_data field sensitive

(#6225 )
azurerm_windows_virtual_machine_scale_set - making the custom_data field

sensitive (#6225 )

2.2.0 (March 18, 2020)


FEATURES:

New Data Source: azurerm_app_configuration (#6133 )


New Data Source: azurerm_powerbi_embedded (#5152 )
New Resource: azurerm_cost_management_export_resource_group (#6131 )
New Resource: azurerm_powerbi_embedded (#5152 )
New Resource: azurerm_virtual_hub_connection (#5951 )

IMPROVEMENTS:

Data Source: * azurerm_logic_app_workflow - expose computed field:


endpoint_configuration (#5862 )
azurerm_application_gateway - support for key vault SSL certificate via the

key_value_secret_id property (#4366 )


azurerm_function_app - support for configuring daily_memory_time_quota

(#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:

Data Source: azurerm_iothub_dps_shared_access_policy - building the


primary_connection_string and secondary_connection_string from the Service

endpoint rather than the Devices endpoint (#6108 )


azurerm_function_app - Add WEBSITE_CONTENT &
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING for premium plans (#5761 )
azurerm_iothub_dps_shared_access_policy - building the
primary_connection_string and secondary_connection_string from the Service

endpoint rather than the Devices endpoint (#6108 )


azurerm_linux_virtual_machine - updating the validation for name to allow periods

(#5966 )
azurerm_linux_virtual_machine_scale_set - updating the validation for name to

allow periods (#5966 )


azurerm_storage_management_policy - Fixed the use of single blob rule actions

(#5803 )

2.1.0 (March 11, 2020)


NOTES:

The azurerm_frontdoor resource has introduced a breaking change due to the


underlying service API which enforces location attributes must be set to 'Global' on all
newly deployed Front Door services.

FEATURES:

New Data Source: azurerm_database_migration_project (#5993 )


New Data Source: azurerm_database_migration_service (#5258 )
New Data Source: azurerm_kusto_cluster (#5942 )
New Data Source: azurerm_servicebus_topic_authorization_rule (#6017 )
New Resource: azurerm_bot_channel_directline (#5445 )
New Resource: azurerm_database_migration_project (#5993 )
New Resource: azurerm_database_migration_service (#5258 )
New Resource: azurerm_hpc_cache (#5528 )
New Resource: azurerm_iotcentral_application (#5446 )
New Resource: azurerm_monitor_scheduled_query_rules_alert (#5053 )
New Resource: azurerm_monitor_scheduled_query_rules_log (#5053 )
New Resource: azurerm_spatial_anchors_account (#6011 )

IMPROVEMENTS:

batch: upgrading to API version 2019-08-01 (#5967 )


containerservice: upgrading to API version 2019-11-01 (#5531 )
netapp: upgrading to API version 2019-10-01 (#5531 )
dependencies: temporarily switching to using a fork of github.com/Azure/go-
autorest to workaround an issue in the storage authorizer (#6050 )
dependencies: updating github.com/tombuildsstuff/giovanni to v0.9.0 (#6050 )
azurerm_application_gateway - support up to 125 for the capacity property with

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

enable_streaming_ingest properties (#5855 )


azurerm_lb - support for the private_ip_address_version property (#5590 )
azurerm_mariadb_server - changing the geo_redundant_backup property now forces

a new resource (#5961 )


azurerm_netapp_account - support for the tags property (#5995 )
azurerm_netapp_pool - support for the tags property (#5995 )
azurerm_netapp_snapshot - support for the tags property (#5995 )
azurerm_netapp_volume - support for the tags property (#5995 )
azurerm_netapp_volume - support for the protocol_types property (#5485 )
azurerm_netapp_volume - deprecated the cifs_enabled , nfsv3_enabled , and
nfsv4_enabled properties in favour of protocols_enabled (#5485 )
azurerm_network_watcher_flow_log - support for the traffic analysis

interval_in_minutes property (#5851 )


azurerm_private_dns_a_record - export the fqdn property (#5949 )
azurerm_private_dns_aaaa_record - export the fqdn property (#5949 )
azurerm_private_dns_cname_record - export the fqdn property (#5949 )
azurerm_private_dns_mx_record - export the fqdn property (#5949 )
azurerm_private_dns_ptr_record - export the fqdn property (#5949 )
azurerm_private_dns_srv_record - export the fqdn property (#5949 )
azurerm_private_endpoint - exposed private_ip_address as a computed attribute

(#5838 )
azurerm_redis_cache - support for the primary_connection_string and

secondary_connection_string properties (#5958 )


azurerm_sql_server - support for the extended_auditing_policy property

(#5036 )
azurerm_storage_account - support up to 50 tags (#5934 )
azurerm_virtual_wan - support for the type property (#5877 )

BUG FIXES:

azurerm_app_service_plan - no longer sends an empty


app_service_environment_id property on update (#5915 )
azurerm_automation_schedule - fix time validation (#5876 )
azurerm_batch_pool - frontend_port_range is now set correctly. (#5941 )
azurerm_dns_txt_record - support records up to 1024 characters in length

(#5837 )
azurerm_frontdoor - fix the way

backend_pool_load_balancing / backend_pool_health_probe (#5924 )


azurerm_frontdoor - all new front door resources to be created in the Global

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

the Static Website when not using AzureAD authentication (#6050 )

2.0.0 (February 24, 2020)


NOTES:

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:

The Environment Variable DISABLE_CORRELATION_REQUEST_ID has been renamed to


ARM_DISABLE_CORRELATION_REQUEST_ID to match the other Environment Variables

The field tags is no longer computed


Data Source: azurerm_api_management - removing the deprecated sku block
(#5725 )
Data Source: azurerm_app_service - removing the deprecated field subnet_mask
from the site_config block (#5823 )
Data Source: azurerm_app_service_plan - the deprecated properties block has
been removed since these properties have been moved to the top level (#5717 )
Data Source: azurerm_azuread_application - This data source has been removed
since it was deprecated (#5748 )
Data Source: azurerm_azuread_service_principal - This data source has been
removed since it was deprecated (#5748 )
Data Source: azurerm_builtin_role_definition - the deprecated data source has
been removed (#5844 )
Data Source: azurerm_dns_zone - removing the deprecated zone_type field
(#5794 )
Data Source: azurerm_dns_zone - removing the deprecated
registration_virtual_network_ids field (#5794 )
Data Source: azurerm_dns_zone - removing the deprecated
resolution_virtual_network_ids field (#5794 )
Data Source: azurerm_key_vault - removing the sku block since this has been
deprecated in favour of the sku_name field (#5774 )
Data Source: azurerm_key_vault_key - removing the deprecated vault_uri field
(#5774 )
Data Source: azurerm_key_vault_secret - removing the deprecated vault_uri field
(#5774 )
Data Source: azurerm_kubernetes_cluster - removing the field dns_prefix from
the agent_pool_profile block (#5823 )
Data Source: azurerm_network_interface - removing the deprecated field
internal_fqdn (#5823 )
Data Source: azurerm_private_link_service - removing the deprecated field
network_interface_ids (#5823 )
Data Source: azurerm_private_link_endpoint_connection - the deprecated data
source has been removed (#5844 )
Data Source: azurerm_recovery_services_protection_policy_vm has been renamed
to azurerm_backup_policy_vm (#5816 )
Data Source: azurerm_role_definition - removing the alias
VirtualMachineContributor which has been deprecated in favour of the full name

Virtual Machine Contributor (#5733 )


Data Source: azurerm_storage_account - removing the account_encryption_source
field since this is no longer configurable by Azure (#5668 )
Data Source: azurerm_storage_account - removing the enable_blob_encryption
field since this is no longer configurable by Azure (#5668 )
Data Source: azurerm_storage_account - removing the enable_file_encryption
field since this is no longer configurable by Azure (#5668 )
Data Source: azurerm_scheduler_job_collection - This data source has been
removed since it was deprecated (#5712 )
Data Source: azurerm_subnet - removing the deprecated ip_configuration field
(#5801 )
Data Source: azurerm_virtual_network - removing the deprecated address_spaces
field (#5823 )
azurerm_api_management - removing the deprecated sku block (#5725 )
azurerm_api_management - removing the deprecated fields in the security block

(#5725 )
azurerm_application_gateway - the field fqdns within the backend_address_pool

block is no longer computed (#5823 )


azurerm_application_gateway - the field ip_addresses within the
backend_address_pool block is no longer computed (#5823 )
azurerm_application_gateway - the deprecated field fqdn_list within the

backend_address_pool block has been removed (#5823 )


azurerm_application_gateway - the deprecated field ip_address_list within the

backend_address_pool block has been removed (#5823 )


azurerm_application_gateway - the deprecated field disabled_ssl_protocols has

been removed (#5823 )


azurerm_application_gateway - the field disabled_protocols within the ssl_policy

block is no longer computed (#5823 )


azurerm_app_service - removing the field subnet_mask from the site_config block

(#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

site_config block (#5823 )


azurerm_app_service_plan - the deprecated properties block has been removed

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

the match block from * to an empty string (#5752 )


azurerm_automation_account - removing the sku block which has been deprecated

in favour of the sku_name field (#5781 )


azurerm_automation_credential - removing the deprecated account_name field

(#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

since it was deprecated (#5748 )


azurerm_azuread_service_principal - This resource has been removed since it was

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

Computed and now defaults to TCP (#5823 )


azurerm_container_group - removing the deprecated field command (#5823 )
azurerm_container_registry - removing the deprecated storage_account block

(#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

this is now managed by Azure (#5793 )


azurerm_eventhub_namespace_authorization_rule - removing the deprecated

location field (#5793 )


azurerm_firewall - removing the deprecated field internal_public_ip_address_id

from the ip_configuration block (#5823 )


azurerm_firewall - the field public_ip_address_id within the ip_configuration

block is now required (#5823 )


azurerm_frontdoor - field cache_enabled within the forwarding_configuration
block now defaults to false rather than true (#5852 )
azurerm_frontdoor - the field cache_query_parameter_strip_directive within the
forwarding_configuration block now defaults to StripAll rather than StripNone .

(#5852 )
azurerm_frontdoor - the field forwarding_protocol within the

forwarding_configuration block now defaults to HttpsOnly rather than

MatchRequest (#5852 )
azurerm_function_app - removing the field virtual_network_name from the

site_config block (#5823 )


azurerm_function_app - updating the field ip_address within the ip_restriction

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

favour of the sku_name field (#5774 )


azurerm_key_vault_access_policy - removing the deprecated field vault_name

which has been superseded by the key_vault_id field (#5774 )


azurerm_key_vault_access_policy - removing the deprecated field

resource_group_name which has been superseded by the key_vault_id field

(#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

Standard from Basic (#5747 )


azurerm_kubernetes_cluster - the block default_node_pool is now required

(#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

removed since it was deprecated (#5754 )


azurerm_log_analytics_linked_service - The resource_id field has been moved

from the linked_service_properties block to the top-level and the deprecated


field linked_service_properties will be removed. This has been replaced by the
resource_id resource (#5775 )
azurerm_maps_account - the sku_name field is now case-sensitive (#5776 )
azurerm_mariadb_server - removing the sku block since it's been deprecated in

favour of the sku_name field (#5777 )


azurerm_metric_alertrule - the deprecated resource has been removed (#5844 )
azurerm_monitor_metric_alert - updating the default value for auto_mitigate from
false to true (#5773 )
azurerm_monitor_metric_alertrule - the deprecated resource has been removed

(#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

load_balancer_backend_address_pools_ids field from the ip_configurations block

(#5784 )
azurerm_network_interface - removing the deprecated

load_balancer_inbound_nat_rules_ids field from the ip_configurations block

(#5784 )
azurerm_network_interface - removing the deprecated internal_fqdn field

(#5784 )
azurerm_network_interface - removing the network_security_group_id field in

favour of a new split-out resource


azurerm_network_interface_security_group_association (#5784 )
azurerm_network_interface_application_security_group_association - removing

the ip_configuration_name field associations between Network Interfaces and


Application Security Groups now need to be made to all IP Configurations
(#5815 )
azurerm_network_interface - the virtual_machine_id field is now computed-only

since it's not setable (#5784 )


azurerm_notification_hub_namesapce - removing the sku block in favour of the

sku_name argument (#5722 )


azurerm_postgresql_server - removing the sku block which has been deprecated

in favour of the sku_name field (#5721 )


azurerm_private_link_endpoint - the deprecated resource has been removed

(#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

been removed (#5816 )


azurerm_recovery_services_protection_container_mapping - the deprecated

resource has been removed (#5816 )


azurerm_recovery_services_protection_policy_vm - the deprecated resource has

been removed (#5816 )


azurerm_recovery_services_replication_policy - the deprecated resource has

been removed (#5816 )


azurerm_relay_namespace - removing the sku block in favour of the sku_name field

(#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

Storage to StorageV2 (#5850 )


azurerm_storage_account - removing the deprecated account_type field (#5710 )
azurerm_storage_account - removing the deprecated

enable_advanced_threat_protection field (#5710 )


azurerm_storage_account - updating the default value for

enable_https_traffic_only from false to true (#5808 )


azurerm_storage_account - removing the account_encryption_source field since

this is no longer configurable by Azure (#5668 )


azurerm_storage_account - removing the enable_blob_encryption field since this is

no longer configurable by Azure (#5668 )


azurerm_storage_account - removing the enable_file_encryption field since this is

no longer configurable by Azure (#5668 )


azurerm_storage_blob - making the type field case-sensitive (#5710 )
azurerm_storage_blob - removing the deprecated attempts field (#5710 )
azurerm_storage_blob - removing the deprecated resource_group_name field

(#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

within the service_endpoints block non-computed (#5801 )


azurerm_virtual_network_peering - allow_virtual_network_access now defaults to

true, matching the API and Portal behaviours. (#5832 )


azurerm_virtual_wan - removing the deprecated field security_provider_name

(#5823 )

IMPROVEMENTS:

web: updating to API version 2019-08-01 (#5823 )


Data Source: azurerm_kubernetes_service_version - support for filtering of preview
releases (#5662 )
azurerm_dedicated_host - support for setting sku_name to DSv3-Type2 and ESv3-
Type2 (#5768 )
azurerm_key_vault - support for configuring purge_protection_enabled (#5344 )
azurerm_key_vault - support for configuring soft_delete_enabled (#5344 )
azurerm_sql_database - support for configuring zone_redundant (#5772 )
azurerm_storage_account - support for configuring the static_website block

(#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

Gallery image (#5661 )

BUG FIXES:

azurerm_application_insights - the application_type field is now case sensitive as

documented (#5817 )
azurerm_api_management_api - allows blank path field (#5833 )
azurerm_eventhub_namespace - the field ip_rule within the network_rulesets block

now supports a maximum of 128 items (#5831 )


azurerm_eventhub_namespace - the field virtual_network_rule within the

network_rulesets block now supports a maximum of 128 items (#5831 )


azurerm_linux_virtual_machine - using the delete custom timeout during deletion

(#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

the Azure API (#5693 )


azurerm_recovery_services_vault - using the requested cloud rather than the

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

updating the storage account (#5668 )


azurerm_subnet - supporting updating of the

enforce_private_link_endpoint_network_policies field (#5801 )


azurerm_subnet - supporting updating of the
enforce_private_link_service_network_policies field (#5801 )
azurerm_windows_virtual_machine - using the delete custom timeout during

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

1.44.0 (February 12, 2020)


NOTES

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:

New Data Source: azurerm_eventhub_consumer_group (#5518 )


New Data Source: azurerm_function_app (#5642 )
New Data Source: azurerm_iothub_dps_shared_access_policy (#5516 )

CHANGES TO BETA RESOURCES:

azurerm_linux_virtual_machine - added validation for the SSH Key type (#5610 )


azurerm_linux_virtual_machine_scale_set - support for updating VMSS's with a

Automatic & Rolling Upgrade Policy (sending health_probe_id during an update)


(#5430 )
azurerm_windows_virtual_machine - added validation for the SSH Key type

(#5610 )
azurerm_windows_virtual_machine_scale_set - support for updating VMSS's with a

Automatic & Rolling Upgrade Policy (sending health_probe_id during an update)


(#5430 )

IMPROVEMENTS:

azurerm_api_management - support for configuring the HTTP2 protocol (#5593 )


azurerm_cognitive_account - support for the kind FormRecognizer (#5679 )
azurerm_cognitive_account - support for the kind ImmersiveReader (#5604 )
azurerm_databricks_workspace - support for the Trial SKU (#5652 )
azurerm_function_app - support for configuring ip_restriction blocks (#5440 )
azurerm_function_app - support for configuring user assigned identities (#5676 )
azurerm_key_vault_key - support for not_before_date and expiration_date

(#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:

azurerm_storage_account - fix hanging destroy caused by multiple network rules

(#5565 )
azurerm_linux_virtual_machine - fix shared_image_id parsing (#5640 )

1.43.0 (February 04, 2020)


NOTES

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:

New Data Source: azurerm_eventhub_namespace_authorization_rule (#5489 )


New Data Source: azurerm_mariadb_server (#5506 )

IMPROVEMENTS:

azurerm_application_insights - support for the daily_data_cap_in_gb &

daily_data_cap_notifications_disabled properties (#5480 )


azurerm_private_endpoint - expose mapping between group_id and

subresource_names (#5571 )
azurerm_recovery_services_vault - support for the soft_delete_enabled property

(#5586 )

BUGS:

azurerm_databricks_workspace - allow underscores in name (#5548 )


azurerm_dns_aaaa_record - normalize IPv6 addresses (#5459 )
azurerm_frontdoor - including required minimum_tls_version to the
custom_https_configuration block (#5539 )
azurerm_managed_disk - correctly handles disk resizing when attached to a virtual

machine (#5579 )
azurerm_marketplace_agreement - recreate agreement if not accepted (#5582 )
azurerm_mysql_virtual_network_rule - allow subnet_id to be in a different

subscription then the database (#5568 )


azurerm_virtual_network_gateway_connection - increase routing_weight maximum

to 32000 (#5540 )

1.42.0 (January 27, 2020)


NOTES:

azurerm_cosmosdb_account - the capabilities is now force new as it cannot be

updated once set (#5453 )

FEATURES:

New Data Source: azurerm_dedicated_host (#5513 )


New Data Source: azurerm_api_management_api_version_set (#5470 )
New Resource: azurerm_dedicated_host (#5513 )

IMPROVEMENTS:

dependencies: upgrading to v38.1.0 of github.com/Azure/azure-sdk-for-go


(#5385 )
frontdoor: updating to use API version 2019-11-01 (#5385 )
azurerm_application_insights - add support for retention_in_days (#5457 )
azurerm_batch_pool - support for the network_configuration property (#5392 )
azurerm_cosmosdb_account - support for the EnableMongo capability (#5325 )
azurerm_cosmosdb_account - support for the Parse kind (#5453 )
azurerm_cosmosdb_sql_container - support for default_ttl property (#5492 )
azurerm_databricks_workspace - support for the custom_parameters property and
public_subnet_name , private_subnet_name , and virtual_network_id parameters

(#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

list and limit to 1 (#5471 )


azurerm_kubernetes_cluster - support updating AKS Microsoft Entra RBAC profile

without rebuilding cluster (#5410 )

BUG FIXES:

azurerm_app_service - fixing a crash when logs was nil (#5414 )


azurerm_container_group - fixing a crash when IPAddress.Ports was nil in the

response from the Azure API (#5415 )


azurerm_frontdoor - fixing issue where the forwarding_configuration cache could

not be disabled (#5358 )


azurerm_postgresql_server - correctly validate the name property (#5443 )
azurerm_postgresql_database - correctly validate the server_name property

(#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

visibility blocks aren't returned from the Azure API (#5428 )


azurerm_subnet - the delegations.#.actions property is now computed to

accommodate azure defaults (#5484 )


azurerm_virtual_machine - will no longer panic if network_interface_ids is missing

(#5413 )
1.41.0 (January 16, 2020)
NOTES:

azurerm_managed_disk - the Azure API now requires that the storage_account_id

field is specified during import, as such this field is now required during when
importing a VHD to a Managed Disk (#5250 )

FEATURES:

New Data Source: azurerm_dedicated_host_group (#5307 )


New Data Source: azurerm_disk_encryption_set (#5249 )
New Data Source: azurerm_eventgrid_topic (#5367 )
New Data Source: azurerm_iothub_dps (#5336 )
New Data Source: azurerm_iothub_shared_access_policy (#5368 )
New Data Source: azurerm_storage_container (#5374 )
New Resource: azurerm_api_management_identity_provider_facebook (#5346 )
New Resource: azurerm_api_management_identity_provider_twitter (#5306 )
New Resource: azurerm_api_management_identity_provider_microsoft (#5369 )
New Resource: azurerm_cosmosdb_gremlin_graph (#5301 )
New Resource: azurerm_dedicated_host_group (#5307 )
New Resource: azurerm_disk_encryption_set (#5249 )

IMPROVEMENTS:

dependencies: upgrading to v38.0.0 of github.com/Azure/azure-sdk-for-go


(#5335 )
backup: updating to use API version 2019-05-13 (#5335 )
Data Source: azurerm_managed_disk - exposing disk_encryption_set_id (#5250 )
Data Source: azurerm_managed_disk - exposing storage_account_id (#5250 )
azurerm_cognitive_account - the sku block has been deprecated in favour of the

sku_name property (#5380 )


azurerm_devspace_controller - the sku block has been deprecated in favour of the

sku_name property (#5379 )


azurerm_batch_pool - support for the metadata property (#5309 )
azurerm_function_app - convert connection_string s from a TypeList to a TypeSet

(#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

required by the Azure API during an import (#5250 )


azurerm_mariadb_server - the sku block has been deprecated in favour of the
sku_name property (#5378 )
azurerm_mysql_server - the sku block has been deprecated in favour of the
sku_name property (#5377 )
azurerm_postgresql_server - the sku block has been deprecated in favour of the

sku_name property (#5376 )

BUG FIXES:

azurerm_api_management_operation - will no longer panic on missing values in


request (#5318 )
azurerm_storage_account - fix performance issue for accounts that don't support

queues (#5316 )

1.40.0 (January 08, 2020)


FEATURES:

New Data Source: azurerm_netapp_volume (#4933 )


New Data Source: azurerm_netapp_snapshot (#5215 )
New Data Source: azurerm_signalr_service (#5276 )
New Resource: azurerm_advanced_threat_protection (#4848 )
New Resource: azurerm_api_management_diagnostic (#4836 )
New Resource: azurerm_api_management_identity_provider_aad (#5268 )
New Resource: azurerm_api_management_identity_provider_google (#5279 )
New Resource: azurerm_app_service_virtual_network_swift_connection (#5214 )
New Resource: azurerm_automation_certificate (#4785 )
New Resource: azurerm_backup_container_storage_account (#5213 )
New Resource: azurerm_backup_policy_file_share (#5213 )
New Resource: azurerm_backup_protected_file_share (#5213 )
New Resource: azurerm_cosmosdb_gremlin_database (#5248 )
New Resource: azurerm_iothub_dps_shared_access_policy (#5171 )
New Resource: azurerm_kusto_database_principal (#5242 )
New Resource: azurerm_network_watcher_flow_log (#5059 )
New Resource: azurerm_netapp_volume (#4933 )
New Resource: azurerm_netapp_snapshot (#5215 )
New Resource: azurerm_stream_analytics_reference_input_blob (#3633 )

IMPROVEMENTS:

Data Source: azurerm_private_link_service - exposing the enable_proxy_protocol


property (#5178 )
Data Source: azurerm_virtual_network_gateway - exposing the generation
property (#5198 )
azurerm_application_gateway - support for the trusted_root_certificate_names

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

primary_connection_string & secondary_connection_string properties (#5231 )


azurerm_key_vault - the network_acls property is now computed (#5207 )
azurerm_kubernetes_cluster - support for the identity property (#5168 )
azurerm_kubernetes_cluster - support for private link (#5161 )
azurerm_logic_app_trigger_recurrence - support for the start_time property

(#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

renamed to azurerm_site_recovery_protection_container (#5170 )


azurerm_recovery_services_protection_container_mapping - has been deprecated

and renamed to azurerm_site_recovery_protection_container_mapping (#5170 )


azurerm_recovery_services_replication_policy - has been deprecated and

renamed to azurerm_site_recovery_protection_policy (#5170 )


azurerm_recovery_replicated_vm - has been deprecated and renamed to
azurerm_site_recovery_replicated_vm (#5170 )
azurerm_recovery_services_protection_policy_vm - has been deprecated and

renamed to zurerm_backup_policy_vm (#5170 )


azurerm_recovery_services_protected_vm - has been deprecated and renamed to

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

connection_protocol property (#5145 )

BUG FIXES:

Data Source: azurerm_shared_image_version - change the storage_account_type


property from a set to a list (#5212 )
azurerm_api_management_api - working around a behavioural change in the API

detecting deleted resources (#5054 )


azurerm_api_management_api - correctly setting the soap API type when
soap_pass_through is true (#5081 )
azurerm_app_configuration - temporarily treating resource_group_name as case-

insensitive to work around a breaking API change (#5324 )


azurerm_healthcare_service - making rhe cors_configuration block computed

(#5046 )
azurerm_monitor_log_profile - polling until the log profile is repeatedly available

(#5194 )
azurerm_storage_account_network_rules - matching the validation used for

ip_rules with the validation used by ip_rules in the network_rules block of


azurerm_storage_account (#5201 )
azurerm_subnet - allowing both enforce_private_link_endpoint_network_policies

and enforce_private_link_service_network_policies to be set together (#5200 )


azurerm_virtual_machine - handling a crash when os_profile_secrets was nil

(#5308 )
azurerm_virtual_machine - handling a crash when the vault_certificates block

within the os_profile_secrets was nil (#5308 )

1.39.0 (December 16, 2019)


FEATURES:

New Resource: azurerm_app_configuration (#4859 )


New Resource: azurerm_bot_channel_ms_teams (#4984 )
New Resource: azurerm_mssql_database_vulnerability_assessment_rule_baseline
(#3806 )
New Resource: azurerm_mssql_server_vulnerability_assessment (#3806 )
New Resource: azurerm_mssql_server_security_alert_policy (#3806 )

IMPROVEMENTS:

dependencies: upgrading to v0.7.1 of github.com/tombuildsstuff/giovanni


(#5143 )
storage: switching to use the Authorizers from Azure/go-autorest (#5109 )
azurerm_app_service - adding validation to import (#5107 )
azurerm_app_service_certificate - adding validation to import (#5107 )
azurerm_app_service_custom_hostname_binding - adding validation to import

(#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

default to let the API handel it (#5116 )


azurerm_cosmos_mongo_database - support for the throughput property (#5116 )
azurerm_function_app - support for min_tls_version (#5074 )
azurerm_private_link_endpoint - has been deprecated and renamed to

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 )

1.38.0 (December 06, 2019)


FEATURES:

New Data Source: azurerm_nat_gateway (#4449 )


New Data Source: azurerm_private_link_endpoint_connection (#4493 )
New Data Source: azurerm_virtual_hub (#5004 )
New Resource: azurerm_iothub_fallback_route (#4965 )
New Resource: azurerm_nat_gateway (#4449 )
New Resource: azurerm_point_to_site_vpn_gateway (#5004 )
New Resource: azurerm_private_dns_mx_record (#4915 )
New Resource: azurerm_private_link_endpoint (#4493 )
New Resource: azurerm_storage_account_network_rules (#5082 )
New Resource: azurerm_subnet_nat_gateway_association (#4449 )
New Resource: azurerm_virtual_hub (#5004 )
New Resource: azurerm_vpn_gateway (#5004 )
New Resource: azurerm_vpn_server_configuration (#5004 )

IMPROVEMENTS:

network: updating to use API version 2019-09-01 (#5004 )


azurerm_application_gateway - updating the validation for min_capacity and

max_capacity within the autoscale_configuration block (#4958 )


azurerm_application_gateway - fixes a crash when an empty body for probe match

was used (#5056 )


azurerm_dns_a_record - exposing the fqdn (#5000 )
azurerm_dns_aaaa_record - exposing the fqdn (#5000 )
azurerm_dns_caa_record - exposing the fqdn (#5000 )
azurerm_dns_cname_record - exposing the fqdn (#5000 )
azurerm_dns_mx_record - exposing the fqdn (#5000 )
azurerm_dns_ns_record - exposing the fqdn (#5000 )
azurerm_dns_ptr_record - exposing the fqdn (#5000 )
azurerm_dns_srv_record - exposing the fqdn (#5000 )
azurerm_dns_txt_record - exposing the fqdn (#5000 )
azurerm_mysql_server - add support for version 8.0 (#5019 )

BUG FIXES:

azurerm_mssql_elasticpool - no longer panicing when sku is nil (#5017 )


azurerm_storage_account - ensuring we only lock each Virtual Network once

during deletion (#4908 )


azurerm_virtual_wan - deprecating the security_provider_name field since it's no

longer used (#5004 )

1.37.0 (November 26, 2019)


NOTES

The azurerm_kubernetes_cluster resource has undergone substantial changes in this


release to work around breaking behavioural changes in the Azure API. As such the
agent_pool_profile block has been superseded by the default_node_pool block.

Multiple Node Pools can instead be configured using the


azurerm_kubernetes_cluster_node_pool resource.

FEATURES:

New Data Source: azurerm_automation_account (#4740 )


New Data Source: azurerm_netapp_account (#4416 )
New Data Source: azurerm_netapp_pool (#4889 )
New Data Source: azurerm_private_link_service (#4426 )
New Data Source: azurerm_private_link_service_endpoint_connections (#4426 )
New Resource: azurerm_data_factory_trigger_schedule (#4793 )
New Resource: azurerm_iothub_endpoint_eventhub (#4823 )
New Resource: azurerm_iothub_endpoint_servicebus_queue (#4823 )
New Resource: azurerm_iothub_endpoint_servicebus_topic (#4823 )
New Resource: azurerm_iothub_endpoint_storage_container (#4823 )
New Resource: azurerm_iothub_route (#4923 )
New Resource: azurerm_kubernetes_cluster_node_pool (#4899 )
New Resource: azurerm_netapp_account (#4416 )
New Resource: azurerm_netapp_pool (#4889 )
New Resource: azurerm_private_dns_aaaa_record (#4841 )
New Resource: azurerm_private_dns_ptr_record (#4703 )
New Resource: azurerm_private_dns_srv_record (#4783 )
New Resource: azurerm_private_link_service (#4426 )
New Resource: azurerm_relay_hybrid_connection (#4832 )

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

defaults to VM Scale Sets (#4898 )


azurerm_kubernetes_cluster - deprecating the agent_pool_profiles block in

favour of the default_node_pool block (#4898 )


azurerm_kubernetes_cluster - support for enable_node_public_ip in
agent_pool_profile (#4613 )
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_monitor_activity_log_alert - the criteria property now supports
ResourceHealth (#4944 )
azurerm_servicebus_subscription - support for the

forward_dead_lettered_messages_to property (#4789 )


azurerm_signalr_service - support for the cors and features blocks (#4716 )
azurerm_sql_server - support for the identity block (#4754 )
azurerm_subnet - support for the enforce_private_link_service_network_policies

property (#4426 )
azurerm_template_deployment - validating the ARM Template prior to deploying it,

which provides more granular errors (#4715 )

BUG FIXES:

dependencies: temporarily switching to use a fork of github.com/Azure/azure-sdk-


for-go to get around a build issue on 32-bit systems (#4979 )
Data Source: azurerm_network_interface - exporting the IP Address for Dynamic
Network Interfaces (#4852 )
azurerm_api_management_api_policy - sending policy as Raw XML (#4140 )
azurerm_bastion_host - matching the validation for name used by Azure (#4766 )
azurerm_bastion_host - support for hyphens in the name field within the
ip_configuration block (#4814 )
azurerm_container_group - prevent empty string from being passed into commands

(#4953)
azurerm_eventhub_namespace - deprecating the kafka_enabled sproperty as it is

now managed by Azure (#4743 )


azurerm_kubernetes_cluster - support for conditional updates / ignore_changes

on the node_count field (#4898 )


azurerm_kubernetes_cluster - working around a case sensitivity bug when

upgrading clusters via the Azure Portal (#4929 )


azurerm_lb_probe - fixing a bug where protocol was force lower-cased which

caused a diff in the plan (#4631 )


azurerm_lb_rule - fixing a bug where protocol was force lower-cased which

caused a diff in the plan (#4631 )


azurerm_network_interface - exporting the IP Address for Dynamic Network

Interfaces (#4852 )
azurerm_postgresql_database - allowing dashes in the name (#4866 )
azurerm_private_dns_cname_record - fixing a bug where calling Delete didn't

delete the CName record (#4804 )


azurerm_storage_account - fixing an error where Advanced Threat Protection is

unavailable in Azure Germany (#4746 )


azurerm_virtual_network_gateway_connection - Configure routing_weight with

weight 0 (#4849 )

1.36.1 (October 29, 2019)


FEATURES:

provider: adding a flag to allow users to opt-out of the default Terraform Partner
ID (#4751 )

1.36.0 (October 29, 2019)


FEATURES:

New Data Source: azurerm_app_service_certificate_order (#4454 )


New Data Source: azurerm_data_factory (#4517 )
New Data Source: azurerm_healthcare_service (#4221 )
New Data Source: azurerm_resources (#3529 )
New Data Source: azurerm_postgresql_server (#4732 )
New Resource: azurerm_automation_job_schedule (#3386 )
New Resource: azurerm_app_service_certificate_order (#4454 )
New Resource: azurerm_bastion_host (#4096 )
New Resource: azurerm_data_factory_integration_runtime_managed (#4342 )
New Resource: azurerm_healthcare_service (#4221 )
New Resource: azurerm_kusto_eventhub_data_connection (#4385 )

IMPROVEMENTS:

2.0 prep: groundwork required for custom timeouts (#4475 )


dependencies: updating to v34.1.0 of github.com/Azure/azure-sdk-for-go
(#4609 )
devspace: updating to API version 2019-04-01 (#4597 )
frontdoor: updating to use API version 2019-04-01 (#4609 )
provider: switching to use the Provider SDK from github.com/hashicorp/terraform-
provider-sdk (#4474 )
provider: sending Microsoft's Terraform Partner ID in the user agent if a custom
Partner ID isn’t specified (#4663 )
storage: caching the storage account information to workaround the Storage API
being unperformant (#4709 )
Data Source: azurerm_client_config - fixing a crash when using MSI authentication
(#4738 )
Data Source: azurerm_lb_backend_address_pool - exposing
backend_ip_configurations (#4605 )
azurerm_cognitive_account - support for the sku F1 (#4720 )
azurerm_cosmosdb_mongo_collection - add support for the throughput property

(#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

allowing the subnet property be empty (#4541 )


azurerm_kubernetes_cluster - add support for the azure_policy property in the

addon_profile block (#4498 )


azurerm_monitor_action_group - add support for the use_common_alert_schema

webhook property (#4483 )


azurerm_network_security_rule - add support for Icmp to the protocol property

(#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

Microsoft.StreamAnalytics/streamingJobs to the service_delegation.name

property (#4690 )
azurerm_subnet - add support for the Microsoft.Network/networkinterfaces/* and
Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action to

the service_delegation.action property (#4690 )

BUG FIXES:
azurerm_api_management - deprecate the disable_backend_ssl30 ,
disable_backend_tls10 , disable_backend_tls11 , disable_triple_des_ciphers ,

disable_frontend_ssl30 , disable_frontend_tls10 , disable_frontend_tls11

properties as true actually meant enable in favour of enable_backend_ssl30 ,


enable_backend_tls10 , enable_backend_tls11 , enable_triple_des_ciphers ,

enable_frontend_ssl30 , enable_frontend_tls10 , enable_frontend_tls11 (#4534 )


azurerm_devspace_controller - the host_suffix field is now read-only due to a

change in Azure (#4597 )


azurerm_key_vault_certificate - switches the emails , dns_names , upns of the

subject_alternative_names property to use TypeSet (#4645 )


azurerm_kubernetes_cluster - fixing a crash when the service_principal_profile

block was nil (#4697 )


azurerm_kubernetes_cluster - the log_analytics_workspace_id property is now

optional (#4513 )
azurerm_key_vault - temporarily making sku case insensitive to work around a

breaking change in the API (#4714 )


azurerm_management_group - raising the error message when an error occurs

(#4725 )
azurerm_maps_account - temporarily making sku case insensitive to work around a

breaking change in the API (#4714 )


azurerm_media_services_account - fixes the invalid address to set:
[]string{"tags"} error (#4537 )
azurerm_monitor_activity_log_alert - fixing support for the category
ServiceHealth (#4646 )
azurerm_network_security_group_association - prevent deadlock between

association and network interface creation (#4501 )


azurerm_sql_database - ensure the read_scale property is always set during initial

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

identity block when making an update (#4538 )

1.35.0 (October 04, 2019)


FEATURES:
New Data Source: azurerm_app_service_certificate (#4468 )
New Data Source: azurerm_public_ip_prefix (#4340 )
New Data Source: azurerm_storage_management_policy (#3819 )
New Resource: azurerm_bot_channel_slack (#4367 )
New Resource: azurerm_bot_channel_email (#4389 )
New Resource: azurerm_bot_web_app (#4411 )
New Resource: azurerm_dashboard (#4357 )
New Resource: azurerm_eventhub_namespace_disaster_recovery_config (#4425 )
New Resource: azurerm_storage_data_lake_gen2_filesystem (#4457 )
New Resource: azurerm_storage_management_policy (#3819 )

IMPROVEMENTS:

dependencies: upgrading github.com/Azure/azure-sdk-for-go to v33.2.0


(#4334 )
kusto: updating to API version 2019-05-15 (#4376 )
Data Source: azurerm_client_config - add object_id property (#4486 )
azurerm_analysis_services_server - support for backup_blob_container_uri and
server_full_name (#4397 )
azurerm_api_management_api - deprecate sku in favour of the sku_name property

(#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

Analytics Items (#4374 )


azurerm_eventhub_namespace - support for the network_rulesets property

(#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:

provider: Ensuring the user agent is configured (#4463 )


provider: Exposing the version of Terraform Core being used, rather than
vendorered in User Agents (#4464 )
azurerm_container_registry - checking the name is globally unique during creation

(#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

require resource recreation (#4469 )


azurerm_public_ip - ensuring that public_ip_prefix_id is read (#4344 )
azurerm_role_assignment - changing the skip_service_principal_aad_check
property no longer forces a new resource (#4412 )
azurerm_storage_blob - reading the properties after an update (#4452 )

1.34.0 (September 18, 2019)


FEATURES:

New Data Source: azurerm_network_ddos_protection_plan (#4228 )


New Data Source: azurerm_proximity_placement_group (#4020 )
New Data Source: azurerm_servicebus_namespace_authorization_rule (#4294 )
New Data Source: azurerm_sql_database (#4210 )
New Data Source: azurerm_storage_account_blob_container_sas (#4195 )
New Resource: azurerm_app_service_certificate (#4192 )
New Resource: azurerm_app_service_source_control_token (#4214 )
New Resource: azurerm_bot_channels_registration (#4245 )
New Resource: azurerm_bot_connection (#4311 )
New Resource: azurerm_frontdoor (#3933 )
New Resource: azurerm_frontdoor_firewall_policy (#4125 )
New Resource: azurerm_kusto_cluster (#4129 )
New Resource: azurerm_kusto_database (#4149 )
New Resource: azurerm_marketplace_agreement (#4305 )
New Resource: azurerm_private_dns_zone_virtual_network_link (#3789 )
New Resource: azurerm_proximity_placement_group (#4020 )
New Resource: azurerm_stream_analytics_output_servicebus_topic (#4164 )
New Resource: azurerm_web_application_firewall_policy (#4119 )

IMPROVEMENTS:

dependencies: updating github.com/Azure/azure-sdk-for-go to v32.5.0 (#4166 )


dependencies: updating github.com/Azure/go-autorest to v0.9.0 (#4166 )
dependencies: updating github.com/hashicorp/go-azure-helpers to v0.7.0
(#4166 )
dependencies: updating github.com/terraform-providers/terraform-provider-
azuread to v0.6.0 (#4166 )
dependencies: updating github.com/hashicorp/terraform to v0.12.8 (#4341 )
compute: updating the API Version to 2019-07-01 (#4331 )
network: updating to API version 2019-06-01 (#4291 )
network: reverting the locking changes from #3673 (#3673 )
storage: caching the Resource Group Name / Account Key (#4205 )
storage: switching to use SharedKey for authentication with Blobs/Containers
rather than SharedKeyLite (#4235 )
Data Source: azurerm_storage_account - gracefully degrading when there's a
ReadOnly lock/the user doesn't have permissions to list the Keys for the storage
account (#4248 )
Data Source: azurerm_storage_account_sas - adding an ISO8601 validator to the
start and end dates (#4064 )
Data Source: azurerm_virtual_network - support for the location property
(#4281 )
azurerm_api_management - support for multiple additional_location blocks

(#4175 )
azurerm_application_gateway - allowing capacity to be set to 32 (#4189 )
azurerm_application_gateway - support OWASP version 3.1 for the

rule_set_version property (#4263 )


azurerm_application_gateway - support for the trusted_root _certificate

property (#4206 )
azurerm_app_service - fixing a bug where the Application logs block would get

reset when app_settings were configured (#4243 )


azurerm_app_service - support for sending HTTP Logs to Blob Storage (#4249 )
azurerm_app_service - the ip_restriction.ip_address property is now optional

(#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

forces a new resource (#4163 )


azurerm_eventhub_namespace - changing the kafka_enabled property now forces a

new resource (#4264 )


azurerm_kubernetes_cluster - support for configuring the kube_dashboard within

the addon_profile block (#4139 )


azurerm_kubernetes_cluster - prevent pod_cidr and azure network_plugin from
being set at the same time causing a new resource to be created (#4286 )
azurerm_mariadb_server - support for version 10.3 (#4170 )
azurerm_mariadb_server - support for configuring auto_grow (#4302 )
azurerm_managed_disk - add support for the Ultra SSD disk_iops_read_write &
disk_mbps_read_write properties (#4102 )
azurerm_mysql_server - support for configuring auto_grow (#4303 )
azurerm_private_dns_zone - polling until the dns zone is marked as fully

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

skip_service_principal_aad_check properties (#4168 )


azurerm_storage_account - gracefully degrading when there's a ReadOnly lock/the

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

for the presence of an existing storage table (#4234 )


azurerm_stream_analytics_job - the field data_locale is now optional (#4190 )
azurerm_stream_analytics_job - the field

events_late_arrival_max_delay_in_seconds is now optional (#4190 )


azurerm_stream_analytics_job - the field events_out_of_order_policy is now

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:

azurerm_app_service - will no longer panic from when an access restriction rule

involves a virtual network (#4184 )


azurerm_app_service_slot - will no longer panic from when an access restriction

rule involves a virtual network (#4184 )


azurerm_app_service_plan and azurerm_app_service_slot crash fixes (#4184 )
azurerm_container_group - make storage_account_key field in volume block

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

passed into the property linked_service_properties (#4142 )


azurerm_log_analytics_workspace_linked_service - will no longer panic if no items

are passed into the property linked_service_properties (#4152 )


azurerm_network_interface - changing the ip_configuration property to no

longer force new resource (#4155 )


azurerm_virtual_network_peering - prevent nil object from being read (#4180 )

1.33.1 (August 27, 2019)


networking: reducing the number of locks to avoid deadlock when creating 3 or
more subnets with Network Security Group/Route Table Associations (#3673 )

1.33.0 (August 22, 2019)


FEATURES:

New Data Source: azurerm_dev_test_virtual_network (#3746 )


New Resource: azurerm_cosmosdb_sql_container (#3871 )
New Resource: azurerm_container_registry_webhook (#4112 )
New Resource: azurerm_dev_test_lab_schedule (#3554 )
New Resource: azurerm_mariadb_virtual_network_rule (#4048 )
New Resource: azurerm_mariadb_configuration (#4060 )
New Resource: azurerm_private_dns_cname_record (#4028 )
New Resource: azurerm_recovery_services_fabric (#4003 )
New Resource: azurerm_recovery_services_protection_container (#4003 )
New Resource: azurerm_recovery_services_replication_policy (#4003 )
New Resource: azurerm_recovery_services_protection_container_mapping
(#4003 )
New Resource: azurerm_recovery_network_mapping (#4003 )
New Resource: azurerm_recovery_replicated_vm (#4003 )
New Resource: azurerm_sql_failover_group (#3901 )
New Resource: azurerm_virtual_wan (#4089 )

IMPROVEMENTS:

all resources: increasing the maximum number of tags from 15 to 50 (#4071 )


dependencies: upgrading github.com/tombuildsstuff/giovanni to v0.3.2
(#4122 )
dependencies: upgrading the authorization SDK to 2018-09-01 (#4063 )
dependencies: upgrading github.com/hashicorp/terraform to 0.12.6 (#4041 )
internal: removing a duplicate Date/Time from the debug logs (#4024 )
Data Source azurerm_dns_zone : deprecating the zone_type field (#4033 )
azurerm_app_service - filesystem logging can now be set. (#4025 )
azurerm_batch_pool - Support for Container Registry configurations (#4072 )
azurerm_container_group - support for attaching to a (Private) Virtual Network

(#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 ,

timeout_in_seconds , and tolerated_number_of_failures properties (#3473 )


azurerm_user_assigned_identity - the name field can now be up to 128 characters

(#4094 )

BUG FIXES:

azurerm_app_service_plan - workaround for missing error on 404 (#3990 )


azurerm_batch_certificate - the thumbprint_algorithm property is now case

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

during creation (#3913 )


azurerm_storage_account - making default_action within the network_rules block

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 )

1.32.1 (July 31, 2019)


BUG FIXES:

azurerm_application_gateway fix an index out of range crash (#3966 )


azurerm_api_management_backend - ensuring a nil certificates object is sent to the

API instead of an empty one (#3931 )


azurerm_api_managment_product - additional validation for approval_required

(#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

group cannot be found (#3986 )


azurerm_storage_account - fix enable_advanced_threat_protection create/read for

unsupported regions (#3947 )


azurerm_storage_table - now migrates older versions of the resource id to the new

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

property should now be correctly reflected during updates (#3821 )

1.32.0 (July 24, 2019)


FEATURES:

New Data Source: azurerm_maps_account (#3698 )


New Data Source: azurerm_mssql_elasticpool (#3824 )
New Resource: azurerm_analysis_services_server (#3721 )
New Resource: azurerm_api_management_backend (#3676 )
New Resource: azurerm_batch_application (#3825 )
New Resource: azurerm_maps_account (#3698 )
New Resource: azurerm_private_dns_zone_a_record (#3849 )
New Resource: azurerm_storage_table_entity (#3831 )
New Resource: azurerm_storage_share_directory (#3802 )

IMPROVEMENTS:

dependencies: upgrading to v31.0.0 of github.com/Azure/azure-sdk-for-go


(#3786 )
dependencies: upgrading to v0.5.0 of github.com/hashicorp/go-azure-helpers
(#3850 )
dependencies: upgrading the containerservice SDK to 2019-02-01 (#3787 )
dependencies: upgrading the subscription SDK to 2018-06-01 (#3811 )
authentication: showing a more helpful error when attempting to use the Azure CLI
authentication when logged in as a Service Principal (#3850 )
Data Source azurerm_function_app - support for auth_settings (#3893 )
Data Source azurerm_subscription - support the tenant_id property (#3811 )
azurerm_app_service - support for backups (#3804 )
azurerm_app_service - support for storage mounts (#3792 )
azurerm_app_service - support for user assigned identities (#3637 )
azurerm_app_service_slot - support for auth_settings (#3897 )
azurerm_app_service_slot - support for user assigned identities (#3637 )
azurerm_application_gateway - Support for Managed Identities (#3648 )
azurerm_batch_pool - support for custom images with the
storage_image_reference property (#3530 )
azurerm_batch_account - expose required properties for when
pool_allocation_mode is UserSubscription (#3535 )
azurerm_cognitive_account - add support for CustomVision.Training and

CustomVision.Prediction to the kind property (#3817 )


azurerm_container_registry - support for network_rule_set property (#3194 )
azurerm_cosmosdb_account - validate max_interval_in_seconds and
max_staleness_prefix correctly when using more then 1 geo_location (#3906 )
azurerm_function_app - support for auth_settings (#3893 )
azurerm_iothub - support for the file_upload property (#3735 )
azurerm_kubernetes_cluster - support for auto scaling (#3361 )
azurerm_kubernetes_cluster - support for custom_resource_group_name (#3785 )
azurerm_kubernetes_cluster - support for the node_taints property (#3787 )
azurerm_kubernetes_cluster - support for the windows_profile property (#3519 )
kubernetes_cluster - support for specifying the load_balancer_sku property

(#3890 )
azurerm_recovery_services_protected_vm - changing backup_policy_id no longer

forces a new resource (#3822 )


azurerm_security_center_contact - the phone property is now optional (#3761 )
azurerm_storage_account - the account_kind property now supports FileStorage

(#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

github.com/tombuildsstuff/giovanni Storage SDK (#3838 )


azurerm_virtual_machine - looking up the data disks attached to the Virtual

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

from being lost during update (#3767 )

BUG FIXES:

azurerm_image - prevent crash when using data_disk (#3797 )


azurerm_role_assignment - now correctly uses scope when looking up the role

definition by name (#3768 )

1.31.0 (June 28, 2019)


FEATURES:

increase the default timeout to 3 hours (#3737 )


New Resource: azurerm_iot_dps (#3618 )
New Resource: azurerm_iot_dps_certificate (#3567 )
New Resource: azurerm_mariadb_firewall_rule (#3720 )
New Resource: azurerm_private_dns_zone (#3718 )
New Resource: azurerm_stream_analytics_output_mssql (#3567 )

IMPROVEMENTS:

Data Source azurerm_key_vault - deprecated sku in favour of sku_name (#3119 )


azurerm_app_service - support for shipping the application logs to blob storage

(#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:

azurerm_cosmosdb_account - will ignore 500 responses from


documentdb.DatabaseAccountsClient#CheckNameExists requests to work around a

broken API (#3747 )

1.30.1 (June 07, 2019)


BUG FIXES:

Ensuring the authorization header is set for calls to the User Assigned Identity API's
(#3613 )

1.30.0 (June 07, 2019)


FEATURES:

New Data Source: azurerm_redis_cache (#3481 )


New Data Source: azurerm_sql_server (#3513 )
New Data Source: azurerm_virtual_network_gateway_connection (#3571 )

IMPROVEMENTS:

dependencies: upgrading to Go 1.12 (#3525 )


dependencies: upgrading the storage SDK to 2019-04-01 (#3578 )
Data Source azurerm_app_service - support windows containers (#3566 )
Data Source azurerm_app_service_plan - support windows containers (#3566 )
azurerm_api_management - rename disable_triple_des_chipers to

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 )

1.29.0 (May 25, 2019)


FEATURES:

New Resource: azurerm_application_insights_web_test (#3331 )

IMPROVEMENTS:

dependencies: upgrading to v0.12.0 of github.com/hashicorp/terraform


(#3417 )
sdk: configuring the Correlation Request ID (#3253 )
azurerm_application_gateway - support for rewrite rules (#3423 )
azurerm_application_gateway - support for ssl_policy blocks and deprecating
disabled_ssl_protocols (#3360 )
azurerm_app_service - support for configuring authentication settings (#2831 )
azurerm_kubernetes_cluster - updating the casing on the SubnetName field to

match a change in the AKS API (#3484 )


azurerm_kubernetes_cluster - support for multiple agent pools (#3491 )

BUG FIXES:

Data Source azurerm_virtual_network : add network_space property to match


resource while deprecating network_spaces (#3494 )
azurerm_automation_module - now polls to wait until the module's finished

provisioning (#3482 )
azurerm_api_management_api - correct validation to allow empty and strings 400

characters long (#3475 )


azurerm_dev_test_virtual_network - correctly manages subnets on the initial

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 )

1.28.0 (May 17, 2019)


FEATURES:
New Data Source: azurerm_automation_variable_bool (#3310 )
New Data Source: azurerm_automation_variable_datetime (#3310 )
New Data Source: azurerm_automation_variable_int (#3310 )
New Data Source: azurerm_automation_variable_string (#3310 )
New Data Source: zurerm_kubernetes_service_versions (#3382 )
New Data Source: azurerm_user_assigned_identity (#3343 )
New Resource: azurerm_automation_variable_bool (#3310 )
New Resource: azurerm_automation_variable_datetime (#3310 )
New Resource: azurerm_automation_variable_int (#3310 )
New Resource: azurerm_automation_variable_string (#3310 )
New Resource: azurerm_api_management_api_operation_policy (#3374 )
New Resource: azurerm_api_management_api_policy (#3367 )
New Resource: azurerm_api_management_product_policy (#3325 )
New Resource: azurerm_api_management_schema (#3357 )
New Resource: azurerm_cosmosdb_table (#3442 )
New Resource: azurerm_cosmosdb_cassandra_keyspace (#3442 )
New Resource: azurerm_cosmosdb_mongo_collection (#3459 )
New Resource: azurerm_cosmosdb_mongo_database (#3442 )
New Resource: azurerm_cosmosdb_sql_database (#3442 )
New Resource: azurerm_firewall_nat_rule_collection (#3218 )
New Resource: azurerm_data_factory_linked_service_data_lake_storage_gen2
(#3425 )
New Resource: azurerm_network_profile (#2636 )

IMPROVEMENTS:

dependencies: updating github.com/Azure/azure-sdk-for-go to v29.0.0 (#3335 )


Data Source azurerm_kubernetes_cluster - exposing the type field within the
agent_pool_profile block (#3424 )
azurerm_application_gateway - support for the autoscale_configuration property

(#3353 )
azurerm_application_gateway added validation to ensure
redirect_configuration_name must not be set if either backend_address_pool_name

or backend_http_settings_name is set (#3340 )


azurerm_application_gateway - support for affinity_cookie_name (#3434 )
azurerm_application_gateway - support for disabled_rule_groups (#3394 )
azurerm_app_service_slot - exporting the site_credential block (#3444 )
azurerm_batch_pool support for the container_configuration property (#3311 )
azurerm_kubernetes_cluster - support for the api_server_authorized_ip_ranges

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

property to chain multiple extensions togeather (#2937 )

BUG FIXES:

Data Source: azurerm_api_management - correctly returning the hostname portal


and proxy values (#3385 )
azurerm_application_gateway - will no longer prevent
default_backend_address_pool_name and redirect_configuration_name from being

set at the same time (#3286 )


azurerm_application_gateway prevent a potential panic in backend and probe

validation (#3438 )
azurerm_eventhub - decrease minimum partition_count to correct value of 1
(#3439 )
azurerm_eventhub_namespace - decrease maximum maximum_throughput_units to

correct value of 20 (#3440 )


azurerm_firewall - ensuring that the value for subnet_id within the
ip_configuration block has the name AzureFirewallSubnet (#3406 )
azurerm_managed_disk - can now actually create UltraSSD_LRS disks (#3453 )
azurerm_redis_configuration - correctly display http errors encoutered during

creation (#3397 )
azurerm_sql_database - making the collation field case insensitive to work

around a bug in the API (#3137 )


azurerm_stream_analytics_output_eventhub will now correctly set format for JSON

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 )

1.27.1 (April 26, 2019)


BUG FIXES:

provider will now only register available resource providers (#3313 )

1.27.0 (April 26, 2019)


NOTES:

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 )

1.26.0 (April 25, 2019)


IMPROVEMENTS:

azurerm_app_service - support for Java 11 (#3270 )


azurerm_app_service_slot - support for Java 11 (#3270 )
azurerm_container_group - support for the identity block (#3243 )

BUG FIXES:

provider will work through proxies again (#3301 )

1.25.0 (April 17, 2019)


FEATURES:

New Data Source: azurerm_batch_certificate (#3097 )


New Data Source: azurerm_express_route_circuit (#3158 )
New Data Source: azurerm_firewall (#3235 )
New Data Source: azurerm_hdinsight_cluster (#3196 )
New Data Source: azurerm_stream_analytics_job (#3227 )
New Resource: azurerm_batch_certificate (#3097 )
New Resource: azurerm_data_factory (#3159 )
New Resource: azurerm_data_factory_dataset_mysql (#3267 )
New Resource: azurerm_data_factory_dataset_postgresql (#3267 )
New Resource: azurerm_data_factory_dataset_sql_server_table (#3236 )
New Resource: azurerm_data_factory_linked_service_sql_server (#3205 )
New Resource: azurerm_data_factory_linked_service_mysql (#3265 )
New Resource: azurerm_data_factory_linked_service_postgresql (#3266 )
New Resource: azurerm_data_factory_pipeline (#3244 )
New Resource: azurerm_hdinsight_kafka_cluster (#3196 )
New Resource: azurerm_hdinsight_kbase_cluster (#3196 )
New Resource: azurerm_hdinsight_hadoop_cluster (#3196 )
New Resource: azurerm_hdinsight_interactive_query_cluster (#3196 )
New Resource: azurerm_hdinsight_ml_services_cluster (#3196 )
New Resource: azurerm_hdinsight_rserver_cluster (#3196 )
New Resource: azurerm_hdinsight_spark_cluster (#3196 )
New Resource: azurerm_hdinsight_storm_cluster (#3196 )
New Resource: azurerm_iothub_shared_access_policy (#3009 )
New Resource: azurerm_public_ip_prefix (#3139 )
New Resource: azurerm_stream_analytics_job (#3227 )
New Resource: azurerm_stream_analytics_function_javascript_udf (#3249 )
New Resource: azurerm_stream_analytics_stream_input_blob (#3250 )
New Resource: azurerm_stream_analytics_stream_input_eventhub (#3250 )
New Resource: azurerm_stream_analytics_stream_input_iothub (#3250 )
New Resource: azurerm_stream_analytics_output_blob (#3250 )
New Resource: azurerm_stream_analytics_output_eventhub (#3250 )
New Resource: azurerm_stream_analytics_output_servicebus_queue (#3250 )

IMPROVEMENTS:

dependencies: updating github.com/Azure/azure-sdk-for-go to v26.7.0 (#3126 )


dependencies: updating github.com/Azure/go-autorest to v11.7.0 (#3126 )
dependencies: updating github.com/hashicorp/terraform to 44702fa6c163
(#3181 )
Data Source: azurerm_batch_pool - adding the resource_file block to the
start_task block (#3192 )
Data Source: azurerm_subnet - exposing the service_endpoint field (#3184 )
azurerm_batch_pool - adding the resource_file block to the start_task block

(#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

for the traffic_routing_method property (#3207 )


azurerm_virtual_network_gateway - support for the VpnGw1AZ , VpnGw2AZ , and
VpnGw3AZ SKU's (#3171 )

BUG FIXES:

dependencies: downgrading the Security API to 2017-08-01-preview to work


around a breaking API change (#3269 )
azurerm_app_service - removing Computed from the use_32_bit_worker_process

property in the site_config block (#3219 )


azurerm_app_service_slot - removing Computed from the

use_32_bit_worker_process property in the site_config block (#3219 )


azurerm_batch_account - temporarily treating the Resource Group Name as case

insensitive to work around an API bug (#3260 )


azurerm_batch_pool - temporarily treating the Resource Group Name as case

insensitive to work around an API bug (#3260 )


azurerm_app_service - ensuring deleted App Services are detected correctly

(#3198 )
azurerm_function_app - ensuring deleted Function Apps are detected correctly

(#3198 )
azurerm_virtual_machine - adding validation for the identity_ids field (#3183 )

1.24.0 (April 03, 2019)


UPGRADE NOTES:

azurerm_kubernetes_cluster - ssh_key is now limited to a single element to reflect

what the API expects (#3099 )


FEATURES:

New Data Source: azurerm_api_management_api (#3010 )


New Resource: azurerm_api_management_api (#3010 )
New Resource: azurerm_api_management_api_operation (#3121 )
New Resource: azurerm_api_management_api_version_set (#3073 )
New Resource: azurerm_api_management_authorization_server (#3123 )
New Resource: azurerm_api_management_certificate (#3141 )
New Resource: azurerm_api_management_logger (#2994 )
New Resource: azurerm_api_management_openid_connect_provider (#3143 )
New Resource: azurerm_api_management_product_api (#3066 )
New Resource: azurerm_api_management_subscription (#3103 )

IMPROVEMENTS:

Data Source: azurerm_app_service - exporting the cors headers (#2870 )


Data Source: azurerm_storage_account - exposing the Hierarchical Namespace
state (#3032 )
azurerm_api_management - support for sign_in , sign_up and policy blocks

(#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

site_config block (#3019 )


azurerm_app_service - support for specifying cors headers (#2870 )
azurerm_app_service_slot - support for specifying cors headers (#2870 )
azurerm_app_service_slot - support for additional types for the scm_type field in

the site_config block (#3019 )


azurerm_application_gateway - support for WAF configuration properties
request_body_check and max_request_body_size_kb (#3093 )
azurerm_application_gateway - support for the hostname property (#2990 )
azurerm_application_gateway - support for redirect rules (#2908 )
azurerm_application_gateway - support for zones (#3144 )
azurerm_batch_account - now exports the primary_access_key ,
secondary_access_key , and account_endpoint properties (#3071 )
azurerm_container_group - support for attaching GPU's (#3053 )
azurerm_eventhub - support for the skip_empty_archives property (#3074 )
azurerm_eventhub_namespace - increase maximum maximum_throughput_units to 100

(#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

correctly diff'd depending on the type (#2951 )


azurerm_image - support for the zone_resilient property (#3100 )
azurerm_kubernetes_cluster - support for the network_profile property (#2987 )
azurerm_key_vault - support for the storage_permissions property (#3081 )
azurerm_managed_disk - support for managed disks up to 32TB (#3062 )
azurerm_mssql_elasticpool - support setting the zone_redundant property

(#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:

azurerm_application_gateway - correctly populating backend addresses from both

new and deprecated properties fqdns / fqdn_list (#3085 )


azurerm_key_vault_certificate - making contents and password within the
certificate block sensitive (#3064 )
monitor_metric_alert - support for setting aggregation to count (#3047 )
azurerm_virtual_network_gateway - fixing a crash when bgp_settings had no

elements (#3038 )
azurerm_virtual_machine_scale_set - support setting zones to an empty list

(#3142 )

1.23.0 (March 08, 2019)


FEATURES:

New Data Source: azurerm_api_management_group (#2809 )


New Data Source: azurerm_api_management_product (#2953 )
New Data Source: azurerm_api_management_user (#2954 )
New Data Source: azurerm_availability_set (#2850 )
New Data Source: azurerm_network_watcher (#2791 )
New Data Source: azurerm_recovery_services_protection_policy_vm (#2974 )
New Resource: azurerm_api_management_group (#2809 )
New Resource: azurerm_api_management_group_user (#2972 )
New Resource: azurerm_api_management_product (#2953 )
New Resource: azurerm_api_management_product_group (#2984 )
New Resource: azurerm_api_management_property (#2986 )
New Resource: azurerm_api_management_user (#2954 )
New Resource: azurerm_connection_monitor (#2791 )
New Resource: azurerm_eventgrid_domain (#2884 )
New Resource: azurerm_eventgrid_event_subscription (#2967 )
New Resource: azurerm_lb_outbound_rule (#2912 )
New Resource: azurerm_media_service_account (#2711 )

IMPROVEMENTS:

dependencies: upgrading to v25.1.0 of github.com/Azure/azure-sdk-for-go


(#2886 )
dependencies: upgrading to v11.4.0 of github.com/Azure/go-autorest (#2886 )
azurerm_application_gateway - support for setting path within the
backend_http_settings block (#2879 )
azurerm_application_gateway - support for setting connection_draining to the
backend_http_settings (#2778 )
azurerm_container_group - support for specifying the diagnostics block (#2763 )
azurerm_iothub - support for the fallback_route property (#2764 )
azurerm_key_vault - support for 1024 access_policy blocks (#2866 )
azurerm_redis_cache - support for configuring the
maxfragmentationmemory_reserved in the redis_configuration block (#2887 )
azurerm_servicebus_namespace - allowing capacity to be set to 0 for non-

Premium SKU's (#2920 )


azurerm_service_fabric_cluster - support for setting capacities and

placement_properties (#2936 )
azurerm_storage_account - exposing primary/secondary _host attributes (#2792 )

BUG FIXES:

azurerm_api_management - switching to use API version 2018-01-01 rather than

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 )

1.22.1 (February 14, 2019)


BUG FIXES:

azurerm_key_vault_access_policy - will no longer fail to find the Key Vault if


key_vault_id is empty (#2874 )
azurerm_key_vault_certificate - will no longer fail to find the Key Vault if
key_vault_id is (#2874 )
azurerm_key_vault_key - will no longer fail to find the Key Vault if key_vault_id is

(#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

storage account (#2873 )

1.22.0 (February 11, 2019)


UPGRADE NOTES:

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:

New Data Source: azurerm_policy_definition (#2788 )


New Data Source: azurerm_servicebus_namespace (#2841 )
New Resource: azurerm_ddos_protection_plan (#2654 )
New Resource: azurerm_log_analytics_linked_service (#2768 )
New Resource: azurerm_monitor_autoscale_setting (#2768 )
New Resource: azurerm_monitor_metric_alertrule (#2762 )
New Resource:
azurerm_network_interface_application_security_group_association (#2789 )

DEPRECATIONS:

Data Source azurerm_key_vault_key - deprecating the vault_uri property in


favour of key_vault_id (#2820 )
Data Source azurerm_key_vault_secret - deprecating the vault_uri property in
favour of key_vault_id (#2820 )
azurerm_key_vault_certificate - deprecating the vault_uri property in favour of
key_vault_id (#2820 )
azurerm_key_vault_key - deprecating the vault_uri property in favour of
key_vault_id (#2820 )
azurerm_key_vault_access_policy - deprecating the vault_name and
resource_group_name properties in favour of key_vault_id (#2820 )
azurerm_key_vault_secret - deprecating the vault_uri property in favour of

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

(renamed) azurerm_log_analytics_linked_service resource (#2768 )


azurerm_monitor_autoscale_setting - deprecating in favour of the (renamed)
azurerm_autoscale_setting resource (#2768 )
azurerm_network_interface - deprecating the application_security_group_ids

field in favour of the new


azurerm_network_interface_application_security_group_association resource

(#2789 )

IMPROVEMENTS:

dependencies: switching to Go Modules (#2705 )


dependencies: upgrading to v11.3.2 of github.com/Azure/go-autorest (#2744 )
Data Source: azurerm_role_definition - support for finding roles by name
(#2798 )
azurerm_application_gateway - support for the http2 property (#2735 )
azurerm_application_gateway - support for the file_upload_limit_mb property

(#2666 )
azurerm_application_gateway - support for the custom_error_configuration

property (#2783 )
azurerm_application_gateway - Support for pick_host_name_from_backend_address

and pick_host_name_from_backend_http_settings properties (#2658 )


azurerm_app_service - support for the client_cert_enabled property (#2765 )
azurerm_autoscale_setting - support values from 0 to 1000 for the minimum ,

maximum and default properties (#2815 )


azurerm_batch_pool - support for the max_tasks_per_node property (#2805 )
azurerm_cognitive_account - exporting primary_access_key and
secondary_access_key (#2825 )
azurerm_cosmosdb_account - support for the EnableAggregationPipeline ,

MongoDBv3.4 and mongoEnableDocLevelTTL capabilities (#2715 )


azurerm_data_lake_store_file - support file uploads greater then 4 megabytes

(#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

access keys and connection strings (#2655 )


azurerm_subnet - support for additional subnet delegation types (#2667 )

BUG FIXES:

azurerm_azuread_application - fixing a bug where reply_uris was set incorrectly

(#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

race condition (#2725 )


azurerm_service_bus_subscription - name's can now start with a digit (#2672 )
azurerm_security_center - increase the creation timeout to 30m (#2724 )
azurerm_service_fabric_cluster - no longer pass reverse_proxy_endpoint_port to

the API when not specified (#2747 )


azurerm_subnet - fixing a crash when service endpoints was nil (#2742 )
azurerm_subnet - will no longer lose service endpoints during a virtual network

update (#2738 )

1.21.0 (January 11, 2019)


FEATURES:

New Data Source: azurerm_application_insights (#2625 )


New Data Source: azurerm_batch_account (#2428 )
New Data Source: azurerm_batch_pool (#2461 )
New Data Source: azurerm_lb (#2354 )
New Data Source: azurerm_lb_backend_address_pool (#2354 )
New Data Source: azurerm_virtual_machine (#2463 )
New Resource: azurerm_application_insights_api_key (#2556 )
New Resource: azurerm_batch_account (#2428 )
New Resource: azurerm_batch_pool (#2461 )
New Resource: azurerm_firewall_application_rule_collection (#2532 )
New Resource: azurerm_policy_set_definition (#2535 )

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

AzureAD Provider (#2632 )


azurerm_azuread_service_principal_password - deprecating in favour of the split-

out AzureAD Provider (#2632 )


azurerm_cognitive_account - support for the SpeechServices kind (#2583 )
azurerm_container_group - deprecated container properties port and protocol for

ports allowing for multiple ports (#1930 )


azurerm_eventhub_namespace - support for kafka_enabled (#2395 )
azurerm_firewall - renaming the public_ip_address_id property to ip_address_id

(#2433 )
azurerm_kubernetes_cluster - support for Virtual Nodes (#2641 )
azurerm_kubernetes_cluster - the dns_prefix now forces a new resource and is

properly validated (#2611 )


azurerm_log_analytics_workspace_linked_service - now correctly handels uppcase
workspace_name values (#2594 )
azurerm_network_interface - support for IPv6 addresses (#2548 )
azurerm_policy_assignment - support for Managed Service Identity (#2549 )
azurerm_policy_assignment - support exclusions with the not_scopes property

(#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

management group (#2618 )


azurerm_public_ip - deprecated public_ip_address_allocation in favour of
allocation_method to better match the SDK (#2576 )
azurerm_redis_cache - add availability zone support (#2580 )
azurerm_service_fabric_cluster - support for azure_active_directory (#2553 )
azurerm_service_fabric_cluster - support for reverse_proxy_certificate

(#2544 )
azurerm_service_fabric_cluster - support for reverse_proxy_endpoint_port

(#2544 )
azurerm_subnet - support for delegation (#2042 )

BUG FIXES:

Data Source: azurerm_managed_disk - exposing the create_option field (#2597 )


Data Source: azurerm_network_interface - exposing
application_security_group_ids within the ip_configuration block (#2599 )
Data Source: azurerm_snapshot - ensuring disk_size_gb is set (#2596 )
Data Source: azurerm_storage_account - ensuring the account_replication_type
field is set correctly (#2595 )
azurerm_app_service - handling connection strings being in any order (#2609 )
azurerm_app_service_slot - handling connection strings being in any order

(#2609 )
azurerm_network_security_rule - the properties
source_application_security_group_ids and

destination_application_security_group_ids are now correctly read & imported

(#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:

New Data Source: azurerm_monitor_action_group (#2430 )


New Resource: azurerm_mariadb_database (#2445 )
New Resource: azurerm_mariadb_server (#2406 )
New Resource: azurerm_signalr_service (#2410 )

IMPROVEMENTS:

authentication: switching to use the shared Azure authentication library (#2355 )


authentication: support for authenticating using a Service Principal with a Client
Certificate (#2471 )
authentication: requesting a token using the audience address (#2381 )
authentication: switching to request tokens from the Azure CLI (#2387 )
sdk: upgrading to version 2018-05-01 of the Policy API (#2386 )
Data Source: azurerm_kubernetes_cluster - support for Role Based Access Control
without Microsoft Entra ID (#2495 )
Data Source: azurerm_kubernetes_cluster - exposing the clusterAdmin credentials
(#2495 )
Data Source: azurerm_subscriptions - ability to filtering by prefix/contains on the
Display Name (#2429 )
azurerm_app_service - support for configuring app_command_line in the

site_config block (#2350 )


azurerm_app_service_plan - deprecated the properties and moved

app_service_environment_id , per_site_scaling and reserved to the top level

(#2442 )
azurerm_app_service_slot - support for configuring app_command_line in the

site_config block (#2350 )


azurerm_application_insights - added Node.JS application type (#2407 )
azurerm_container_registry - support for geo-replication via the

georeplication_locations property (#2055 )


azurerm_key_vault - exposed backup and restore permissions made

key_permissions and secret_permissions optional (#2363 )


azurerm_kubernetes_cluster - support for Role Based Access Control without

Microsoft Entra ID (#2495 )


azurerm_kubernetes_cluster - exposing the clusterAdmin credentials (#2495 )
azurerm_mssql_elasticpool - deprecated the elastic_pool_properties property

and moved max_size_bytes and zone_redundant to the top level (#2378 )


azurerm_mysql_server - support for new skus GP_Gen5_64 and MO_Gen5_32

(#2446 )
azurerm_postgresql_server support for new skus GP_Gen5_64 and MO_Gen5_32 -

(#2447 )

BUG FIXES:

Data Source: azurerm_logic_app_workflow - ensuing the parameters are a string


prior to flattening (#2348 )
Data Source: azurerm_public_ip - ensuing properties always exist (#2448 )
Data Source: azurerm_route_table - validation updated to prevent empty and
blank property values from causing a panic (#2467 )
azurerm_key_vault - fixing a deadlock situation where multiple subnets are used

from the same virtual network (#2324 )


azurerm_eventhub - making the partition_count field ForceNew (#2400 )
azurerm_eventhub - now validates that the storage_account_id is a proper resource

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

values from causing a panic (#2467 )


azurerm_sql_server - only updating the admin_login_password when it's changed,
allowing this to be managed outside of Terraform (#2263 )
azurerm_virtual_machine - nil-checking properties prior to accessing (#2365 )

1.19.0 (November 15, 2018)


FEATURES:

New Data Source: azurerm_key_vault_key (#2231 )


New Data Source: azurerm_monitor_diagnostic_setting (#1291 )
New Resource: azurerm_iothub_consumer_group (#2243 )
New Resource: azurerm_monitor_diagnostic_setting (#1291 )
New Resource: azurerm_mssql_elasticpool (#2071 )

IMPROVEMENTS:

dependencies: switching to Go 1.11 (#2229 )


authentication: refactoring to allow authentication modes to be feature-toggled
(#2199 )
Data Source: azurerm_kubernetes_cluster - support for role_based_access_control
(#1820 )
azurerm_app_service - support for PHP 7.2 (#2308 )
azurerm_app_service_slot - support for PHP 7.2 (#2308 )
azurerm_databricks_workspace - fixing validation on the name field (#2221 )
azurerm_function_app - support for the enable_builtin_logging property

(#2268 )
azurerm_kubernetes_cluster - support for role_based_access_control (#1820 )
azurerm_network_interface - deprecating internal_fqdn since it's no longer

setable/returned by Azure (#2253 )


azurerm_shared_image_version - allowing larger numbers for versions (#2301 )
azurerm_virtual_machine - support for assigning both a system and a user

managed identity (#2188 )


azurerm_virtual_machine_scale_set - support for assigning both a system and a

user managed identity (#2188 )


azurerm_virtual_machine_scale_set - support for setting eviction_policy

(#2226 )
azurerm_virtual_network_gateway - support for Zone Redundant Gateways

(#2260 )

BUG FIXES:

Data Source: azurerm_api_management - ensuring the public_ip_addresses field is


set (#2310 )
azurerm_api_management - ensuring the public_ip_addresses field is set (#2310 )
azurerm_application_gateway - refactoring to ensure all fields are set (#2054 )
azurerm_application_gateway - SSL certificates no longer continually diff (#2054 )
azurerm_azuread_application - fix regression and allow http for identifier_uris

and reply_urls properties (#2320 )


azurerm_cosmosdb_account - the ip_range_filter range filter now allows /32 ip

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

group then the vault (#2287 )


azurerm_role_assignment - will now wait after a Service Principal is created

(#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 )

1.18.0 (November 02, 2018)


FEATURES:

New Resource: azurerm_devspace_controller (#2086 )


New Resource: azurerm_log_analytics_workspace_linked_service (#2139 )

IMPROVEMENTS:

authentication: decoupling the authentication methods from the provider to


enable splitting out the authentication library (#2197 )
authentication: using the Proxy from the Environment, if set (#2133 )
dependencies: upgrading to v21.3.0 of github.com/Azure/azure-sdk-for-go
(#2163 )
refactoring: decoupling Resource Provider Registration to enable splitting out the
authentication library (#2197 )
sdk: upgrading to 2018-10-01 of the containerinstance sdk (#2174 )
azurerm_automation_account - exposing dsc_server_endpoint ,
dsc_primary_access_key , dsc_secondary_access_key properties (#2166 )
azurerm_automation_account - support for the free SKU (#2166 )
azurerm_client_config - ensuring the service_principal_application_id and

service_principal_object_id are always set (#2120 )


azurerm_cosmosdb_account - support for the enable_multiple_write_locations

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

application_security_group_ids property of ip_configuration (#2009 )


azurerm_virtual_machine_scale_set - support for a Rolling Upgrade Policy with

Automatic OS upgrades (#922 )

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

field in the hostname_configuration block (#2189 )


azurerm_function_app - correctly marking the resource as missing upon manual

deletion (#2111 )
azurerm_kubernetes_cluster - changing os_disk_size_gb to computed as the API

now returns a valid default (#2117 )


azurerm_public_ip - domain_name_label validation now allows 63 characters

(#2122 )
azurerm_virtual_machine - making availability_set_id conflict with zones
(#2185 )

1.17.0 (October 18, 2018)


UPGRADE NOTES:

azurerm_virtual_machine_scale_set - the field primary within the

ip_configuration block within the network_profile block is now Required, to

match behavioural changes in the Azure API. (#2035 )

FEATURES:

New Data Source: azurerm_monitor_log_profile (#1792 )


New Resource: azurerm_api_management (#1516 )
New Resource: azurerm_automation_dsc_configuration (#1512 )
New Resource: azurerm_automation_dsc_nodeconfiguration (#1512 )
New Resource: azurerm_automation_module (#1512 )
New Resource: azurerm_cognitive_account (#962 )
New Resource: azurerm_databricks_workspace (#1134 )
New Resource: azurerm_dev_test_policy (#2070 )
New Resource: azurerm_dev_test_linux_virtual_machine (#2058 )
New Resource: azurerm_dev_test_windows_virtual_machine (#2058 )
New Resource: azurerm_monitor_activitylog_alert (#1989 )
New Resource: azurerm_monitor_metric_alert (#2026 )
New Resource: azurerm_monitor_log_profile (#1792 )
New Resource:
azurerm_network_interface_application_gateway_backend_address_pool_associatio

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

oms_agent property (#1995 )


azurerm_service_bus_queue - support for max_delivery_count (#2028 )
azurerm_redis_cache - capcity can now be successfully changed (#2088 )
azurerm_virtual_machine_scale_set - primary is now required within the
ip_configuration block within network_profile (matching a behavioural change

with the Azure API) (#2035 )

IMPROVEMENTS:

azurerm_application_gateway - support for the StandardV2 and WAFV2 skus and

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

new resource (#2021 )


azurerm_postgresql_virtual_network_rule - support for the

ignore_missing_vnet_service_endpoint (#2056 )
azurerm_public_ip - support for IPv6 addresses (#2019 )
azurerm_search_service - adding the administrative primary_key and

secondary_key propeties (#2074 )


azurerm_role_definition - adding the data_actions and not_data_actions to the

data source (#2110 )


azurerm_storage_container - changing container_access_type no longer forces a

new resource (#2075 )


azurerm_user_assigned_identity - now exports the client_id property (#2078 )

1.16.0 (October 01, 2018)


UPGRADE NOTES:

azurerm_azuread_application - the properties homepage , identifier_uris and


reply_urls are now required to be https as required by Azure (#1960 )

FEATURES:

New Data Source: azurerm_dev_test_lab (#1944 )


New Data Source: azurerm_shared_image (#1987 )
New Data Source: azurerm_shared_image_gallery (#1987 )
New Data Source: azurerm_shared_image_version (#1987 )
New Resource: azurerm_dev_test_lab (#1944 )
New Resource: azurerm_dev_test_virtual_network (#1944 )
New Resource: azurerm_shared_image (#1987 )
New Resource: azurerm_shared_image_gallery (#1987 )
New Resource: azurerm_shared_image_version (#1987 )

IMPROVEMENTS:

dependencies: upgrading to v21.0.0 of github.com/Azure/azure-sdk-for-go


(#1996 )
azurerm_cosmosdb_account - adding the is_virtual_network_filter_enabled and
virtual_network_rule propeties (#1961 )

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

created in parallel (#1970 )


azurerm_lb_rule - allow 0 for frontend_port and backend_port again (#1951 )
azurerm_public_ip - correctly reading and importing the idle_timeout_in_minutes

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

cluster_code_version field (#1945 )


azurerm_virtual_network - exposing the id of each subnet (#1913 )
azurerm_virtual_machine - handling the Managed Disk ID being nil (#1947 )
azurerm_virtual_machine_data_disk_attachment - supporting data disk

attachments when a VM Extension is installed (#1950 )


azurerm_virtual_machine_scale_set - making admin_password in the os_profile

block optional again (#1958 )

1.15.0 (September 14, 2018)


FEATURES:

New Resource: azurerm_firewall (#1627 )


New Resource: azurerm_firewall_network_rule_collection (#1627 )
New Resource: azurerm_mysql_virtual_network_rule (#1879 )

IMPROVEMENTS:

dependencies: upgrading to v20.1.0 of github.com/Azure/azure-sdk-for-go


(#1861 )
dependencies: upgrading to v10.15.4 of github.com/Azure/go-autorest (#1861 )
(#1909 )
sdk: upgrading to version 2018-06-01 of the Compute API's (#1861 )
azurerm_automation_runbook - support for specifying the content field (#1696 )
azurerm_app_service - adding the virtual_network_name property (#1896 )
azurerm_app_service_slot - adding the virtual_network_name property (#1896 )
azurerm_key_vault_certificate - adding the thumbprint property (#1904 )
azurerm_servicebus_queue - adding validation for ISO8601 Durations (#1921 )
azurerm_servicebus_topic - adding validation for ISO8601 Durations (#1921 )
azurerm_sql_database - adding the threat_detection_policy property (#1628 )
azurerm_virtual_network - adding validation to name preventing empty values

(#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:

Data Source: azurerm_azuread_service_principal - passing a filter containing the


name to Azure rather than querying locally (#1862 )
Data Source: azurerm_azuread_service_principal - passing a filter containing the
name to Azure rather than querying locally (#1862 )
azurerm_logic_app_trigger_http_request - relative_path property now allows / s

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 )

1.14.0 (September 06, 2018)


FEATURES:

New Data Source: azurerm_management_group (#1877 )


New Resource: azurerm_management_group (#1788 )
New Resource: azurerm_postgresql_virtual_network_rule (#1774 )

IMPROVEMENTS:

authentication: making the client registration consistent (#1845 )


azurerm_application_insights - support for the MobileCenter kind (#1878 )
azurerm_function_app - removing validation from the version field (#1872 )
azurerm_iothub - exporting the event_hub_events_endpoint ,

event_hub_events_path , event_hub_operations_endpoint and


event_hub_operations_path fields (#1789 )
azurerm_iothub - support for endpoint and route blocks (#1693 )
azurerm_kubernetes_cluster - making linux_profile optional (#1821 )
azurerm_storage_blob - support for import (#1816 )
azurerm_storage_container - support for import (#1816 )
azurerm_storage_queue - support for import (#1816 )
azurerm_storage_table - support for import (#1816 )

BUG FIXES:

azurerm_data_lake_store_file - updating the Resource ID to match the file path

(#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,

hyphens and underscores (#1795 )


azurerm_eventhub_namespace - updating the validation error (#1795 )
azurerm_function_app - support for names in upper-case (#1835 )
azurerm_kubernetes_cluster - removing validation for the pod_cidr field when
network_plugin is set to azure (#1798 )
azurerm_logic_app_workflow - ensuring parameters are strings (#1843 )
azurerm_virtual_machine - setting the image_uri property within the
storage_os_disk block (#1799 )
azurerm_virtual_machine_data_disk_attachment - obtaining a basic view, rather

than the entire instance view of the Virtual Machine to work around an issue in the
API (#1855 )

1.13.0 (August 15, 2018)


FEATURES:

New Data Source: azurerm_log_analytics_workspace (#1755 )


New Resource: azurerm_monitor_action_group (#1725 )

IMPROVEMENTS:

dependencies: upgrading to 2018-04-01 of the IoTHub SDK (#1717 )


Azure CLI Auth - using the USERPROFILE environment variable to locate the users
home directory, if set (#1718 )
Data Source azurerm_kubernetes_cluster - exposing the max_pods field within the
agent_pool_profile block (#1753 )
Data Source: azurerm_kubernetes_cluster - exposing the add_on_profile block
(#1751 )
azurerm_automation_schedule - adding the week_days , month_days and

monthly_occurrence properties (#1626 )


azurerm_container_group - adding a new commands field / deprecating the command

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

service_principal block are now ForceNew (#1737 )


azurerm_kubernetes_cluster - docker_bridge_cidr , dns_service_ip and

service_cidr are now conditionally set (#1715 )


azurerm_lb_nat_rule - protocol property now supports All (#1736 )
azurerm_lb_nat_pool - protocol property now supports All (#1748 )
azurerm_lb_probe - protocol property now supports Https (#1742 )
azurerm_lb_rule - support for the All protocol / adding validation (#1754 )

BUG FIXES:

azurerm_application_insights - handling a HTTP 201 being returned from the

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 )

1.12.0 (August 03, 2018)


UPGRADE NOTES:

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:

New Data Source: azurerm_container_registry (#1642 )


New Resource: azurerm_service_fabric_cluster (#4 )

IMPROVEMENTS:

sdk: switching from WaitForCompletion -> WaitForCompletionRef when polling


Future's (#1660 )
Data Source: azurerm_kubernetes_cluster - support for specifying the
network_profile block (#1479 )
Data Source: azurerm_kubernetes_cluster - outputting the node_resource_group
field (#1649 )
azurerm_kubernetes_cluster - support for specifying the network_profile block

(#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:

azurerm_virtual_machine_scale_set - removing the default of priority , since this

isn't set on older instances. (#1586 )

1.11.0 (July 25, 2018)


FEATURES:

New Resource: azurerm_data_lake_store_file (#1261 )

IMPROVEMENTS:

azurerm_app_service - support for min_tls_version in the site_config block

(#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:

azurerm_servicebus_topic - the name property now allows the ~ character

(#1640 )

1.10.0 (July 21, 2018)


FEATURES:

New Data Source: azurerm_azuread_application (#1552 )


New Data Source: azurerm_logic_app_workflow (#1266 )
New Data Source: azurerm_notification_hub (#1589 )
New Data Source: azurerm_notification_hub_namespace (#1589 )
New Data Source: azurerm_service_principal (#1564 )
New Resource: azurerm_autoscale_setting (#1140 )
New Resource: azurerm_data_lake_analytics_account (#1618 )
New Resource: azurerm_data_lake_analytics_firewall_rule (#1618 )
New Resource: azurerm_eventhub_namespace_authorization_rule (#1572 )
New Resource: azurerm_logic_app_action_custom (#1266 )
New Resource: azurerm_logic_app_action_http (#1266 )
New Resource: azurerm_logic_app_trigger_custom (#1266 )
New Resource: azurerm_logic_app_trigger_http_request (#1266 )
New Resource: azurerm_logic_app_trigger_recurrence (#1266 )
New Resource: azurerm_logic_app_workflow (#1266 )
New Resource: azurerm_notification_hub (#1589 )
New Resource: azurerm_notification_hub_authorization_rule (#1589 )
New Resource: azurerm_notification_hub_namespace (#1589 )
New Resource: azurerm_servicebus_queue_authorization_rule (#1543 )
New Resource: azurerm_service_principal (#1564 )
New Resource: azurerm_service_principal_password (#1564 )

IMPROVEMENTS:

authentication: Refreshing the Service Principal Token before using it (#1544 )


dependencies: updating to 2018-02-01 of the App Service SDK (#1436 )
azurerm_app_service - support for setting ftps_settings in the site_config block

(#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

WEBSITE_CONTENTAZUREFILECONNECTIONSTRING for Consumption Apps (#1515 )


azurerm_mysql_server - changing tier or family in sku property no longer

destroys existing resource (#1598 )


azurerm_network_security_rule - a maximum of 1 Application Security Group can

be set per Security Rule (#1587 )


azurerm_postgresql_server - changing tier or family in sku property no longer

destroys existing resource (#1598 )


azurerm_virtual_machine_scale_set - sku property is now a list #1558 (#1558 )

BUG FIXES:

azurerm_application_insights - fixing a bug where application_type was set to

other (#1563 )
azurerm_lb - allow subnet_id to be set to an empty value (#1588 )
azurerm_servicebus_subscription - only sending correlation_filter values if

they're set (#1565 )


azurerm_servicebus_subscription - setting the default_message_ttl field

(#1568 )
azurerm_snapshot - allowing dashes in the name field (#1574 )
azurerm_traffic_manager_endpoint - working around a bug in the API by setting

target to nil when a target_resource_id is specified (#1546 )

1.9.0 (July 11, 2018)


FEATURES:

New Resource: azurerm_azuread_application (#1269 )


New Resource: azurerm_data_lake_store_firewall_rule (#1499 )
New Resource: azurerm_key_vault_access_policy (#1149 )
New Resource: azurerm_scheduler_job (#1172 )
New Resource: azurerm_servicebus_namespace_authorization_rule (#1498 )
New Resource: azurerm_user_assigned_identity (#1448 )

IMPROVEMENTS:

dependencies: updating the containerservice SDK to 2018-03-31 to support AKS


GA (#1474 )
dependencies: updating to v18.0.0 of Azure/azure-sdk-for-go (#1487 )
dependencies: updating to v10.12.0 of Azure/go-autorest (#1487 )
azurerm_application_gateway - adding minimum_servers to the probe resource

(#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

new resource (#1532 )


azurerm_servicebus_queue - enable_partitioning can now be enabled for Basic

and Standard tiers (#1391 )


azurerm_virtual_machine - support for specifying user assigned identities
(#1448 )
azurerm_virtual_machine - making the content field in the
additional_unattend_config block (within os_profile_windows_config ) sensitive

(#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

fix a crash (#1411 )


azurerm_virtual_machine_scale_set - support for specifying user assigned

identities (#1448 )
azurerm_virtual_machine_scale_set - making the content field in the

additional_unattend_config block (within os_profile_windows_config ) sensitive

(#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

when vpn_client_configuration was not supplied (#1505 )

1.8.0 (June 28, 2018)


FEATURES:

New Resource: azurerm_dns_caa_record support (#1450 )


New Resource: azurerm_virtual_machine_data_disk_attachment (#1207 )

IMPROVEMENTS:

dependencies: upgrading to v10.11.4 of Azure/go-autorest (#1418 )


dependencies: upgrading to v17.4.0 of Azure/azure-sdk-for-go (#1418 )
azurerm_lb - additional validation on properties (#1403 )
azurerm_application_gateway - support for the match block for Probes (#1446 )
azurerm_log_analytics_solution - support for Sovereign Clouds (#1410 )
azurerm_log_analytics_workspace - support for Sovereign Clouds (#1410 )
azurerm_log_analytics_workspace - support for the PerGB2018 SKU (#1079 )
azurerm_mysql_server - GeneralPurpose and MemoryOptimized sku tiers now allow

4tb for the storage_mb property (#1449 )


azurerm_network_interface - additional validation on properties (#1403 )
azurerm_postgresql_server - GeneralPurpose and MemoryOptimized sku tiers now

allow 4tb for the storage_mb property (#1449 )


azurerm_postgresql_server - adding support for version 10.0 (#1457 )
azurerm_route_table - adding the disable BGP propagation property (#1435 )
azurerm_sql_database - support for importing from a bacpac backup (#972 )
azurerm_virtual_machine - support for setting the TimeZone on Windows

(#1265 )

BUG FIXES:

validation: ensuring IPv4/MAC addresses are detected correctly (#1431 )

1.7.0 (June 16, 2018)


UPGRADE NOTES:

~> Please Note: The field overprovision on the azurerm_virtual_machine_scale_set


resource has changed from false to true to match the behaviour of Azure in this
release. (#1322 )

BUG FIXES:

azurerm_key_vault - respecting the proxy environment varibles terraform does and

now can create vaults when behind a proxy (#1393 )


azurerm_kubernetes_cluster - dns_prefix is now required (#1333 )
azurerm_network_interface - ensuring that Public IP's/Private IP Addresses can be

removed once assigned (#1295 )


azurerm_public_ip - setting the domain_name_label property into state (#1287 )
azurerm_storage_account - file and blob encryption is now explicity true by

default (#1380 )
azurerm_servicebus_namespace - the capacity propety no longer unnecessarily

forces a new resource when changed (#1382 )


azurerm_virtual_machine_scale_set - the field overprovision is now true by

default (#1322 )
azurerm_app_service_plan - the name property validation now allows understores

(#1351 )

IMPROVEMENTS:

azurerm_automation_schedule - adding the interval property and supporting


recurring schedules (#1384 )
azurerm_dns_ns_record - deprecated record properties in favour of a records list

(#991 )
azurerm_function_app - adding the identity property (#1369 )
azurerm_role_definition - the role_definition_id property is now optional. The

resource will now generate a random UUID if it is ommited (#1378 )


azurerm_storage_account - adding the network_rules property (#1334 )
azurerm_storage_account - adding the identity property (#1323 )
azurerm_storage_blob - adding the content_type property (#1304 )
azurerm_virtual_machine - support for write_accelerator_enabled property on

Premium disks attached to MS-series machines (#964 )


azurerm_virtual_machine_scale_set - adding the dns_settings and dns_servers

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 )

1.6.0 (May 24, 2018)


UPGRADE NOTES:

~> 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.

azurerm_scheduler_job_collection - the property max_retry_interval on both the

resource and datasource has been deprecated in favour of


max_recurrence_interval to better match Azure (#1218 )

FEATURES:

New Data Source: azurerm_storage_account_sas (#1011 )


New Resource: azurerm_data_lake_store (#1219 )
New Resource: azurerm_relay_namespace (#1233 )

BUG FIXES:

across data-sources and resources: making Connection Strings, Keys and


Passwords sensitive fields (#1242 )
azurerm_virtual_machine_scale_set - an empty os_profile_windows_config block

no longer causes a panic ([#12* azurerm_app_service - adding validation to import


(#5107 )
azurerm_app_service_certificate - adding validation to import (#5107 )
azurerm_app_service_custom_hostname_binding - adding validation to import

(#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 )

1.5.0 (May 14, 2018)


UPGRADE NOTES:

~> 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:

New Data Source: azurerm_cosmosdb_account (#1056 )


New Data Source: azurerm_kubernetes_cluster (#1204 )
New Data Source: azurerm_key_vault (#1202 )
New Data Source: azurerm_key_vault_secret (#1202 )
New Data Source: azurerm_route_table (#1203 )

BUG FIXES:

azurerm_redis_cache - changes to the redis_configuration block are now

detected - please see the note above for more information (#1211 )

IMPROVEMENTS:

dependencies - upgrading to v16.2.1 of Azure/azure-sdk-for-go (#1198 )


dependencies - upgrading to v10.8.1 of Azure/go-autorest (#1198 )
azurerm_app_service - support for HTTP2 (#1188 )
azurerm_app_service - support for Managed Service Identity (#1130 )
azurerm_app_service_slot - support for HTTP2 (#1205 )
azurerm_cosmosdb_account - added support for the connection_strings property

(#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 )

1.4.0 (April 26, 2018)


UPGRADE NOTES:

azurerm_cosmosdb_account - the field failover_policy has been deprecated in

favour of geo_locations to better match Azure

FEATURES:

New Data Source: azurerm_recovery_services_vault (#995 )


New Resource: azurerm_recovery_services_vault (#995 )
New Resource: azurerm_servicebus_subscription_rule (#1124 )

IMPROVEMENTS:

azurerm_app_service - support for updating in-place (#1125 )


azurerm_app_service_plan - support for kind being app (#1156 )
azurerm_cosmosdb_account - support for enable_automatic_failover (#1055 )
azurerm_cosmosdb_account - support for the ConsistentPrefix consistncy level

(#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

the machine is stopped (#1100 )


azurerm_virtual_machine - make the vm_size property case insensitive (#1131 )
BUG FIXES:

azurerm_cosmosdb_account - locations can now be modified in-place (without

requiring multiple apply's) (#1055 )

1.3.3 (April 17, 2018)


FEATURES:

New Data Source: azurerm_app_service (#1071 )


New Resource: azurerm_app_service_custom_hostname_binding (#1087 )

IMPROVEMENTS:

dependencies: upgrading to v15.1.0 of Azure/azure-sdk-for-go (#1099 )


dependencies: upgrading to v10.6.0 of Azure/go-autorest (#1077 )
azurerm_app_service - added support for the https_only field (#1080 )
azurerm_app_service_slot - added support for the https_only field (#1080 )
azurerm_function_app - added support for the https_only field (#1080 )
azurerm_key_vault_certificate - exposing the certificate's associated secret_id

(#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 )

1.3.2 (April 04, 2018)


FEATURES:

New Resource: azurerm_packet_capture (#1044 )


New Resource: azurerm_policy_assignment (#1051 )

IMPROVEMENTS:

azurerm_virtual_machine_scale_set - adds support for MSI (#1018 )

1.3.1 (March 29, 2018)


FEATURES:

New Data Source: azurerm_scheduler_job_collection (#990 )


New Data Source: azurerm_traffic_manager_geographical_location (#987 )
New Resource: azurerm_express_route_circuit_authorization (#992 )
New Resource: azurerm_express_route_circuit_peering (#1033 )
New Resource: azurerm_iothub (#887 )
New Resource: azurerm_policy_definition (#1010 )
New Resource: azurerm_sql_virtual_network_rule (#978 )

IMPROVEMENTS:

azurerm_app_service - allow changing client_affinity_enabled without requiring

a resource recreation (#993 )


azurerm_app_service - support for configuring LocalSCM source control (#826 )
azurerm_app_service - returning a clearer error message when the name (which

needs to be globally unique) is in use (#1037 )


azurerm_cosmosdb_account - increasing the maximum value for

max_interval_in_seconds from 100s to 86400s (1 day) [#1000 ]


azurerm_function_app - returning a clearer error message when the name (which

needs to be globally unique) is in use (#1037 )


azurerm_network_interface - support for attaching to Application Gateways

(#1027 )
azurerm_traffic_manager_endpoint - adding support for geo_mappings (#986 )
azurerm_traffic_manager_profile - adding support for the

traffic_routing_method Geographic (#986 )


azurerm_virtual_machine_scale_sets - support for attaching to Application
Gateways (#1027 )
azurerm_virtual_network_gateway - changes to peering_address now force a new

resource (#1040 )

1.3.0 (March 15, 2018)


FEATURES:

New Data Source: azurerm_cdn_profile (#950 )


New Data Source: azurerm_network_interface (#854 )
New Data Source: azurerm_public_ips (#304 )
New Data Source: azurerm_subscriptions (#940 )
New Resource: azurerm_log_analytics_solution (#952 )
New Resource: azurerm_sql_active_directory_administrator (#765 )
New Resource: azurerm_scheduler_job_collection (#963 )

BUG FIXES:
azurerm_application_gateway - fixes a crash where ssl_policy isn't returned from

the Azure API when importing existing resources (#935 )


azurerm_app_service - supporting client_affinity_enabled being false (#973 )
azurerm_kubernetes_cluster - exporting the FQDN (#907 )
azurerm_sql_elasticpool - fixing a crash where location isn't returned for legacy

resources (#982 )

IMPROVEMENTS:

Data Source: azurerm_builtin_role_definition - loading available role definitions


from Azure (#770 )
Data Source: azurerm_managed_disk - adding support for Availability Zones
(#811 )
Data Source: azurerm_network_security_group - support for security rules including
Application Security Groups (#925 )
azurerm_app_service_plan - support for provisioning Consumption Plans (#981 )
azurerm_cdn_endpoint - adding support for GeoFilters, ProbePaths (#967 )
azurerm_cdn_endpoint - making the origin block ForceNew to match Azure

(#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

Security Groups (#925 )


azurerm_network_security_rule - support for security rules including Application

Security Groups (#925 )


azurerm_public_ip - adding support for Availability Zones (#811 )
azurerm_redis_cache - add support for notify-keyspace-events (#949 )
azurerm_template_deployment - support for specifying parameters via

parameters_body (#404 )
azurerm_virtual_machine - adding support for Availability Zones (#811 )
azurerm_virtual_machine_scale_set - adding support for Availability Zones

(#811 )

1.2.0 (March 02, 2018)


FEATURES:
New Data Source: azurerm_application_security_group (#914 )
New Resource: azurerm_application_security_group (#905 )
New Resource: azurerm_servicebus_topic_authorization_rule (#736 )

BUG FIXES:

azurerm_kubernetes_cluster - an empty linux_profile.ssh_key.keydata no longer

causes a crash (#903 )


azurerm_kubernetes_cluster - the linux_profile.admin_username and

linux_profile.ssh_key.keydata fields now force a new resource (#895 )


azurerm_network_interface - the subnet_id field is now case insensitive (#866 )
azurerm_network_security_group - reverting security_rules to a set to fix an

ordering issue (#893 )


azurerm_virtual_machine_scale_set - the computer_name_prefix field now forces a

new resource (#871 )

IMPROVEMENTS:

authentication: adding support for Managed Service Identity (#639 )


azurerm_container_group - added dns_name_label and FQDN properties (#877 )
azurerm_network_interface - support for attaching to Application Security Groups

(#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 )

1.1.2 (February 19, 2018)


FEATURES:

New Resource: azurerm_kubernetes_cluster (#693 )


New Resource: azurerm_app_service_active_slot (#818 )
New Resource: azurerm_app_service_slot (#818 )

BUG FIXES:

Data Source: azurerm_app_service_plan : handling a 404 not being returned as an


error (#849 )
Data Source: azurerm_virtual_network - Fixing a crash when the DhcpOptions
aren't specified (#803 )
azurerm_application_gateway - fixing crashes due to schema mismatches for

existing resources (#848 )


azurerm_storage_container - add a retry for creation (#846 )

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

not ForceNew (#813 )

1.1.1 (February 06, 2018)


BUG FIXES:

azurerm_public_ip - Setting the ip_address field regardless of the DNS Settings

(#772 )
azurerm_virtual_machine - ignores the case of the Managed Data Disk ID's to work

around an Azure Portal bug (#792 )

FEATURES:

New Data Source: azurerm_storage_account (#794 )


New Data Source: azurerm_virtual_network_gateway (#796 )

1.1.0 (January 26, 2018)


UPGRADE NOTES:

Data Source: azurerm_builtin_role_definition - now returns the correct


UUID/GUID for the Virtual Machines Contributor role (previously the ID for the
Classic Virtual Machine Contributor role was returned) (#762 )
azurerm_snapshot - source_uri now forces a new resource on changes due to

behavioural changes in the Azure API (#744 )

FEATURES:

New Data Source: azurerm_dns_zone (#702 )


New Resource: azurerm_metric_alertrule (#478 )
New Resource: azurerm_virtual_network_gateway (#133 )
New Resource: azurerm_virtual_network_gateway_connection (#133 )

IMPROVEMENTS:

core: upgrading to v12.2.0-beta of Azure/azure-sdk-for-go (#684 )


core: upgrading to v9.7.0 of Azure/go-autorest (#684 )
Data Source: azurerm_builtin_role_definition - adding extra role definitions
(#762 )
azurerm_app_service - exposing the outbound_ip_addresses field (#700 )
azurerm_function_app - exposing the outbound_ip_addresses field (#706 )
azurerm_function_app - add support for the always_on and connection_string

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 )

1.0.1 (January 12, 2018)


FEATURES:

New Data Source: azurerm_app_service_plan (#668 )


New Data Source: azurerm_eventhub_namespace (#673 )
New Resource: azurerm_function_app (#647 )

IMPROVEMENTS:

core: adding a cache to the Storage Account Keys (#634 )


azurerm_eventhub - added support for capture_description (#681 )
azurerm_eventhub_consumer_group - adding validation for the user metadata field

(#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 )

1.0.0 (December 15, 2017)


FEATURES:

New Data Source: azurerm_network_security_group (#623 )


New Data Source: azurerm_virtual_network (#533 )
New Resource: azurerm_management_lock (#575 )
New Resource: azurerm_network_watcher (#571 )

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 .

Versions 0.1.0 - 0.3.3

0.3.3 (November 14, 2017)


FEATURES:

New Resource: azurerm_redis_firewall_rule (#529 )


IMPROVEMENTS:

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

block is nil (#551 )


azurerm_lb_nat_rule : support for floating IP's (#542 )
azurerm_public_ip - Clarify the error message for the validation of domain name

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

isn't returned by the API (#480 )

0.3.2 (October 30, 2017)


FEATURES:

New Resource: azurerm_application_gateway (#413 )

IMPROVEMENTS:

azurerm_virtual_machine_scale_set - Add nil check to os disk (#436 )

azurerm_key_vault - Increased timeout on dns availability (#457 )

azurerm_route_table - Fix issue when routes are computed (#450 )

0.3.1 (October 21, 2017)


IMPROVEMENTS:

azurerm_virtual_machine_scale_set - Updating this resource with the v11 of the

Azure SDK for Go (#448 )

0.3.0 (October 17, 2017)


UPGRADE NOTES:

azurerm_automation_account - the SKU Free has been replaced with Basic .

azurerm_container_registry - Azure has updated the SKU from Basic to Classic ,

with new Basic , Standard and Premium SKU's introduced.


azurerm_container_registry - the storage_account block is now

storage_account_id and is only required for Classic SKU's


azurerm_key_vault - certificate_permissions , key_permissions and

secret_permissions have all had the All option removed by Azure. Each

permission now needs to be specified manually.

azurerm_route_table - route is no longer computed

azurerm_servicebus_namespace - The capacity field can only be set for Premium

SKU's
azurerm_servicebus_queue - The enable_batched_operations and support_ordering

fields have been deprecated by Azure.


azurerm_servicebus_subscription - The

dead_lettering_on_filter_evaluation_exceptions has been removed by Azure.


azurerm_servicebus_topic - The enable_filtering_messages_before_publishing

field has been removed by Azure.

FEATURES:

New Data Source: azurerm_builtin_role_definition (#384 )


New Data Source: azurerm_image (#382 )
New Data Source: azurerm_key_vault_access_policy (#423 )
New Data Source: azurerm_platform_image (#375 )
New Data Source: azurerm_role_definition (#414 )
New Data Source: azurerm_snapshot (#420 )
New Data Source: azurerm_subnet (#411 )
New Resource: azurerm_key_vault_certificate (#408 )
New Resource: azurerm_role_assignment (#414 )
New Resource: azurerm_role_definition (#414 )
New Resource: azurerm_snapshot (#420 )

IMPROVEMENTS:

Upgrading to v11 of the Azure SDK for Go (#367 )


azurerm_client_config - updating the data source to work when using AzureCLI

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

by supporting "FromImage" (#399 )


azurerm_managed_disk - support for creating Encrypted Managed Disks (#399 )
azurerm_mysql_* - Ensuring we register the MySQL Resource Provider (#397 )
azurerm_network_interface - exposing all of the Private IP Addresses assigned to

the NIC (#409 )


azurerm_network_security_group / azurerm_network_security_rule - refactoring

(#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

into separate fields (#363 )

azurerm_storage_account - returning a user friendly error when trying to provision

a Blob Storage Account with ZRS redundancy (#421 )

azurerm_subnet - making it possible to remove Network Security Groups / Route

Tables (#411 )
azurerm_virtual_machine - fixing a bug where

additional_unattend_config.content was being updated unintentionally (#377 )


azurerm_virtual_machine - switching to use Lists instead of Sets (#426 )
azurerm_virtual_machine_scale_set - fixing a bug where

additional_unattend_config.content was being updated unintentionally (#377 )


azurerm_virtual_machine_scale_set - support for multiple network profiles

(#378 )

0.2.2 (September 28, 2017)


FEATURES:

New Resource: azurerm_key_vault_key (#356 )


New Resource: azurerm_log_analytics_workspace (#331 )
New Resource: azurerm_mysql_configuration (#352 )
New Resource: azurerm_mysql_database (#352 )
New Resource: azurerm_mysql_firewall_rule (#352 )
New Resource: azurerm_mysql_server (#352 )

IMPROVEMENTS:

Updating the provider initialization & adding a skip_credentials_validation field


to the provider for some advanced scenarios (#322 )

0.2.1 (September 25, 2017)


FEATURES:

New Resource: azurerm_automation_account (#257 )


New Resource: azurerm_automation_credential (#257 )
New Resource: azurerm_automation_runbook (#257 )
New Resource: azurerm_automation_schedule (#257 )
New Resource: azurerm_app_service (#344 )

IMPROVEMENTS:

azurerm_client_config - adding service_principal_application_id (#348 )


azurerm_key_vault - adding application_id and certificate_permissions

(#348 )

BUG FIXES:

azurerm_virtual_machine_scale_set - fix panic with additional_unattend_config

block (#266 )

0.2.0 (September 15, 2017)


FEATURES:

Support for authenticating using the Azure CLI (#316 )


New Resource: azurerm_container_group (#333 ] [#311 ] [#338 )

IMPROVEMENTS:

azurerm_app_service_plan - support for Linux App Service Plans (#332 )


azurerm_postgresql_server - supporting additional storage sizes (#239 )
azurerm_public_ip - verifying the ID is valid before importing (#320 )
azurerm_sql_server - verifying the name is valid before creating (#323 )
resource_group_name - validation has been added to all resources that use this

attribute (#330 )

0.1.7 (September 11, 2017)


FEATURES:

New Resource: azurerm_postgresql_configuration (#210 )


New Resource: azurerm_postgresql_database (#210 )
New Resource: azurerm_postgresql_firewall_rule (#210 )
New Resource: azurerm_postgresql_server (#210 )

IMPROVEMENTS:

azurerm_cdn_endpoint - defaulting the http_port and https_port (#301 )


azurerm_cosmos_db_account : allow setting the Kind to

MongoDB/GlobalDocumentDB (#299 )

0.1.6 (August 31, 2017)


FEATURES:

New Data Source: azurerm_subscription (#285 )


New Resource: azurerm_app_service_plan (#1 )
New Resource: azurerm_eventgrid_topic (#260 )
New Resource: azurerm_key_vault_secret (#269 )

IMPROVEMENTS:

azurerm_image - added a default to the caching field (#259 )


azurerm_key_vault - validation for the name field (#270 )
azurerm_network_interface - support for multiple IP Configurations / setting the

Primary IP Configuration (#245 )


azurerm_resource_group - poll until the resource group is created (by migrating to

the Azure SDK for Go) (#289 )


azurerm_search_service - migrating to use the Azure SDK for Go (#283 )
azurerm_sql_* - ensuring deleted resources are detected (#289 ] / [#255 )
azurerm_sql_database - Import Support (#289 )
azurerm_sql_database - migrating to using the Azure SDK for Go (#289 )
azurerm_sql_firewall_rule - migrating to using the Azure SDK for Go (#289 )
azurerm_sql_server - added checks to handle name not being globally unique

(#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:

azurerm_cosmosdb_account - fixing the validation on the name field (#263 )


azurerm_sql_server - handle deleted servers correctly (#189 )
Fixing the Microsoft.Insights Resource Provider Registration (#282 )

0.1.5 (August 09, 2017)


IMPROVEMENTS:

azurerm_sql_* - upgrading to version 2014-04-01 of the SQL API's (#201 )


azurerm_virtual_machine - support for the Windows_Client Hybrid Use Benefit type

(#212 )
azurerm_virtual_machine_scale_set - support for custom images and managed

disks (#203 )

BUG FIXES:

azurerm_sql_database - fixing creating a DB with a PointInTimeRestore (#197 )


azurerm_virtual_machine - fix a crash when the properties for a network inteface

aren't returned (#208 )


azurerm_virtual_machine - changes to custom data should force new resource

(#211 )
azurerm_virtual_machine - fixes a crash caused by an empty

os_profile_windows_config block (#222 )


Checking to ensure the HTTP Response isn't nil before accessing it (fixes
(#200 ]) [#204 )

0.1.4 (July 26, 2017)


BUG FIXES:

azurerm_dns_* - upgrading to version 2016-04-01 of the Azure DNS API by

switching from Riviera -> Azure SDK for Go (#192 )

0.1.3 (July 21, 2017)


FEATURES:

New Resource: azurerm_dns_ptr_record (#141 )


New Resource: azurerm_image (#8 )
New Resource: azurerm_servicebus_queue (#151 )

IMPROVEMENTS:

azurerm_client_config - added a service_principal_object_id attribute to the

data source (#175 )


azurerm_search_service - added import support (#172 )
azurerm_servicebus_topic - added a status field to allow disabling the topic

(#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 )

0.1.2 (June 29, 2017)


FEATURES:

New Data Source: azurerm_managed_disk (#121 )


New Resource: azurerm_application_insights (#3 )
New Resource: azurerm_cosmosdb_account (#108 )
azurerm_network_interface now supports import (#119 )

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 ,

azurerm_network_security_group azurerm_public_ip , azurerm_resource_group ,


azurerm_route_table , azurerm_storage_account , azurerm_virtual_machine and
azurerm_virtual_network resources (#123 )
azurerm_redis_cache - now supports backup settings for Premium Redis Cache's

(#130 )
azurerm_storage_account - exposing a formatted Connection String for Blob access

(#142 )

BUG FIXES:

azurerm_cdn_endpoint - fixing update of the origin_host_header (#134 )


azurerm_container_service - exposes the FQDN of the master_profile as a

computed field (#125 )


azurerm_key_vault - fixing import / the validation on Access Policies (#124 )
azurerm_network_interface - Normalizing the location field in the state (#122 )
azurerm_network_interface - fixing a crash when importing a NIC with a Public IP

(#128 )
azurerm_network_security_rule : network_security_group_name is now ForceNew

(#138 )
azurerm_subnet now correctly detects changes to Network Securtiy Groups and

Routing Table's (#113 )


azurerm_virtual_machine_scale_set - making storage_profile_os_disk . name

optional (#129 )

0.1.1 (June 21, 2017)


BUG FIXES:

Sort ResourceID.Path keys for consistent output (#116 )

0.1.0 (June 20, 2017)


BACKWARDS INCOMPATIBILITIES / NOTES:

FEATURES:

New Data Source: azurerm_resource_group [#15022 ]


(https://github.com/hashicorp/terraform/pull/15022 )

IMPROVEMENTS:

Add diff supress func to endpoint_location [#15094 ]


(https://github.com/hashicorp/terraform/pull/15094 )
BUG FIXES:

Fixing the Deadlock issue (#6 )

Feedback
Was this page helpful?  Yes  No

Provide product feedback | Get help at Microsoft Q&A


Define resources with Bicep, ARM
templates, and Terraform AzAPI
provider
Article • 03/22/2023

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.

Terraform AzAPI provider


To learn about the Terraform AzAPI provider, see Overview of the Terraform AzAPI
provider.

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} .

For example, the SQL database reference content is available at:


https://learn.microsoft.com/azure/templates/microsoft.sql/servers/databases.

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:

See changes in versions


Each resource provider contains a list of changes for each API version. You can locate
the change log in the left navigation pane.

You might also like