Questions tagged [terraform-provider-azure]

This is the Azure provider for Terraform. The provider allows you to create and manage resources in Azure. This is done using the Azure resource manager, based on the REST API. See the full documentation. The source code is also available. There are a lot of examples available. The tests also have a lot of good complete terraform examples.

Before you submit a question be sure to check out the issue queue first.

When posting a question about a script be sure to include the full script with anything specific to your environment redacted such as subscription id and passwords. Include the output.

It is also helpful to tag the resource (ie [kubernetes]) you are working with for example if you are posting a question.

2143 questions
45
votes
4 answers

Terraform - A reference to resource type must be followed by at least one attribute access, specifying the resource name

I am trying to use terraform string function and string concatenation on a terraform tfvars variable. but when run the terraform plan it through the below exception Error: A reference to a resource type must be followed by at least one…
vashishth
  • 2,751
  • 4
  • 38
  • 68
41
votes
3 answers

Need to display sensitive data output variables in terraform

The following code snippet is my terraform configuration to create an Azure SignalR Service: output "signalrserviceconnstring" { value = azurerm_signalr_service.mysignalrservice.primary_connection_string description = "signalR service's primary…
Arash
  • 3,628
  • 5
  • 46
  • 70
40
votes
3 answers

How to ignore change of an attribute in block

I'm deploying web apps in Azure and I'd like to ignore changes to scm_type attribute within site_config block. During deployment the scm_type attribute set to None and later we are changing it to something different in Azure Portal. My current TF…
szymon
  • 830
  • 1
  • 7
  • 11
38
votes
3 answers

Terraform depends_on with modules

I'm new at terraform and I created a custom azure policies on module structure. each policy represents a custom module. One of the modules that I have created is enabling diagnostics logs for any new azure resource created. but, I need a storage…
monsal
  • 533
  • 1
  • 7
  • 11
29
votes
2 answers

Having the Terraform azure state file under different subscription

I have two subscriptions in Azure. Let's call them sub-dev and sub-prod. Under sub-dev I have resources for development (in a resource group rg-dev) and under sub-prod resources for production (in a resource group rg-prod). Now, I would like to have…
Juho Rutila
  • 2,316
  • 1
  • 25
  • 40
25
votes
5 answers

terraform helm release timeout while waiting for condition

I'm using terraform to provision some resources in azure and I can't seem to get helm to install nginx-ingress because it timeouts waiting for condition helm_release.nginx_ingress: 1 error(s) occurred: helm_release.nginx_ingress: rpc error: code =…
23
votes
5 answers

Error locking state: Error acquiring the state lock: state blob is already locked

I am getting this error when I try to do any operation: Error locking state: Error acquiring the state lock: state blob is already locked How can I list the people currently have a lock and how long the lock has been acquired for?
Allan Xu
  • 7,998
  • 11
  • 51
  • 122
23
votes
2 answers

Error: spawn terraform ENOENT during Azure Pipeline Terraform

When attempting to run terraform init as a task in an Azure Pipeline, it errors stating spawn C:\hostedtoolcache\windows\terraform\0.12.7\x64\terraform.exe ENOENT The installation appears fine, as basic functionality is verified during the install…
ti7
  • 16,375
  • 6
  • 40
  • 68
21
votes
3 answers

Using Terraform to import existing resources on Azure

I have an existing resource group on Azure with a VM running on it and have been playing around with Terraform to try and import the resource to my state file. I have set up a skeleton file, and as far as my understanding is once I import TF should…
17
votes
2 answers

Could not retrieve the list of available versions for provider Terraform Azure

Based on PR: https://github.com/terraform-providers/terraform-provider-azurerm/pull/5325 azurerm provider version 1.42.0 is required so as to by default install the cosmosdb account with server version 3.6. To achieve this i have added the below in…
Vaishnav
  • 611
  • 1
  • 9
  • 23
16
votes
3 answers

setting up terraform v0.14.0 on Apple M1

Any pointers how to setup Terraform v0.14.0 on a Apple M1 , as tfenv doesn't support v0.14.0 on Apple M1 tfenv install v0.14.0 Installing Terraform v0.14.0 Downloading release tarball from…
Avi
  • 1,453
  • 4
  • 18
  • 43
16
votes
1 answer

Optional block based on variable

I'm writing sort of wrapper module for azurerm_storage_account. azurerm_storage_account has optional block static_website { index_document = string error_404_document = string } I want to set it based on variable and I'm not really sure how can…
Edgar.A
  • 1,293
  • 3
  • 13
  • 26
14
votes
3 answers

How to specify .net core version with Terraform azurerm_app_service

Out of the box, I think azurerm_app_service provider does allow us to specify the .Net framework version, by utilising the dotnet_framework_version field. dotnet_framework_version - (Optional) The version of the .net framework's CLR used in this…
woodykiddy
  • 6,074
  • 16
  • 59
  • 100
14
votes
4 answers

How to configure environment variables in Hashicorp Terraform

I'm quite new to Terraform, though I have gone through all of the instructional modules available on Hashicorp's site. Currently, I'm struggling with understanding how to set up environment variables. I know how to reference variables in the…
Neal
  • 143
  • 1
  • 2
  • 6
14
votes
1 answer

Terraform azurerm_virtual_machine_extension

I'm using azurerm_virtual_machine_extension to bootstrap some virtual machines in azure. All examples i've found show using something similar to: settings = <
1
2 3
99 100