-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployer.tf
40 lines (34 loc) · 1.35 KB
/
deployer.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
39
40
// ECS requires the user/role that initiates a deployment
// to have iam:PassRole access to the execution role
// This grants the deployer user access to this service's execution role
// This is necessary for us to execute `nullstone deploy` on the CLI
resource "aws_iam_user" "deployer" {
#bridgecrew:skip=CKV_AWS_273: "Ensure access is controlled through SSO and not AWS IAM defined users". SSO is unavailable.
name = "deployer-${local.resource_name}"
tags = local.tags
}
resource "aws_iam_access_key" "deployer" {
user = aws_iam_user.deployer.name
}
// Add deployer to deployers group defined in the cluster
// This allows the deployer user to perform common operations on the cluster
resource "aws_iam_user_group_membership" "deployers" {
user = aws_iam_user.deployer.name
groups = [local.deployers_name]
}
resource "aws_iam_user_policy" "deployer" {
#bridgecrew:skip=CKV_AWS_40: Skipping `IAM policies attached only to groups or roles reduces management complexity`; Adding a role or group would increase complexity
user = aws_iam_user.deployer.name
policy = data.aws_iam_policy_document.deployer.json
}
data "aws_iam_policy_document" "deployer" {
statement {
sid = "AllowPassRoleToServiceRoles"
effect = "Allow"
actions = ["iam:PassRole"]
resources = [
aws_iam_role.execution.arn,
aws_iam_role.task.arn,
]
}
}