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

Create and Delete actions for output plans #27512

Merged
merged 2 commits into from
Jan 14, 2021
Merged

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented Jan 14, 2021

The planning logic here was inspired by resources, but unlike resources
a null value is valid for an output and does not necessarily indicate it
is being removed. If both before and after are null, the change should
be NoOp. When an output is removed from the configuration, we have a
separate node to create a Delete action to remove it from the state.

Rather than using a prior value of null to indicate Create, which is
imprecise because null is a valid output value, only plan values that
didn't exist in the prior state as Create changes.

Fixes #27490

The planning logic here was inspired by resources, but unlike resources
a null value is valid for an output and does not necessarily indicate it
is being removed. If both before and after are null, the change should
be NoOp. When an output is removed from the configuration, we have a
separate node to create a Delete action to remove it from the state.
@jbardin jbardin requested a review from a team January 14, 2021 14:28
@codecov
Copy link

codecov bot commented Jan 14, 2021

Codecov Report

Merging #27512 (191124e) into master (0a08603) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted Files Coverage Δ
terraform/node_output.go 76.28% <100.00%> (ø)
terraform/node_resource_plan.go 96.11% <0.00%> (-1.95%) ⬇️
states/statefile/version4.go 57.96% <0.00%> (-0.24%) ⬇️

@jbardin jbardin force-pushed the jbardin/output-plans branch from d8d982c to ed981c5 Compare January 14, 2021 14:31
Copy link
Contributor

@mildwonkey mildwonkey left a comment

Choose a reason for hiding this comment

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

Makes sense to me!

Rather than using a prior value of null to indicate create, which is
imprecise because null is a valid output value, only plan values that
didn't exist in the prior state as Create changes.
@jbardin jbardin force-pushed the jbardin/output-plans branch from ed981c5 to 191124e Compare January 14, 2021 15:54
@jbardin jbardin merged commit 68b65cc into master Jan 14, 2021
@jbardin jbardin deleted the jbardin/output-plans branch January 14, 2021 16:09
@alloveras
Copy link
Contributor

Would this fix be backported to the next Terraform 0.14 release (e.g: 0.14.6)? It is already listed as a fix on the CHANGELOG.md for 0.15.0 but there is no mention of it in 0.14.6 🤔

@jbardin
Copy link
Member Author

jbardin commented Feb 1, 2021

Hi @alloveras,

This wasn't immediately backported because it wasn't a critical issue blocking any 0.14 functionality.
After closer inspection, this appears to be fairly low risk, and should be be OK to backport into the next release.

Thanks!

@ghost
Copy link

ghost commented Feb 14, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Feb 14, 2021
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.

Conditional output of null causes permanent 'hidden' diff in plans
3 participants