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

resource/aws_instance: Handle regions where instance metadata tags are unsupported #26631

Merged
merged 2 commits into from
Sep 6, 2022

Conversation

gdavison
Copy link
Contributor

@gdavison gdavison commented Sep 2, 2022

Some AWS regions, such as me-central-1 do not currently support Instance Metadata Tags. The default value supplied by the provider was causing the provider to fail in some cases.

Closes #26561

Output from acceptance testing:

Previously:

$ AWS_REGION=me-central-1 make testacc PKG=ec2 TESTS=TestAccEC2Instance_metadataOptions

        Error: updating EC2 Instance (i-abc123) metadata options: UnsupportedOperation: Specifying InstanceMetadataTags is not yet supported in this region.

Now (changing expected instance_metadata_tags to "")

--- PASS: TestAccEC2Instance_metadataOptions (291.19s)

Relates #25227.
Relates #25778.

@github-actions github-actions bot added service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/S Managed by automation to categorize the size of a PR. labels Sep 2, 2022
@gdavison gdavison marked this pull request as ready for review September 3, 2022 00:26
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

% AWS_REGION=me-central-1 make testacc PKG=ec2 TESTS=TestAccEC2Instance_metadataOptions
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2Instance_metadataOptions'  -timeout 180m
=== RUN   TestAccEC2Instance_metadataOptions
=== PAUSE TestAccEC2Instance_metadataOptions
=== CONT  TestAccEC2Instance_metadataOptions
    ec2_instance_test.go:4389: Step 1/4 error: Check failed: 1 error occurred:
        	* Check 6/6 error: aws_instance.test: Attribute 'metadata_options.0.instance_metadata_tags' expected "disabled", got ""
        
--- FAIL: TestAccEC2Instance_metadataOptions (330.28s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	335.603s
FAIL
make: *** [testacc] Error 1
% make testacc PKG=ec2 TESTS=TestAccEC2Instance_metadataOptions 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2Instance_metadataOptions'  -timeout 180m
=== RUN   TestAccEC2Instance_metadataOptions
=== PAUSE TestAccEC2Instance_metadataOptions
=== CONT  TestAccEC2Instance_metadataOptions
--- PASS: TestAccEC2Instance_metadataOptions (182.12s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	186.002s

@gdavison gdavison merged commit 4b089b5 into main Sep 6, 2022
@gdavison gdavison deleted the b-unsupported-instance-metadata-tags branch September 6, 2022 18:07
@github-actions github-actions bot added this to the v4.30.0 milestone Sep 6, 2022
@github-actions
Copy link

github-actions bot commented Sep 9, 2022

This functionality has been released in v4.30.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!

@github-actions
Copy link

github-actions bot commented Oct 9, 2022

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 issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/ec2 Issues and PRs that pertain to the ec2 service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
2 participants