[英]Terraform to create ec2 instance error even though instance is created
I am having trouble creating ec2 instances with my IAM role.我在使用我的 IAM 角色创建 ec2 实例时遇到问题。 The permissions I gave are
我给的权限是
List DescribeInstances DescribeKeyPairs列出DescribeInstances DescribeKeyPairs
Read DescribeTags阅读DescribeTags
Tagging CreateTags标记创建标签
Write CreateKeyPair DeleteKeyPair ImportKeyPair RunInstances TerminateInstances写入CreateKeyPair DeleteKeyPair ImportKeyPair RunInstances TerminateInstances
The error is错误是
error while describing instance(...) attribute (instanceInitiatedShutdownBehaviour): UnnauthorizedOperation: You are no authorized to perform this operation.
However, on the AWS console, the ec2 instance is created.但是,在 AWS 控制台上,创建了 ec2 实例。 I am unable to
terraform destroy
it due to the same error.由于同样的错误,我无法
terraform destroy
它。
It works if I give full ec2 access (ec2:*) so it has nothing to do with my terraform code.如果我提供完整的 ec2 访问权限 (ec2:*),它就会工作,因此它与我的 terraform 代码无关。
Thank you.谢谢。
I went through the same error and it is because of lack of permission.我遇到了同样的错误,这是因为缺乏许可。 In the error:
在错误中:
error while describing instance(...) attribute (instanceInitiatedShutdownBehaviour): UnnauthorizedOperation: You are no authorized to perform this operation.
the UnnauthorizedOperation
is trying to describe an instance attribute since you do not have the ec2:DescribeInstanceAttribute
permission. UnnauthorizedOperation
试图描述实例属性,因为您没有ec2:DescribeInstanceAttribute
权限。
Depending on how your terraform config looks like for the instances, you may require more permissions.根据实例的 terraform 配置,您可能需要更多权限。 You can enable debug logs in your apply command to get more information:
您可以在应用命令中启用调试日志以获取更多信息:
TF_LOG=DEBUG terraform apply
Use the visual policy editor to add permissions to your IAM role and look out for Action Warnings
.使用可视化策略编辑器向您的 IAM 角色添加权限并留意
Action Warnings
。 It will tell you if you are missing any permissions required by the existing permission.它会告诉您是否缺少现有权限所需的任何权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.