gpt4 book ai didi

amazon-web-services - 未找到 Terraform AWS Provider 的有效凭证来源

转载 作者:行者123 更新时间:2023-12-05 02:32:57 28 4
gpt4 key购买 nike

我正在为 aws 提供商使用 shared_cred_file。以 aws provider 版本 3.63 为例,terraform 计划运行良好。

当我使用 aws provider 4.0 时,它会提示我对 shared_credentials_files 使用应用更改的设置。改完之后没有报错,但是第二个报错依旧

可能是什么问题?

Warning: Argument is deprecated

│ with provider[“registry.terraform.io/hashicorp/aws”],
│ on main.tf line 15, in provider “aws”:
│ 15: shared_credentials_file = “~/.aws/credentials”

│ Use shared_credentials_files instead.

│ (and one more similar warning elsewhere)


│ Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.

│ Please see https://registry.terraform.io/providers/hashicorp/aws
│ for more information about providing credentials.

│ Error: no EC2 IMDS role found, operation error ec2imds: GetMetadata, canceled, context deadline exceeded


│ with provider[“registry.terraform.io/hashicorp/aws”],
│ on main.tf line 13, in provider “aws”:
│ 13: provider “aws” {

///////////////////////////////
// Infrastructure init
terraform {
backend "s3" {
bucket = "monitoring-********-infrastructure"
key = "tfstates/********-non-prod-rds-info.tfstate"
profile = "test-prof"
region = "eu-west-2"
shared_credentials_file = "~/.aws/credentials"
}
}

provider "aws" {
profile = "test-prof"
shared_credentials_files = ["~/.aws/credentials"]
region = "eu-west-2"
}
    Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.

│ Please see https://registry.terraform.io/providers/hashicorp/aws
│ for more information about providing credentials.

│ Error: no EC2 IMDS role found, operation error ec2imds: GetMetadata, canceled, context deadline exceeded


│ with provider["registry.terraform.io/hashicorp/aws"],
│ on main.tf line 13, in provider "aws":
│ 13: provider "aws" {

猫配置

[test-prof]
output = json
region = eu-west-2

猫凭据

[test-prof]
aws_access_key_id = ****************
aws_secret_access_key = ******************

最佳答案

根据最新的 Terraform 文档,这就是它的工作方式,

provider "aws" {
region = "us-east-1"
shared_credentials_files = ["C:/Users/tf_user/.aws/credentials"]
profile = "customprofile"
}

我遇到了同样的问题,这个东西对我有用。

关于amazon-web-services - 未找到 Terraform AWS Provider 的有效凭证来源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71079921/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com