-
Notifications
You must be signed in to change notification settings - Fork 232
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
Adding test coverage for changes to ignore data sources in imported state #1077
Conversation
e477ed9
to
86ba558
Compare
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.
Overall looks good, just one minor bit about how we pinpoint specific resource instances in the testing framework. 👍
@@ -1738,43 +1923,41 @@ func composeImportStateCheck(fs ...ImportStateCheckFunc) ImportStateCheckFunc { | |||
} | |||
} | |||
|
|||
func testExtractResourceAttrInstanceState(attributeName string, attributeValue *string) ImportStateCheckFunc { | |||
func testExtractResourceAttrInstanceState(id, attributeName string, attributeValue *string) ImportStateCheckFunc { |
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.
Nit: Instead of fetching via the internal identifier (typically the id
attribute, but not necessarily guaranteed) can we instead use the resource address string? e.g. random_string.example
Reasons being:
- This is how other testing framework "check" functions generally work
- Resources such as this one may have duplicate resource instances with the same id
- We're looking at making id less special in #1072
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.
Not sure how we use resource address when we're using a type ImportStateCheckFunc func([]*terraform.InstanceState) error
as *terraform.InstanceState
just has the ID
and Attributes
and doesn't appear to have any reference to the resource address.
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.
Sigh, more trouble than its worth then (e.g. mapping those instance states with the resource addresses). We'll be removing these terraform
bits when we take a look at the next iteration of the test framework and this isn't exported, so fine for now.
Please note this also needs a changelog entry before merge. |
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. |
References: #1074
Closes: #1066
Closes: #1074
Changes in this PR are to accompany changes in #1074.@gdavison feel free to pull these changes into your PR and we can merge it all in together.
Tests in this PR fail as expected, require changes in #1074 to pass.I've cherry-picked @gdavison's changes from #1074 into this PR.