Relative Content

Tag Archive for azureterraform

Cosmos DB add multiple subnet IDs

Terraform does not make it easy to loop through subnet IDs. How can you add multiple subnet ids to the cosmos db azurerm resource virtual_network_rule block? I’m able to pass each subnet id, but this error shows up for all of them:

H to create and attach azure VM data disks to a azurerm_virtual_machine on a for_each loop

I struggle with the way terraform handles for each loops and counts, i cant seem to figure out how to utilize the locals block to achive this. How can i grab the data disks ids from the reosurce created from a for_each loop? The vm is also from a for_each loop, i cant seem to obtain the value of managed_disk_id to be passed down to the azurerm_virtual_machine_data_disk_attachment resource block.

Terraform Azure Key Vault Access Policy Create/Destroy Loop

Anyone ever run into an issue with terraform and azure key vault access policy? I have an issue where the key vault gets created with a module that sets some default access policies on the key vault. Then when I create another resource that needs to set the system assigned identity access to the key vault, like synapse for example. Terraform will add the azurerm_key_vault_access_policy once the resource is created, however, this will work on the first apply, after that the key vault module and azurerm_key_vault_access_policy will be in a destroy/recreate loop each time I plan depending on which was applied last.