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

Acceptance tests do not source region from named profile #25624

Open
gdavison opened this issue Jun 30, 2022 · 0 comments · May be fixed by #25692
Open

Acceptance tests do not source region from named profile #25624

gdavison opened this issue Jun 30, 2022 · 0 comments · May be fixed by #25692
Labels
authentication Pertains to authentication; to the provider itself of otherwise. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.

Comments

@gdavison
Copy link
Contributor

When using the environment variable AWS_PROFILE to authenticate with a named profile, the acceptance tests retrieve the correct credentials but do not use the region configured on the profile.

For example, with

~/.aws/credentials

[example]
aws_access_key_id = ...
aws_secret_access_key = ...
region = <some region>

I get

$ AWS_PROFILE=example make testacc PKG=ecs TESTS=TestAccECSService_

    service_test.go:566: Step 1/2 error: Error running pre-apply refresh: exit status 1
        
        Error: Invalid provider configuration
        
        Provider "registry.terraform.io/hashicorp/aws" requires explicit
        configuration. Add a provider block to the root module and configure the
        provider's required arguments as described in the provider documentation.
        
        
        Error: error configuring Terraform AWS Provider: error validating provider credentials: error calling sts:GetCallerIdentity: operation error STS: GetCallerIdentity, https response error StatusCode: 403, RequestID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, api error InvalidClientTokenId: The security token included in the request is invalid.

Passing the region in AWS_REGION is a workaround.

@ewbankkit ewbankkit added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. authentication Pertains to authentication; to the provider itself of otherwise. labels Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authentication Pertains to authentication; to the provider itself of otherwise. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants