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

Add the deferred changes into the plan #34946

Merged
merged 3 commits into from
Apr 5, 2024

Conversation

liamcervante
Copy link
Member

This PR adds any changes deferred during the plan into the produced plan artefact. We place the changes into a new field called DeferredResources alongside the existing drifted resources and changed resources.

I've added the representation of a wildcard instance key ([*]) into the AbsResourceInstance address, so we can represent unknown instances in the same way as other instances that are being deferred for other reasons. As this is only written into a new field that isn't referenced anywhere yet this shouldn't cause any breaking changes.

I've refactored the existing deferrals package so that it accepts and tracks the complete changes that can be written into the plan at the end instead of the partial information it was tracking before.

@liamcervante liamcervante requested a review from a team April 4, 2024 14:41
Copy link
Contributor

@DanielMSchmidt DanielMSchmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@liamcervante liamcervante merged commit 28797e7 into main Apr 5, 2024
6 checks passed
@liamcervante liamcervante deleted the liamcervante/deferred-actions-in-plan branch April 5, 2024 08:34
Copy link
Contributor

github-actions bot commented Apr 5, 2024

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

// WildcardKey represents the "unknown" value of an InstanceKey. This is used
// within the deferral logic to express absolute module and resource addresses
// that are not known at the time of planning.
var WildcardKey InstanceKey = StringKey("*")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While unlikely, "*" is a valid instance key on its own. Is it possible that could collide here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would only be set when combined with the DeferredReasonInstanceCountUnknown reason. That reason will never have a "valid" instance key associated with it. I've used this just as a convenience for when the address is rendered, in reality nothing should attempt to parse an address from a deferred change with the mentioned reason as the value in there is inherently meaningless.

Copy link
Contributor

github-actions bot commented May 6, 2024

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants