hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.85k stars 9.2k forks source link

d/aws_ami: warn when most_recent is true and filters are missing #40211

Closed jar-b closed 1 day ago

jar-b commented 2 days ago

Description

When most_recent is set to true and certain filtering criteria are missing, it's possible for this data source to return an image published by a third party. To bring visibility to this possibility in a non-breaking way, the provider will now append a warning diagnostic when an affected combination of arguments is detected.

For practitioners, the resulting diagnostic will look similar to the following:

image

Relations

Closes #40197

Output from Acceptance Testing

% make testacc PKG=ec2 TESTS=TestAccEC2AMIDataSource_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2AMIDataSource_'  -timeout 360m

--- PASS: TestAccEC2AMIDataSource_linuxInstance (11.17s)
--- PASS: TestAccEC2AMIDataSource_localNameFilter (11.37s)
--- PASS: TestAccEC2AMIDataSource_instanceStore (11.40s)
--- PASS: TestAccEC2AMIDataSource_productCode (11.55s)
--- PASS: TestAccEC2AMIDataSource_windowsInstance (12.23s)
--- PASS: TestAccEC2AMIDataSource_gp3BlockDevice (111.44s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ec2        116.580s
github-actions[bot] commented 2 days ago

Community Note

Voting for Prioritization

For Submitters

github-actions[bot] commented 22 hours ago

This functionality has been released in v5.77.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!