簡體   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