在阅读Terraform上的文档时,它说有3种查找AWS凭证的选项:
我试图让我的设置仅使用凭据文件。我检查了是否清除了环境变量,并在Terraform中将相关变量留为空白。
当我这样做并运行“Terraform Plan”时,出现错误:
我什至尝试将凭据文件的位置添加到我的提供程序块中,但这也无济于事:
provider "aws" {
region = "${var.region}"
profile = "${var.profile}"
shared_credentials_file = "/Users/david/.aws/credentials"
profile = "testing"
}
我缺少使Terraform读取此文件并且不需要环境变量的东西吗?
最佳答案
我测试了Terraform v0.6.15
及其正常工作。
问题必须是profile
。检查以下内容。
1.从提供商中删除2个profile
标签。
provider "aws" {
region = "${var.region}"
shared_credentials_file = "/Users/david/.aws/credentials"
profile = "testing"
}
2.确保您的凭据文件
/Users/david/.aws/credentials
采用以下格式,其中testing
是您在profile
中指定的provider "aws"
[testing]
aws_access_key_id = *****
aws_secret_access_key = *****
关于amazon-web-services - 找不到Terraform AWS凭证文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36990299/