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

core: Fix handling of individual map keys in ignore_changes #21788

Merged
merged 2 commits into from
Jun 19, 2019

Conversation

apparentlymart
Copy link
Contributor

@apparentlymart apparentlymart commented Jun 18, 2019

For Terraform 0.12 we had intended to start supporting ignoring individual map keys such as individual tags in a tags map. Unfortunately some later changes to HCL's parser inadvertently broke that behavior, so at release referring to a map key in ignore_changes would lead to an error:

Error: Invalid expression

  on example.tf line 12, in resource "null_resource" "example":
  73:         tags["Name"],

A static variable reference is required.

The main fix here was in HCL itself, so this PR begins with a vendor update to include that fix, but then also includes a documentation update to explain how this works and the addition/removal caveat that applies to it, along with a test for this specific behavior to reduce the risk of this inadvertently regressing again in the future.

This closes #6632 and closes #21433.

This includes a fix to make sure that an expression with a static string
index, like foo["bar"], will be parsed as a traversal rather than as a
dynamic index expression.
This also includes a previously-missing test that verifies the behavior
described here, implemented as a planning context test for consistency
with how the other ignore_changes tests are handled.
@apparentlymart apparentlymart requested a review from a team June 18, 2019 23:12
@apparentlymart apparentlymart self-assigned this Jun 18, 2019
@apparentlymart apparentlymart merged commit 1bba574 into master Jun 19, 2019
@apparentlymart apparentlymart deleted the b-ignore-changes-index branch June 19, 2019 00:37
@llomgui
Copy link

llomgui commented Jul 8, 2019

@apparentlymart This PR does not fix the issue #21433

@ghost
Copy link

ghost commented Jul 24, 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.

@ghost ghost locked and limited conversation to collaborators Jul 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lifecycle / ignore_changes blocking upgrade from 0.11 to 0.12 Ignore changes for a single AWS Resource Tag
3 participants