Closed coterv closed 1 year ago
If I understand correctly, I think we're seeing expected terraform behavior here.
In step 2, omitting the routing_policy_id
optional attribute is the same thing as supplying routing_policy_id = null
In step 3, the try()
function winds up supplying the same value: routing_policy_id = null
Essentially, in both cases, we've opted out of supplying a value for an optional attribute. Terraform thinks we don't care about the value.
Terraform has no concept of a default routing policy - that choice is made (during initial RZ creation) by the Apstra API.
Changing the policy ID to a different value (whether it's the default policy ID or some user-created policy) should have the expected effect ... and we're still looking into #420.
Hi Chris, I apologize for the confusion earlier. For some reason I had misunderstood that omitting the routing_policy_id is not equivalent to asking for its removal, but rather to simply not providing this optional variable.
I have attempted to replace the initially assigned RP with another existing RP and the error outlined in https://github.com/Juniper/terraform-provider-apstra/issues/420 occurred as expected.
Therefore, I think we can close this issue and direct the focus to the issue at https://github.com/Juniper/terraform-provider-apstra/issues/420.
You're not the first to have been surprised by no "revert to default" behavior under these circumstances. I've seen it come up the Hashicorp Discuss server a few times.
From the provider standpoint, we don't even learn that you've eliminated the attribute because terraform concludes there's no work to do without ever invoking our Update()
method, so there's not much to do about it.
There's a huge asymmetry between "get the default policy by doing nothing" (on initial apply) and "get the default policy by jumping through hoops to learn it and then specifying it as an optional attribute" (on subsequent apply), and I can understand that it would be surprising/frustrating to bump into.
Environment
Brief description
When you attempt to remove / replace a route policy from a routing zone that was initially created with that routing policy, no changes are produced.
This issue may be related to that reported in https://github.com/Juniper/terraform-provider-apstra/issues/420.
Logs
Terraform change:
terraform.tfstate:
Terraform change:
terraform.tfstate:
Terraform change:
terraform.tfstate: