-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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: treat refs to unknown set resource attrs as unknown #4840
core: treat refs to unknown set resource attrs as unknown #4840
Conversation
@@ -519,6 +519,10 @@ func (i *Interpolater) interpolateListAttribute( | |||
log.Printf("[DEBUG] Interpolating computed list attribute %s (%s)", | |||
resourceID, attr) | |||
|
|||
if attr == config.UnknownVariableValue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a comment help here? Maybe slightly rhetorical since I'm unsure at first glance as an outsider to this PR why this behavior needs to be here. At least covered by tests! :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call - done in 48b172a
References to computed list-ish attributes (set, list, map) were being improperly resolved as an empty list `[]` during the plan phase (when the value of the reference is not yet known) instead of as an UnknownValue. A "diffs didn't match" failure in an AWS DirectoryServices test led to this discovery (and this commit fixes the failing test): https://travis-ci.org/hashicorp/terraform/jobs/104812951 Refs #2157 which has the original work to support computed list attributes at all. This is just a simple tweak to that work. /cc @radeksimko
65d000d
to
48b172a
Compare
@mitchellh look better w/ the comments? |
} | ||
|
||
// Otherwise we gather the values from the list-like attribute and return | ||
// them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before the above guard, we'd plow right into the list building below even when the whole list was computed and end up returning an empty list, which was wrong.
LGTM |
…et-references-properly core: treat refs to unknown set resource attrs as unknown
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. |
References to computed list-ish attributes (set, list, map) were being
improperly resolved as an empty list
[]
during the plan phase (whenthe value of the reference is not yet known) instead of as an
UnknownValue.
A "diffs didn't match" failure in an AWS DirectoryServices test led to
this discovery (and this commit fixes the failing test):
https://travis-ci.org/hashicorp/terraform/jobs/104812951
Refs #2157 which has the original work to support computed list
attributes at all. This is just a simple tweak to that work.
/cc @radeksimko