Open IEP-Brewin opened 3 months ago
@IEP-Brewin This is not a AzureRM issue, this is the Terraform feature. You can use toset
instead of the default tolist
to bypass this issue
output "identity" {
value = toset(azurerm_mssql_server.example.identity)
}
I think I might have confused the situation by adding the output to the example code. Please disregard it. Then run a plan and apply to see the behaviour.
Cannot reproduce this error. Nothing happens. The diff only occurs when output
enabled.
How come this is a Terraform 'feature'? Output shouldnt affect idempotency at all... I am returning entire sqlserver object so cant do toset() even if it helps..
EDIT: toset() doesnt seem to work to me at all anyway.
What seem to happen is that output of identity looks as follow after first run:
"identity": [
{ "identity_ids" : null,
"principal_id" : "43834679847-4324-243-242-24"
"tenant_id" : "87fd6f-df-23-fdsf-2-fs"
"type": "SystemAssigned"
}
]
After resource is created and you do plan/apply again "identity_ids" will change from null to []. Any subsequent apply will not introduce any further changes.
I tried:
"identity": {
type = "SystemAssigned"
identity_ids = []
}
but that doesnt work either ;/
EDIT 2: Seems same issue was spotted for azurem_app_service:
https://github.com/hashicorp/terraform-provider-azurerm/issues/13212
Is there an existing issue for this?
Community Note
Terraform Version
1.9.1
AzureRM Provider Version
3.110.0
Affected Resource(s)/Data Source(s)
azurerm_mssql_server
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
The Terraform plan (after apply) should not show anything new.
Actual Behaviour
The Terraform planTerraform plan shows...
~identity {
identity_ids = [] }
(after apply) should not show anything new.
Steps to Reproduce
Terraform Apply Terraform plan
Important Factoids
Identity = SystemAssigned
References
Looks similar to issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/19216