Skip to content

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

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 1 commit
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 @@ -314,6 +314,7 @@ allow_github_webhooks = true
| <a name="input_start_timeout"></a> [start\_timeout](#input\_start\_timeout) | Time duration (in seconds) to wait before giving up on resolving dependencies for a container | `number` | `30` | no |
| <a name="input_stop_timeout"></a> [stop\_timeout](#input\_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 |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to use on all resources | `map(string)` | `{}` | no |
| <a name="input_trusted_entities"></a> [trusted\_entities](#input\_trusted\_entities) | A list of users or roles, that can assume the task role | `list(string)` | `[]` | no |
| <a name="input_trusted_principals"></a> [trusted\_principals](#input\_trusted\_principals) | A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role | `list(string)` | `[]` | no |
| <a name="input_ulimits"></a> [ulimits](#input\_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 |
| <a name="input_user"></a> [user](#input\_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 |
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 @@ -67,6 +67,7 @@ Go to https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/settin
| <a name="input_github_token"></a> [github\_token](#input\_github\_token) | Github token | `string` | n/a | yes |
| <a name="input_github_user"></a> [github\_user](#input\_github\_user) | Github user for Atlantis to utilize when performing Github activities | `string` | n/a | yes |
| <a name="input_region"></a> [region](#input\_region) | AWS region where resources will be created | `string` | `"us-east-1"` | no |
| <a name="input_trusted_entities"></a> [trusted\_entities](#input\_trusted\_entities) | A list of users or roles, that can assume the task role | `list(string)` | `[]` | no |
| <a name="input_trusted_principals"></a> [trusted\_principals](#input\_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
1 change: 1 addition & 0 deletions examples/github-complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ module "atlantis" {

# Security
trusted_principals = var.trusted_principals
trusted_entities = var.trusted_entities

# DNS
route53_zone_name = var.domain
Expand Down
6 changes: 6 additions & 0 deletions examples/github-complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ variable "trusted_principals" {
description = "A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role"
type = list(string)
}

variable "trusted_entities" {
description = "A list of users or roles, that can assume the task role"
type = list(string)
default = []
}
9 changes: 9 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,15 @@ data "aws_iam_policy_document" "ecs_tasks" {
type = "Service"
identifiers = compact(distinct(concat(["ecs-tasks.amazonaws.com"], var.trusted_principals)))
}

dynamic "principals" {
for_each = var.trusted_entities

content {
type = "AWS"
identifiers = compact(distinct(var.trusted_entities))
}
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ variable "trusted_principals" {
default = []
}

variable "trusted_entities" {
description = "A list of users or roles, 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