command/show (json): marshal the state snapshot included with the plan file#21597
Merged
mildwonkey merged 2 commits intomasterfrom Jun 5, 2019
Merged
command/show (json): marshal the state snapshot included with the plan file#21597mildwonkey merged 2 commits intomasterfrom
mildwonkey merged 2 commits intomasterfrom
Conversation
The planfile contains a state snapshot with certain resources updated (outputs and datasources). Previously `terraform show -json PLANFILE` was using the current state instead of the state inside the plan as intended. This caused an issue when the state included a terraform_remote_state datasource. The datasource's state gets refreshed - and therefore upgraded to the current state version - during plan, but that won't persist to state until apply.
pselle
reviewed
Jun 4, 2019
apparentlymart
approved these changes
Jun 4, 2019
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A terraform planfile contains a state snapshot with certain resources updated
(those which get refreshed before plan, such as outputs and datasources).
Previously
terraform show -json $PLANFILEwas displaying the current state instead of the planfile's state.This caused an issue when the state included a
terraform_remote_statedatasource. The datasource's state gets refreshed - and therefore
upgraded to the current state version - during plan, but that won't
persist to state until apply.
In most cases, the json state parser can handle resources in state that haven't been upgraded yet. This particular problem is specific to
terraform_remote_statedatasources due to their unusual and unique schemas, which includecty.DynamicPseudoType- the decoder could not translate the older flatmap-style state without a preciseType