我已经在谷歌上搜索过了,还没有找到一个可靠的解决方案。我在 AWS 中设置了一个环境,我不希望用户能够对 EC2 安全组进行任何更改;这些只能通过 Terraform apply 设置。我有以下我们尝试应用于用户的政策,但它并没有阻止我添加或删除新的入口规则:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PreventUpdateOfCoreSecurityGroups",
"Effect": "Deny",
"Action": [
"ec2:AuthorizeSecurityGroupIngress",
"ec2:AuthorizeSecurityGroupEgress",
"ec2:RevokeSecurityGroupIngress",
"ec2:RevokeSecurityGroupEgress",
"ec2:ModifySecurityGroupRules"
],
"Resource": [
"arn:aws:ec2:us-west-2:************:security-group/sg-1",
"arn:aws:ec2:us-west-2:************:security-group/sg-2",
"arn:aws:ec2:us-west-2:************:security-group/sg-3",
"arn:aws:ec2:us-west-2:************:security-group/sg-4",
"arn:aws:ec2:us-west-2:************:security-group/sg-5"
]
}
]
}
我确定我遗漏了一些明显的东西,但它只是没有跳出来。我会很感激任何想法!