Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commenting out optional parameter is not properly reflected in TF plan #202

Open
FrederikSuijs opened this issue Feb 1, 2021 · 3 comments
Labels
wontfix This will not be worked on

Comments

@FrederikSuijs
Copy link

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

terraform -v
Terraform v0.14.5
provider registry.terraform.io/ciscodevnet/aci v0.5.4

APIC version and APIC Platform

  • v4.1.1 and all

Affected Resource(s)

  • aci_tenant
  • aci_vrf
  • aci_???

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

terraform {
  required_providers {
    aci = {
      source  = "CiscoDevNet/aci"
      version = "0.5.4"
    }
  }
}

provider "aci" {
 username = "admin"
 password = "ciscopsdt"
 url      = "https://sandboxapicdc.cisco.com"
 insecure = true
}

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

  1. Create resources
resource "aci_tenant" "debug_tenant" {
    //description = "created from terraform"
    name = "debug_tenant"
}

resource "aci_vrf" "debug_vrf" {
    //description = "created from terraform"
    name = "debug_vrf"
    tenant_dn = aci_tenant.debug_tenant.id
}

terraform apply

  1. Uncomment description
resource "aci_tenant" "debug_tenant" {
    description = "created from terraform"
    name = "debug_tenant"
}

resource "aci_vrf" "debug_vrf" {
    description = "created from terraform"
    name = "debug_vrf"
    tenant_dn = aci_tenant.debug_tenant.id
}

terraform apply

  1. Recomment description
resource "aci_tenant" "debug_tenant" {
    //description = "created from terraform"
    name = "debug_tenant"
}

resource "aci_vrf" "debug_vrf" {
    //description = "created from terraform"
    name = "debug_vrf"
    tenant_dn = aci_tenant.debug_tenant.id
}

terraform apply

Important Factoids

Not applicable

References

  • #0000
@lhercot
Copy link
Member

lhercot commented May 19, 2021

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.

@lhercot lhercot added the wontfix This will not be worked on label May 19, 2021
@andbyrne
Copy link

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.

@akinross
Copy link
Collaborator

Resources created with plugin framework resolve this issue, however the plan output will not be rendered properly.

See details of render issue here: hashicorp/terraform#31887 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants