我试图创建一个只授予特定角色访问权限以承担角色{角色链接}的信任策略,但是当我运行terraform时,我将得到以下错误消息
错误更新IAM角色(GitActions_Workflow_role)假定角色策略: MalformedPolicyDocument:无效的策略主体:MalformedPolicyDocument
请如何创建仅授予其他角色承担此角色的信任策略角色?如何修复主体会话中的错误消息?
resource "aws_iam_role" "GitHubActions" {
name = var.role_name
assume_role_policy = <<EOF
{
"Version":"2012-10-17",
"Statement": {
"Effect": "Allow",
"Principal": {
"AWS":"arn:aws:iam::${var.oidc_account}:role/${var.orchestration_role_name}"
},
"Action": "sts:AssumeRole",
"Condition": {}
}
}
EOF
}
variables.tf
variable "role_name"{
type = string
}
variable "managed_policy"{
type = string
}
variable "orchestration_role_name"{
type = string
default = "Orchestration_Role"
}
variable "oidc_account"{
type = string
default = "12345678910"
}
发布于 2021-12-13 14:06:51
在尝试使用之前,主角色必须存在。如果尚未创建aws_iam_role.GitHubActions
,则无法创建Orchestration_Role
。
https://stackoverflow.com/questions/70340169
复制相似问题