Skip to content

feat: allow adding more trusted principals to task role #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ allow_github_webhooks = true
| start\_timeout | Time duration (in seconds) to wait before giving up on resolving dependencies for a container | `number` | `30` | no |
| 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 |
| tags | A map of tags to use on all resources | `map(string)` | `{}` | no |
| trusted\_principals | A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role | `list(string)` | `[]` | no |
| 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 |
| 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 |
| 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 |
Expand Down
1 change: 1 addition & 0 deletions examples/github-complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Go to https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/settin
| github\_token | Github token | `string` | n/a | yes |
| github\_user | Github user for Atlantis to utilize when performing Github activities | `string` | n/a | yes |
| region | AWS region where resources will be created | `string` | `"us-east-1"` | no |
| trusted\_principals | A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role | `list(string)` | n/a | yes |

## Outputs

Expand Down
3 changes: 3 additions & 0 deletions examples/github-complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ module "atlantis" {
hardLimit = 16384
}]

# Security
trusted_principals = var.trusted_principals

# DNS
route53_zone_name = var.domain

Expand Down
1 change: 1 addition & 0 deletions examples/github-complete/terraform.tfvars.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ github_organization = "myorg"
github_user = "atlantis"
github_token = "mygithubpersonalaccesstokenforatlantis"
allowed_repo_names = ["repo1", "repo2"]
trusted_principals = ["ssm.amazonaws.com"] # Convenient if you want to enable SSM access into Atlantis for troubleshooting etc
5 changes: 5 additions & 0 deletions examples/github-complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ variable "allowed_repo_names" {
description = "Repositories that Atlantis will listen for events from and a webhook will be installed"
type = list(string)
}

variable "trusted_principals" {
description = "A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role"
type = list(string)
}
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ data "aws_iam_policy_document" "ecs_tasks" {

principals {
type = "Service"
identifiers = ["ecs-tasks.amazonaws.com"]
identifiers = compact(distinct(concat(["ecs-tasks.amazonaws.com"], var.trusted_principals)))
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ variable "policies_arn" {
default = ["arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"]
}

variable "trusted_principals" {
description = "A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role"
type = list(string)
default = []
}

variable "ecs_fargate_spot" {
description = "Whether to run ECS Fargate Spot or not"
type = bool
Expand Down