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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CT primitive batch_id plan modifiers #1017

Conversation

chrismarget-j
Copy link
Collaborator

The batch_id attribute represents the ID of the "batch" policy object associated with a Connectivity Template primitive.

Primitives which have children keep their child IDs in the "batch" policy object.

Primitives which do not have children do not have a "batch" policy object.

So, the state (null or not) of batch_id of a given primitive depends on whether that primitive has any child primitives.

Each primitive has a plan modifier which detected deletion of the last child, and set the batch_id from some value to null.

The original description is accurate: "preserves the the state value unless all child primitives have been removed, in which case null is planned"

The problem is we're only detecting the transition from value -> null. We don't detect the other side of it: Creation of the first child, in which case the batch_id needs to be updated from null to some known value.

This PR modifies the string plan modification logic of each child-capable primitive to ensure they handle switching between known and null and back again.

  • IpLink
  • BgpPeeringGenericSystem
  • BgpPeeringIpEndpoint
  • DynamicBgpPeering
  • VirtualNetworkSingle

@chrismarget-j chrismarget-j merged commit 6e1845f into main Jan 21, 2025
1 check passed
@chrismarget-j chrismarget-j deleted the 1012-provider-v079---inconsistent-plan-error-when-adding-routing-policy-primitive-to-ct-apstra-4211 branch January 21, 2025 16:17
@coterv
Copy link

coterv commented Jan 22, 2025

Hi,

Still facing the same issue described in #1012 in v0.79.1:

│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for module.blueprints.apstra_datacenter_connectivity_template_interface.ct_interface["MAIN_ALC1.IxC-FW_SRX"] to include new values learned so far during apply, provider "registry.terraform.io/juniper/apstra" produced an invalid new value for
│ .ip_links["ip_link_I-MANO"].batch_id: was null, but now cty.UnknownVal(cty.String).
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Thanks in advance!

@coterv
Copy link

coterv commented Jan 23, 2025

Issue resolved in v0.80.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provider v0.79 - Inconsistent Plan Error When Adding Routing Policy Primitive to CT (Apstra 4.2.1.1)
3 participants