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

shared_credential_files in v4 broken? #23207

Closed
ericb-summit opened this issue Feb 15, 2022 · 4 comments · Fixed by #23282
Closed

shared_credential_files in v4 broken? #23207

ericb-summit opened this issue Feb 15, 2022 · 4 comments · Fixed by #23282
Assignees
Labels
authentication Pertains to authentication; to the provider itself of otherwise. enhancement Requests to existing resources that expand the functionality or scope.
Milestone

Comments

@ericb-summit
Copy link

ericb-summit commented Feb 15, 2022

As a follow-up to #23110, it seems to me shared_credential_files doesn't work in v4 as I think it should. I don't use env vars, I only use the likes of:

provider "aws" {
	region = "us-west-1"
	alias = "us-west-1"
	shared_credentials_file = "$HOME/.aws/credentials"
	profile = var.aws_profile
}

works for v3, which updates to this for v4:

provider "aws" {
	region = "us-west-1"
	alias = "us-west-1"
	shared_credentials_files = ["$HOME/.aws/credentials"]
	profile = var.aws_profile
}

With the shared_credentials_files specified as above, authentication fails. If I remove it, so that it defaults to the exact same value I explicitly specified, then it magically works. So other mysterious things changed in v4 authentication. I quote the latest docs that tell me it should work

image

Maybe $HOME expansion doesn't work in v4. Which is not a terrible limitation, except that it used to work in v3.

If you've somehow addressed this behaviour in some sneaky part of the docs that I missed I apologize, because I didn't see it.

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 15, 2022
@gdavison gdavison added authentication Pertains to authentication; to the provider itself of otherwise. bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Feb 15, 2022
@gdavison gdavison self-assigned this Feb 15, 2022
@gdavison gdavison added enhancement Requests to existing resources that expand the functionality or scope. and removed bug Addresses a defect in current functionality. labels Feb 16, 2022
@gdavison
Copy link
Contributor

gdavison commented Feb 16, 2022

Hi @ericb-summit, in previous versions, this accidentally worked, since it was falling back to the default shared credentials file when it couldn't find the requested file.

Expanding the environment variables is a good idea, though, so I've added it in hashicorp/aws-sdk-go-base#118. I also discovered we were no longer expanding ~ in paths and have fixed that.

@vadzimkaredzinkokoba
Copy link

@gdavison
problem exists in 4.1.0:

│ Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.
│
│ Please see https://registry.terraform.io/providers/hashicorp/aws
│ for more information about providing credentials.
│
│ Error: no EC2 IMDS role found, operation error ec2imds: GetMetadata, request send failed, Get "http://169.254.169.254/latest/meta-data/iam/security-credentials/": dial tcp 169.254.169.254:80: i/o timeout
│
│
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on main.tf line 13, in provider "aws":
│   13: provider "aws" {
│

after set pull path for "shared_credentials_files" problem not exists
terraform running on local pc with "shared_credentials_files = ["~/.aws/credentials"]"

@github-actions github-actions bot added this to the v4.2.0 milestone Feb 18, 2022
@github-actions
Copy link

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

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 have found a problem that seems similar to this, 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 May 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
authentication Pertains to authentication; to the provider itself of otherwise. enhancement Requests to existing resources that expand the functionality or scope.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants