Skip to content

Commit a7ee60f

Browse files
author
Ivan Dechovski
committed
feat: Add ability to define custom timeout for create/delete operations for fargate profiles
1 parent 253f927 commit a7ee60f

File tree

8 files changed

+44
-0
lines changed

8 files changed

+44
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf
231231
| <a name="input_enable_irsa"></a> [enable\_irsa](#input\_enable\_irsa) | Whether to create OpenID Connect Provider for EKS to enable IRSA | `bool` | `false` | no |
232232
| <a name="input_fargate_pod_execution_role_name"></a> [fargate\_pod\_execution\_role\_name](#input\_fargate\_pod\_execution\_role\_name) | The IAM Role that provides permissions for the EKS Fargate Profile. | `string` | `null` | no |
233233
| <a name="input_fargate_profiles"></a> [fargate\_profiles](#input\_fargate\_profiles) | Fargate profiles to create. See `fargate_profile` keys section in fargate submodule's README.md for more details | `any` | `{}` | no |
234+
| <a name="input_fargate_profiles_create_timeout"></a> [fargate\_profiles\_create\_timeout](#input\_fargate\_profiles\_create\_timeout) | Timeout value when creating a fargate profile. | `string` | `null` | no |
235+
| <a name="input_fargate_profiles_delete_timeout"></a> [fargate\_profiles\_delete\_timeout](#input\_fargate\_profiles\_delete\_timeout) | Timeout value when deleting a fargate profile. | `string` | `null` | no |
234236
| <a name="input_fargate_subnets"></a> [fargate\_subnets](#input\_fargate\_subnets) | A list of subnets to place fargate workers within (if different from subnets). | `list(string)` | `[]` | no |
235237
| <a name="input_iam_path"></a> [iam\_path](#input\_iam\_path) | If provided, all IAM roles will be created on this path. | `string` | `"/"` | no |
236238
| <a name="input_kubeconfig_aws_authenticator_additional_args"></a> [kubeconfig\_aws\_authenticator\_additional\_args](#input\_kubeconfig\_aws\_authenticator\_additional\_args) | Any additional arguments to pass to the authenticator such as the role to assume. e.g. ["-r", "MyEksRole"]. | `list(string)` | `[]` | no |

examples/complete/main.tf

+4
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ module "eks" {
102102
}
103103
}
104104

105+
# Set custom timeout for create/delete operation on fargate profiles
106+
create_timeout = "20m"
107+
delete_timeout = "20m"
108+
105109
# AWS Auth (kubernetes_config_map)
106110
map_roles = [
107111
{

examples/fargate/main.tf

+5
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ module "eks" {
5151
# Using specific subnets instead of the ones configured in EKS (`subnets` and `fargate_subnets`)
5252
subnets = [local.vpc.private_subnets[1]]
5353

54+
5455
tags = {
5556
Owner = "secondary"
5657
}
@@ -119,6 +120,10 @@ module "fargate_profile_existing_cluster" {
119120
}
120121
}
121122

123+
# Set custom timeout for create/delete operation on fargate profiles
124+
create_timeout = "20m"
125+
delete_timeout = "20m"
126+
122127
tags = {
123128
DoYouLoveFargate = "Yes"
124129
}

fargate.tf

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ module "fargate" {
1111
subnets = coalescelist(var.fargate_subnets, var.subnets, [""])
1212

1313
fargate_profiles = var.fargate_profiles
14+
create_timeout = var.fargate_profiles_create_timeout
15+
delete_timeout = var.fargate_profiles_delete_timeout
1416

1517
tags = var.tags
1618
}

modules/fargate/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ No modules.
5353
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the EKS cluster. | `string` | `""` | no |
5454
| <a name="input_create_eks"></a> [create\_eks](#input\_create\_eks) | Controls if EKS resources should be created (it affects almost all resources) | `bool` | `true` | no |
5555
| <a name="input_create_fargate_pod_execution_role"></a> [create\_fargate\_pod\_execution\_role](#input\_create\_fargate\_pod\_execution\_role) | Controls if the the IAM Role that provides permissions for the EKS Fargate Profile should be created. | `bool` | `true` | no |
56+
| <a name="input_create_timeout"></a> [create\_timeout](#input\_create\_timeout) | Timeout value when creating a fargate profile. | `string` | `null` | no |
57+
| <a name="input_delete_timeout"></a> [delete\_timeout](#input\_delete\_timeout) | Timeout value when deleting a fargate profile. | `string` | `null` | no |
5658
| <a name="input_fargate_pod_execution_role_name"></a> [fargate\_pod\_execution\_role\_name](#input\_fargate\_pod\_execution\_role\_name) | The IAM Role that provides permissions for the EKS Fargate Profile. | `string` | `null` | no |
5759
| <a name="input_fargate_profiles"></a> [fargate\_profiles](#input\_fargate\_profiles) | Fargate profiles to create. See `fargate_profile` keys section in README.md for more details | `any` | `{}` | no |
5860
| <a name="input_iam_path"></a> [iam\_path](#input\_iam\_path) | IAM roles will be created on this path. | `string` | `"/"` | no |

modules/fargate/main.tf

+5
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,10 @@ resource "aws_eks_fargate_profile" "this" {
6363
}
6464
}
6565

66+
timeouts {
67+
create = var.create_timeout
68+
delete = var.delete_timeout
69+
}
70+
6671
tags = merge(var.tags, lookup(each.value, "tags", {}))
6772
}

modules/fargate/variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ variable "fargate_profiles" {
3434
default = {}
3535
}
3636

37+
variable "create_timeout" {
38+
description = "Timeout value when creating a fargate profile."
39+
type = string
40+
default = null
41+
}
42+
43+
variable "delete_timeout" {
44+
description = "Timeout value when deleting a fargate profile."
45+
type = string
46+
default = null
47+
}
48+
3749
variable "permissions_boundary" {
3850
description = "If provided, all IAM roles will be created with this permissions boundary attached."
3951
type = string

variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,18 @@ variable "fargate_profiles" {
387387
default = {}
388388
}
389389

390+
variable "fargate_profiles_create_timeout" {
391+
description = "Timeout value when creating a fargate profile."
392+
type = string
393+
default = null
394+
}
395+
396+
variable "fargate_profiles_delete_timeout" {
397+
description = "Timeout value when deleting a fargate profile."
398+
type = string
399+
default = null
400+
}
401+
390402
variable "create_fargate_pod_execution_role" {
391403
description = "Controls if the EKS Fargate pod execution IAM role should be created."
392404
type = bool

0 commit comments

Comments
 (0)