运行Terraform Plan/Apply时出现InvalidClientTokenID错误 [英] InvalidClientTokenID error when running Terraform Plan/Apply

查看:290
本文介绍了运行Terraform Plan/Apply时出现InvalidClientTokenID错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Terraform和用户数据在AWS中设置一个HA集群.我的main.tf看起来像这样:

I'm setting up a HA cluster in AWS using Terraform and user data. My main.tf looks like this:

provider "aws" {
access_key = "access_key"
secret_key = "secret_key"
}

resource "aws_instance" "etcd" {
ami = "${var.ami}" // coreOS 17508
instance_type = "${var.instance_type}"
key_name = "${var.key_name}"
key_path = "${var.key_path}"
count = "${var.count}"
region = "${var.aws_region}"
user_data = "${file("cloud-config.yml")}"

subnet_id = "${aws_subnet.k8s.id}"
private_ip = "${cidrhost("10.43.0.0/16", 10 + count.index)}"
associate_public_ip_address = true

vpc_security_group_ids = ["${aws_security_group.terraform_swarm.id}"]

tags {
name = "coreOS-master"
}
}

但是,当我运行terraform plan时,出现以下错误provider.aws: InvalidClientTokenId: The security token included in the request is invalid. status code: 403, request id: 45099d1a-4d6a-11e8-891c-df22e6789996

However, when I run terraform plan I get the following error provider.aws: InvalidClientTokenId: The security token included in the request is invalid. status code: 403, request id: 45099d1a-4d6a-11e8-891c-df22e6789996

我到处查看了一些建议,以清除〜/.aws/credentials文件或使用新的AWS IAM凭证对其进行更新.我对如何解决此错误非常迷失.

I've looked around some suggestions were to clear out my ~/.aws/credentials file or update it with the new aws IAM credentials. I'm pretty lost on how to fix this error.

推荐答案

这通常是由凭据中的某些特定字符(\ @!等)引起的.可以通过重新生成aws访问代码和密钥的凭据来解决此问题.

This is usually caused by some certain characters (\ @ !, etc) in the credentials. It can be fixed by re-generating credentials your aws access code and secret key.

这篇关于运行Terraform Plan/Apply时出现InvalidClientTokenID错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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