-
Notifications
You must be signed in to change notification settings - Fork 7
/
ecs-scheduler-apiary-iam.tf
38 lines (34 loc) · 1.04 KB
/
ecs-scheduler-apiary-iam.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
38
/**
* Copyright (C) 2019-2021 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/
resource "aws_iam_role" "beekeeper_scheduler_apiary_ecs_task" {
count = var.instance_type == "ecs" ? 1 : 0
name = "${local.instance_alias}-scheduler-apiary-ecs-task-${var.aws_region}"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "ecs-tasks.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
EOF
}
resource "aws_iam_role_policy_attachment" "beekeeper_scheduler_apiary_secrets" {
count = var.instance_type == "ecs" ? 1 : 0
role = aws_iam_role.beekeeper_scheduler_apiary_ecs_task.*.id[0]
policy_arn = aws_iam_policy.beekeeper_secrets.arn
}
resource "aws_iam_role_policy_attachment" "beekeeper_scheduler_apiary_sqs" {
count = var.instance_type == "ecs" ? 1 : 0
role = aws_iam_role.beekeeper_scheduler_apiary_ecs_task.*.id[0]
policy_arn = aws_iam_policy.beekeeper_sqs.arn
}