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

b/aws_caller_identity: fix error when sts_region is different from default_region #35860

Merged
merged 5 commits into from
Feb 16, 2024

Conversation

johnsonaj
Copy link
Contributor

Description

Error: SignatureDoesNotMatch: Credential should be scoped to a valid region.

% AWS_DEFAULT_REGION=us-west-2 AWS_ALTERNATE_REGION=us-east-1 make testacc TESTARGS='-run=TestAccSTSCallerIdentityDataSource_stsRegion' PKG=sts

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sts/... -v -count 1 -parallel 20  -run=TestAccSTSCallerIdentityDataSource_stsRegion -timeout 360m
    caller_identity_data_source_test.go:47: Step 1/1 error: Error running pre-apply plan: exit status 1

        Error: reading STS Caller Identity

          with data.aws_caller_identity.current,
          on terraform_plugin_test.tf line 21, in data "aws_caller_identity" "current":
          21: data "aws_caller_identity" "current" {}

        operation error STS: GetCallerIdentity, https response error StatusCode: 403,
        RequestID: fe4eadc7-14ba-4419-92e5-18c95845c089, api error
        SignatureDoesNotMatch: Credential should be scoped to a valid region.
--- FAIL: TestAccSTSCallerIdentityDataSource_stsRegion (3.90s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/sts	11.052s
FAIL
make: *** [testacc] Error 1

Relations

Closes #34865

References

Output from Acceptance Testing

% AWS_DEFAULT_REGION=us-west-2 AWS_ALTERNATE_REGION=us-east-1 make testacc TESTARGS='-run=TestAccSTSCallerIdentityDataSource_' PKG=sts

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sts/... -v -count 1 -parallel 20  -run=TestAccSTSCallerIdentityDataSource_ -timeout 360m
--- PASS: TestAccSTSCallerIdentityDataSource_basic (6.57s)
--- PASS: TestAccSTSCallerIdentityDataSource_stsRegion (15.27s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/sts	22.641s

Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/sts Issues and PRs that pertain to the sts service. labels Feb 16, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Feb 16, 2024
@johnsonaj johnsonaj added the regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. label Feb 16, 2024
@johnsonaj johnsonaj added the bug Addresses a defect in current functionality. label Feb 16, 2024
Copy link
Member

@jar-b jar-b 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_DEFAULT_REGION=us-west-2 AWS_ALTERNATE_REGION=us-east-1 make testacc TESTARGS='-run=TestAccSTSCallerIdentityDataSource_' PKG=sts
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sts/... -v -count 1 -parallel 20  -run=TestAccSTSCallerIdentityDataSource_ -timeout 360m

=== RUN   TestAccSTSCallerIdentityDataSource_basic
=== PAUSE TestAccSTSCallerIdentityDataSource_basic
=== RUN   TestAccSTSCallerIdentityDataSource_alternateRegion
=== PAUSE TestAccSTSCallerIdentityDataSource_alternateRegion
=== CONT  TestAccSTSCallerIdentityDataSource_basic
=== CONT  TestAccSTSCallerIdentityDataSource_alternateRegion
--- PASS: TestAccSTSCallerIdentityDataSource_basic (6.94s)
--- PASS: TestAccSTSCallerIdentityDataSource_alternateRegion (15.37s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/sts        22.432s

@johnsonaj johnsonaj merged commit c7a8936 into main Feb 16, 2024
37 checks passed
@johnsonaj johnsonaj deleted the b-caller_identity_data_source_sts branch February 16, 2024 20:35
@github-actions github-actions bot added this to the v5.38.0 milestone Feb 16, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Feb 23, 2024
Copy link

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

Copy link

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 Mar 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/sts Issues and PRs that pertain to the sts 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
Development

Successfully merging this pull request may close these issues.

[Bug]: Region in Authorization (signature) header doesn't follow sts_region
2 participants