ti_*_*key 4 credentials amazon-web-services terraform
我正在将shared_cred_file用于aws提供商。以 aws 提供程序版本 3.63 为例,terraform plan 效果很好。
\n当我使用 aws 提供程序 4.0 时,它提示我对共享凭证文件使用应用更改设置。修改后没有报错,但还是第二个错误
\n可能是什么问题呢?
\nWarning: Argument is deprecated\n\xe2\x94\x82\n\xe2\x94\x82 with provider[\xe2\x80\x9cregistry.terraform.io/hashicorp/aws\xe2\x80\x9d],\n\xe2\x94\x82 on main.tf line 15, in provider \xe2\x80\x9caws\xe2\x80\x9d:\n\xe2\x94\x82 15: shared_credentials_file = \xe2\x80\x9c~/.aws/credentials\xe2\x80\x9d\n\xe2\x94\x82\n\xe2\x94\x82 Use shared_credentials_files instead.\n\xe2\x94\x82\n\xe2\x94\x82 (and one more similar warning elsewhere)\n\xe2\x95\xb5\n\xe2\x95\xb7\n\xe2\x94\x82 Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.\n\xe2\x94\x82\n\xe2\x94\x82 Please see https://registry.terraform.io/providers/hashicorp/aws\n\xe2\x94\x82 for more information about providing credentials.\n\xe2\x94\x82\n\xe2\x94\x82 Error: no EC2 IMDS role found, operation error ec2imds: GetMetadata, canceled, context deadline exceeded\n\xe2\x94\x82\n\xe2\x94\x82\n\xe2\x94\x82 with provider[\xe2\x80\x9cregistry.terraform.io/hashicorp/aws\xe2\x80\x9d],\n\xe2\x94\x82 on main.tf line 13, in provider \xe2\x80\x9caws\xe2\x80\x9d:\n\xe2\x94\x82 13: provider \xe2\x80\x9caws\xe2\x80\x9d {\n\xe2\x94\x82\nRun Code Online (Sandbox Code Playgroud)\n///////////////////////////////\n// Infrastructure init\nterraform {\n backend "s3" {\n bucket = "monitoring-********-infrastructure"\n key = "tfstates/********-non-prod-rds-info.tfstate"\n profile = "test-prof"\n region = "eu-west-2"\n shared_credentials_file = "~/.aws/credentials"\n }\n}\n\n provider "aws" {\n profile = "test-prof"\n shared_credentials_files = ["~/.aws/credentials"]\n region = "eu-west-2"\n }\nRun Code Online (Sandbox Code Playgroud)\n Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.\n \xe2\x94\x82\n \xe2\x94\x82 Please see https://registry.terraform.io/providers/hashicorp/aws\n \xe2\x94\x82 for more information about providing credentials.\n \xe2\x94\x82\n \xe2\x94\x82 Error: no EC2 IMDS role found, operation error ec2imds: GetMetadata, canceled, context deadline exceeded\n \xe2\x94\x82\n \xe2\x94\x82\n \xe2\x94\x82 with provider["registry.terraform.io/hashicorp/aws"],\n \xe2\x94\x82 on main.tf line 13, in provider "aws":\n \xe2\x94\x82 13: provider "aws" {\n\nRun Code Online (Sandbox Code Playgroud)\n猫配置
\n[test-prof]\noutput = json\nregion = eu-west-2\nRun Code Online (Sandbox Code Playgroud)\n猫凭证
\n[test-prof]\naws_access_key_id = ****************\naws_secret_access_key = ******************\nRun Code Online (Sandbox Code Playgroud)\n
小智 5
根据最新的 Terraform 文档,这就是它的工作方式,
provider "aws" {
region = "us-east-1"
shared_credentials_files = ["%USERPROFILE%/.aws/credentials"]
profile = "customprofile"
}
Run Code Online (Sandbox Code Playgroud)
我遇到了同样的问题,这件事对我有用。
| 归档时间: |
|
| 查看次数: |
15789 次 |
| 最近记录: |