【发布时间】:2021-11-13 10:48:45
【问题描述】:
我在以下设置中初始化 terraform s3 后端时遇到问题。这适用于 terraform 版本 0.11.15,但适用于 0.15.5 和 1.0.7。
有2个文件:
terraform.tf
provider "aws" {
region = "eu-west-1"
}
terraform {
backend "s3" {
}
}
resource "aws_s3_bucket" "this" {
bucket = "test-bucket"
acl = "private"
}
test-env.tfvars
encrypt = true
dynamodb_table = "terraform-test-backend"
bucket = "terraform-test-backend"
key = "terraform/deployment/test-release.tfstate"
region = "eu-west-1"
当我使用 terraform 0.11.15 运行 terraform init -backend-config=test-env.tfvars 时,它可以工作并且我可以执行 terraform apply。这是输出:
Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "aws" (2.70.0)...
* provider.aws: version = "~> 2.70"
但是当我尝试使用 0.15.5 和 1.0.7 版本时,我收到以下错误:
Error: error configuring S3 Backend: Error creating AWS session: CredentialRequiresARNError: credential type source_profile requires role_arn, profile default
任何想法如何解决它?
【问题讨论】:
标签: amazon-web-services terraform terraform-provider-aws terraform0.12+ terraform0.15