Skip to content

Commit

Permalink
feat: Add ability to define custom timeout for fargate profiles (terr…
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanDechovsky authored Nov 3, 2021
1 parent 6959b9b commit b7539dc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ module "eks" {
tags = {
Owner = "test"
}

timeouts = {
create = "20m"
delete = "20m"
}
}
}

Expand Down
9 changes: 9 additions & 0 deletions examples/fargate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ module "eks" {
tags = {
Owner = "default"
}

timeouts = {
create = "20m"
delete = "20m"
}
}

secondary = {
Expand Down Expand Up @@ -154,6 +159,10 @@ module "fargate_profile_existing_cluster" {
Owner = "profile2"
submodule = "true"
}

timeouts = {
delete = "20m"
}
}
}

Expand Down
1 change: 1 addition & 0 deletions modules/fargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ See example code in `examples/fargate`.
| name | Fargate profile name | `string` | Auto generated in the following format `[cluster_name]-fargate-[fargate_profile_map_key]`| no |
| selectors | A list of Kubernetes selectors. See examples/fargate/main.tf for example format. | <pre>list(map({<br>namespace = string<br>labels = map(string)<br>}))</pre>| `[]` | no |
| subnets | List of subnet IDs. Will replace the root module subnets. | `list(string)` | `var.subnets` | no |
| timeouts | A map of timeouts for create/delete operations. | `map(string)` | Provider default behavior | no |
| tags | Key-value map of resource tags. Will be merged with root module tags. | `map(string)` | `var.tags` | no |

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Expand Down
5 changes: 5 additions & 0 deletions modules/fargate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,10 @@ resource "aws_eks_fargate_profile" "this" {
}
}

timeouts {
create = try(each.value["timeouts"].create, null)
delete = try(each.value["timeouts"].delete, null)
}

tags = merge(var.tags, lookup(each.value, "tags", {}))
}

0 comments on commit b7539dc

Please sign in to comment.