- Unzip example.zip from https://www.dropbox.com/s/2yd3d8d642cotc0/example.zip?dl=0
- Update main.tf file to include
tenant_id
andsubscription_id
values for an Azure subscription az login --tenant <tenant_id>
terraform init
terraform apply
, which creates the base of the example resources:
example-rg
resource groupexample-vnet
virtual networksubnet1
subnet (with Storage and Key Vault service endpoints)exampleXXXXXXXXX
storage accountexampleXXXXXXXXX
key vault
The purpose of this test is to show that when adding a subnet and using concat()
, both Storage Account and Key Vault virtual network subnet ids are updated with the new subnet.
Before beginning review the main.tf
in the region
module folder. Note the virtual_network_subnet_ids
property of the storage account and key vault resources is using a concat()
function to combine a for value in
and list(string)
object.
- Uncomment
subnet2
definition inconfig.auto.tfvars
file terraform plan
Note 1 resource will be added (subnet2
), and 2 resources will be updated (storage account and key vault virtual network subnet ids). This is expected behavior.
The purpose of this test is to show that when adding a subnet and using concat()
and distinct()
, only the Key Vault virtual network subnet ids are updated with the new subnet. The Storage Account virtual network subnet ids do not detect a change.
- Open the
main.tf
file in theregion
module folder. - Uncomment the
Test 2
scenariovirtual_network_subnet_ids
property for the Storage Account and Key Vault terraform plan
Note 1 resource will be added (subnet2
), and only 1 resource will be updated (the key vault). This behavior is unexpected. The expected behavior it to see 2 resources updated (the storage account and the key vault).
The purpose of these tests is to show that when distinct()
and compact()
are used, only the Key Vault virtual network subnet ids are updated with the new subnet. The Storage Account virtual network subnet ids do not detect a change.
Follow the same process as test 2 to see the same results.