Skip to content

Commit 7aed8dc

Browse files
author
Paris Morali
authored
feat: allow adding more trusted principals to task role (#155)
1 parent 66484ba commit 7aed8dc

File tree

7 files changed

+18
-1
lines changed

7 files changed

+18
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ allow_github_webhooks = true
258258
| start\_timeout | Time duration (in seconds) to wait before giving up on resolving dependencies for a container | `number` | `30` | no |
259259
| stop\_timeout | Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own | `number` | `30` | no |
260260
| tags | A map of tags to use on all resources | `map(string)` | `{}` | no |
261+
| trusted\_principals | A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role | `list(string)` | `[]` | no |
261262
| ulimits | Container ulimit settings. This is a list of maps, where each map should contain "name", "hardLimit" and "softLimit" | <pre>list(object({<br> name = string<br> hardLimit = number<br> softLimit = number<br> }))</pre> | `null` | no |
262263
| user | The user to run as inside the container. Can be any of these formats: user, user:group, uid, uid:gid, user:gid, uid:group. The default (null) will use the container's configured `USER` directive or root if not set. | `string` | `null` | no |
263264
| volumes\_from | A list of VolumesFrom maps which contain "sourceContainer" (name of the container that has the volumes to mount) and "readOnly" (whether the container can write to the volume) | <pre>list(object({<br> sourceContainer = string<br> readOnly = bool<br> }))</pre> | `[]` | no |

examples/github-complete/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Go to https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/settin
4949
| github\_token | Github token | `string` | n/a | yes |
5050
| github\_user | Github user for Atlantis to utilize when performing Github activities | `string` | n/a | yes |
5151
| region | AWS region where resources will be created | `string` | `"us-east-1"` | no |
52+
| trusted\_principals | A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role | `list(string)` | n/a | yes |
5253

5354
## Outputs
5455

examples/github-complete/main.tf

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ module "atlantis" {
5959
hardLimit = 16384
6060
}]
6161

62+
# Security
63+
trusted_principals = var.trusted_principals
64+
6265
# DNS
6366
route53_zone_name = var.domain
6467

examples/github-complete/terraform.tfvars.sample

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ github_organization = "myorg"
55
github_user = "atlantis"
66
github_token = "mygithubpersonalaccesstokenforatlantis"
77
allowed_repo_names = ["repo1", "repo2"]
8+
trusted_principals = ["ssm.amazonaws.com"] # Convenient if you want to enable SSM access into Atlantis for troubleshooting etc

examples/github-complete/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ variable "allowed_repo_names" {
3333
description = "Repositories that Atlantis will listen for events from and a webhook will be installed"
3434
type = list(string)
3535
}
36+
37+
variable "trusted_principals" {
38+
description = "A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role"
39+
type = list(string)
40+
}

main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ data "aws_iam_policy_document" "ecs_tasks" {
373373

374374
principals {
375375
type = "Service"
376-
identifiers = ["ecs-tasks.amazonaws.com"]
376+
identifiers = compact(distinct(concat(["ecs-tasks.amazonaws.com"], var.trusted_principals)))
377377
}
378378
}
379379
}

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ variable "policies_arn" {
239239
default = ["arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"]
240240
}
241241

242+
variable "trusted_principals" {
243+
description = "A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role"
244+
type = list(string)
245+
default = []
246+
}
247+
242248
variable "ecs_fargate_spot" {
243249
description = "Whether to run ECS Fargate Spot or not"
244250
type = bool

0 commit comments

Comments
 (0)