Error installing provider "aws": stat /root/.netrc: permission denied`

Hi,

While running terraform init I receive the following error:

Initializing modules...
Initializing the backend...
	Successfully configured the backend "s3"! Terraform will automatically
	use this backend unless the backend configuration changes.
Initializing provider plugins...
	- Checking for available provider plugins...
	- Downloading plugin for provider "aws" (hashicorp/aws) 2.42.0...
Error installing provider "aws": stat /root/.netrc: permission denied

Command runs on behalf of Bamboo user. If I run the same command via ssh console using the same user - no issues.

What actually ‘terraform init’ calls internally which requires access to /root/.netrc ?

Thanks in advance

Hi @szemlyanoy,

Terraform accesses .netrc in order to see if there are credentials available for hosts it is accessing as part of initialization.

It looks like you are running Terraform as the Bamboo user but with the HOME environment variable still referring to the root user’s home directory. If you instead fix the value of HOME to refer to the correct home directory for that user, Terraform should look there for a .netrc file instead.

1 Like

thanks a lot, it was very helpful