Open FrederikSuijs opened 3 years ago
This is the normal behavior. As a generic guideline, we do not define any default values for fields in the provider or the SDK. If you want to reset any field to its default value, you have to modify it yourself. This is to avoid re-writing fields that the provider might not be managing yet.
This also impacts object relationships. For example in an "aci_leaf_access_bundle_policy_group" resource you can optionally specify a relationship to a policy such as "relation_infra_rs_cdp_if_pol" and it will create that relationship.
Later if you change that value to null or an empty string, the relationship is not removed as one would expect. It is only possible to change the relationship to another valid policy.
Both the GUI and REST API support the removal of relationships. The inability to do this with the ACI provider is a concern for anyone wanting to use it for the ongoing management of objects vs their initial creation.
Resources created with plugin framework resolve this issue, however the plan output will not be rendered properly.
See details of render issue here: https://github.com/hashicorp/terraform/issues/31887#issuecomment-1958832973
Community Note
Terraform Version
terraform -v
Terraform v0.14.5
provider registry.terraform.io/ciscodevnet/aci v0.5.4
APIC version and APIC Platform
Affected Resource(s)
I have only tested with these two resources, but I am expecting all aci resources are affected by this behavior. I am trying to write some of my own aci resources and observe similar behavior.
Terraform Configuration Files
Debug Output
https://gist.github.com/FrederikSuijs/ff3f31f4ea27151b70dae69135b0f11f
Panic Output
Expected Behavior
After commenting out the description field during step 3, the plan should fall back to the default behavior. In this case the description field should be updated to an empty string, to be consistent to the state after step 1.
Actual Behavior
Nothing happens. The Terraform plan/apply seems to calculate a change is not required.
Steps to Reproduce
resource "aci_vrf" "debug_vrf" { //description = "created from terraform" name = "debug_vrf" tenant_dn = aci_tenant.debug_tenant.id }
terraform apply
resource "aci_vrf" "debug_vrf" { //description = "created from terraform" name = "debug_vrf" tenant_dn = aci_tenant.debug_tenant.id }