繁体   English   中英

Terraform 创建 ec2 实例错误,即使实例已创建

[英]Terraform to create ec2 instance error even though instance is created

我在使用我的 IAM 角色创建 ec2 实例时遇到问题。 我给的权限是

列出DescribeInstances DescribeKeyPairs

阅读DescribeTags

标记创建标签

写入CreateKeyPair DeleteKeyPair ImportKeyPair RunInstances TerminateInstances

错误是

error while describing instance(...) attribute (instanceInitiatedShutdownBehaviour): UnnauthorizedOperation: You are no authorized to perform this operation.

但是,在 AWS 控制台上,创建了 ec2 实例。 由于同样的错误,我无法terraform destroy它。

如果我提供完整的 ec2 访问权限 (ec2:*),它就会工作,因此它与我的 terraform 代码无关。

谢谢。

我遇到了同样的错误,这是因为缺乏许可。 在错误中:

error while describing instance(...) attribute (instanceInitiatedShutdownBehaviour): UnnauthorizedOperation: You are no authorized to perform this operation.

UnnauthorizedOperation试图描述实例属性,因为您没有ec2:DescribeInstanceAttribute权限。

根据实例的 terraform 配置,您可能需要更多权限。 您可以在应用命令中启用调试日志以获取更多信息:

TF_LOG=DEBUG terraform apply

使用可视化策略编辑器向您的 IAM 角色添加权限并留意Action Warnings 它会告诉您是否缺少现有权限所需的任何权限。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM