Skip to content

Commit fe833a0

Browse files
sf-walsh[Sean Walsh]saltywalshantonbabenko
authored
feat: Add path option to IAM roles created under this module (#311)
Co-authored-by: [Sean Walsh] <[[email protected]]> Co-authored-by: Sean Walsh <[email protected]> Co-authored-by: Anton Babenko <[email protected]>
1 parent 65bff86 commit fe833a0

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.62.3
3+
rev: v1.76.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate
@@ -23,6 +23,6 @@ repos:
2323
- '--args=--only=terraform_standard_module_structure'
2424
- '--args=--only=terraform_workspace_remote'
2525
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.1.0
26+
rev: v4.3.0
2727
hooks:
2828
- id: check-merge-conflict

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ allow_github_webhooks = true
377377
| <a name="input_max_session_duration"></a> [max\_session\_duration](#input\_max\_session\_duration) | Maximum session duration (in seconds) for ecs task execution role. Default is 3600. | `number` | `null` | no |
378378
| <a name="input_mount_points"></a> [mount\_points](#input\_mount\_points) | Container mount points. This is a list of maps, where each map should contain a `containerPath` and `sourceVolume`. The `readOnly` key is optional. | `list(any)` | `[]` | no |
379379
| <a name="input_name"></a> [name](#input\_name) | Name to use on all resources created (VPC, ALB, etc) | `string` | `"atlantis"` | no |
380+
| <a name="input_path"></a> [path](#input\_path) | If provided, all IAM roles will be created with this path. | `string` | `"/"` | no |
380381
| <a name="input_permissions_boundary"></a> [permissions\_boundary](#input\_permissions\_boundary) | If provided, all IAM roles will be created with this permissions boundary attached. | `string` | `null` | no |
381382
| <a name="input_policies_arn"></a> [policies\_arn](#input\_policies\_arn) | A list of the ARN of the policies you want to apply | `list(string)` | `null` | no |
382383
| <a name="input_private_subnet_ids"></a> [private\_subnet\_ids](#input\_private\_subnet\_ids) | A list of IDs of existing private subnets inside the VPC | `list(string)` | `[]` | no |

examples/github-complete/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ module "atlantis" {
7878
# Trusted roles
7979
trusted_principals = ["ssm.amazonaws.com"]
8080

81+
# IAM role options
82+
permissions_boundary = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:policy/cloud/developer-boundary-policy"
83+
path = "/delegatedadmin/developer/"
84+
8185
# Atlantis
8286
atlantis_github_user = var.github_user
8387
atlantis_github_user_token = var.github_token

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ resource "aws_efs_file_system" "this" {
454454
resource "aws_efs_mount_target" "this" {
455455
# we coalescelist in order to specify the resource keys when we create the subnets using the VPC or they're specified for us. This works around the for_each value depends on attributes which can't be determined until apply error
456456
for_each = {
457-
for k, v in zipmap(coalescelist(var.private_subnets, var.private_subnet_ids), local.private_subnet_ids) : k => v
457+
for k, v in zipmap(coalescelist(var.private_subnets, var.private_subnet_ids, [""]), local.private_subnet_ids) : k => v
458458
if var.enable_ephemeral_storage == false
459459
}
460460

@@ -534,6 +534,7 @@ resource "aws_iam_role" "ecs_task_execution" {
534534
assume_role_policy = data.aws_iam_policy_document.ecs_tasks.json
535535
max_session_duration = var.max_session_duration
536536
permissions_boundary = var.permissions_boundary
537+
path = var.path
537538

538539
tags = local.tags
539540
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,12 @@ variable "permissions_boundary" {
305305
default = null
306306
}
307307

308+
variable "path" {
309+
description = "If provided, all IAM roles will be created with this path."
310+
type = string
311+
default = "/"
312+
}
313+
308314
variable "policies_arn" {
309315
description = "A list of the ARN of the policies you want to apply"
310316
type = list(string)

0 commit comments

Comments
 (0)