Skip to content

Commit a2b366d

Browse files
committed
Switching from AWS managed policy attachment to manual policy doc
1 parent d02618f commit a2b366d

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

iam.tf

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,27 @@ EOF
2525

2626
}
2727

28-
# AWS managed lifecycle hook policy
29-
resource "aws_iam_policy_attachment" "lifecycle_role_policy" {
30-
31-
name = "AutoScalingNotificationAccessRole"
32-
policy_arn = "arn:aws:iam::aws:policy/service-role/AutoScalingNotificationAccessRole"
33-
roles = [
34-
"${aws_iam_role.lifecycle_role.name}"
28+
# Attach policy document for access to the sqs queue
29+
resource "aws_iam_role_policy" "lifecycle_role_policy" {
30+
name = "${var.cluster_name}-lifecycle-hooks-policy"
31+
role = "${aws_iam_role.lifecycle_role.id}"
32+
policy = <<EOF
33+
{
34+
"Version": "2012-10-17",
35+
"Statement": [{
36+
"Effect": "Allow",
37+
"Resource": "${var.lifecycle_hooks_sqs_queue_arn}",
38+
"Action": [
39+
"sqs:SendMessage",
40+
"sqs:GetQueueUrl",
41+
"sns:Publish"
3542
]
43+
}]
44+
}
45+
EOF
3646

3747
lifecycle {
3848
create_before_destroy = true
3949
}
40-
50+
4151
}

0 commit comments

Comments
 (0)