I have a very simple module using AWS (4.50.0) with terraform 1.3.7 with AWS credentials configured locally under a profile (e.g. “myprofile”)
When running with local state, all AWS commands use the profile correctly and succeed, however when I try to move the state to S3 using the same profile I get this error:
Error: error configuring S3 Backend: no valid credential sources for S3 Backend found.
Please see Backend Type: s3 | Terraform | HashiCorp Developer
for more information about providing credentials.Error: NoCredentialProviders: no valid providers in chain. Deprecated.
For verbose messaging see aws.Config.CredentialsChainVerboseErrors
The module looks basically like this, which works fine in other projects using an older terraform version (0.14)
provider "aws" {
profile = "myprofile"
}
terraform {
backend "s3" {
bucket = "mybucket"
key = "terraform/blah/foo.tfstate"
region = "us-west-2"
profile = "myprofile"
encrypt = true
}
}