forked from jenkins-infra/aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam-role-updatecli.tf
37 lines (32 loc) · 1.06 KB
/
iam-role-updatecli.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Identity to allow updatecli to update AMIs and associated AWS resources
## No need to create a group for only 1 user
#tfsec:ignore:no-user-attached-policies
resource "aws_iam_user" "updatecli" {
name = "updatecli"
}
resource "aws_iam_user_policy_attachment" "allow_updatecli_read_ec2" {
user = aws_iam_user.updatecli.name
policy_arn = aws_iam_policy.updatecli.arn
}
resource "aws_iam_policy" "updatecli" {
name = "updatecli"
path = "/"
description = "IAM Policy to allow updatecli to update AMIs and associated AWS resources."
policy = data.aws_iam_policy_document.updatecli.json
}
data "aws_iam_policy_document" "updatecli" {
statement {
sid = "VisualEditor0"
effect = "Allow"
actions = [
"ec2:DescribeTags",
"ec2:DescribeInstances",
"ec2:DescribeRegions",
"ec2:DescribeImages",
"ec2:DescribeAvailabilityZones",
]
## Allow wildcard for resource as it's used to request AMIs with their IDs unknwon in Terraform
#tfsec:ignore:aws-iam-no-policy-wildcards
resources = ["*"]
}
}