-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
awsproviderlint: New Check: Prefer aws_ami data source instead of hardcoded Amazon Machine Image identifiers #12994
Comments
There are some configuration generator functions available for common AMIs: |
@YakDriver this looks really close to complete, do you think we could get this turned on this week? $ awsproviderlint -AWSAT002 ./aws
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_instance_test.go:3836:46: AWSAT002: AMI IDs should not be hardcoded
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_instance_test.go:4308:53: AWSAT002: AMI IDs should not be hardcoded
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/validators_test.go:1182:14: AWSAT002: AMI IDs should not be hardcoded |
@YakDriver I feel like there may have been one very special instance test that was setup to cover a very specific regression due to the block setup of a specific AMI, which might be that one -- if I'm remembering that correctly (or |
@bflad The exciting #15143 PR fixes:
|
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Description
To ensure test configurations are region and partition agnostic, any hardcoded AMI identifiers (ami-[a-f0-9]{8,17}) should be replaced with the
aws_ami
data source.This check was added in #14031 and is AWSAT002. We'll keep this issue open while fixes are made that are identified by the check.
Flagged Code
In test configuration:
Passing Code
In test configuration:
To Do
The text was updated successfully, but these errors were encountered: