配置 Terraform S3 后端时出错 [英] Error while configuring Terraform S3 Backend

查看:30
本文介绍了配置 Terraform S3 后端时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 terraform 为 AWS 配置 S3 后端.

I am configuring S3 backend through terraform for AWS.

terraform {
  backend "s3" {}
}

提供(S3 后端)存储桶名称、密钥和的值运行terraform init"命令的区域,出现以下错误

On providing the values for (S3 backend) bucket name, key & region on running "terraform init" command, getting following error

"配置后端s3"时出错:未找到适用于 AWS 提供商的有效凭证源.请参阅 https://terraform.io/docs/providers/aws/index.html 了解有关为 AWS 提供商提供凭证的更多信息请更新 Terraform 文件中的配置以修复此错误然后再次运行此命令."

"Error configuring the backend "s3": No valid credential sources found for AWS Provider. Please see https://terraform.io/docs/providers/aws/index.html for more information on providing credentials for the AWS Provider Please update the configuration in your Terraform files to fix this error then run this command again."

我已声明访问 &密钥作为 providers.tf 中的变量.在运行terraform init"命令时,它没有提示任何访问密钥或秘密密钥.

I have declared access & secret keys as variables in providers.tf. While running "terraform init" command it didn't prompt any access key or secret key.

如何解决这个问题?

推荐答案

在运行 terraform init 时,您必须为您的凭据添加 -backend-config 选项(aws键).所以你的命令应该是这样的:

When running the terraform init you have to add -backend-config options for your credentials (aws keys). So your command should look like:

terraform init -backend-config="access_key=<您的访问密钥>"-backend-config="secret_key=<你的密钥>"

这篇关于配置 Terraform S3 后端时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆