I have a very simple need - I want to run terraform from client and keep the state file in S3. Here is what I am trying to do
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.73.0"
}
}
required_version = ">= 0.14.1"
}
provider "aws" {
region = "us-east-1"
assume_role {
role_arn = "arn:aws:iam::12345678901:role/test-cicd-role"
}
}
backend.tfvars:
bucket = "cicd-testing-stuff"
key ="cicd-test-aa/terraform.tfstate"
$ terraform init -backend-config="backend.tfvars"
Initializing the backend...
╷
│ Error: error configuring S3 Backend: no valid credential sources for S3 Backend found.
│
│ Please see https://www.terraform.io/docs/language/settings/backends/s3.html
│ for more information about providing credentials.
│
│ Error: NoCredentialProviders: no valid providers in chain. Deprecated.
│ For verbose messaging see aws.Config.CredentialsChainVerboseErrors
Just as an FYI, it is in the same account. Is using the access keys the only option ?