Skip to content

Commit

Permalink
feat: Add ability to define custom timeout for create/delete operatio…
Browse files Browse the repository at this point in the history
…ns for fargate profiles
  • Loading branch information
Ivan Dechovski committed Oct 1, 2021
1 parent 253f927 commit a7ee60f
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <a name="input_iam_path"></a> [iam\_path](#input\_iam\_path) | If provided, all IAM roles will be created on this path. | `string` | `"/"` | no |
| <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 |
Expand Down
4 changes: 4 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ module "eks" {
}
}

# Set custom timeout for create/delete operation on fargate profiles
create_timeout = "20m"
delete_timeout = "20m"

# AWS Auth (kubernetes_config_map)
map_roles = [
{
Expand Down
5 changes: 5 additions & 0 deletions examples/fargate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module "eks" {
# Using specific subnets instead of the ones configured in EKS (`subnets` and `fargate_subnets`)
subnets = [local.vpc.private_subnets[1]]


tags = {
Owner = "secondary"
}
Expand Down Expand Up @@ -119,6 +120,10 @@ module "fargate_profile_existing_cluster" {
}
}

# Set custom timeout for create/delete operation on fargate profiles
create_timeout = "20m"
delete_timeout = "20m"

tags = {
DoYouLoveFargate = "Yes"
}
Expand Down
2 changes: 2 additions & 0 deletions fargate.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ module "fargate" {
subnets = coalescelist(var.fargate_subnets, var.subnets, [""])

fargate_profiles = var.fargate_profiles
create_timeout = var.fargate_profiles_create_timeout
delete_timeout = var.fargate_profiles_delete_timeout

tags = var.tags
}
2 changes: 2 additions & 0 deletions modules/fargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ No modules.
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the EKS cluster. | `string` | `""` | no |
| <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 |
| <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 |
| <a name="input_create_timeout"></a> [create\_timeout](#input\_create\_timeout) | Timeout value when creating a fargate profile. | `string` | `null` | no |
| <a name="input_delete_timeout"></a> [delete\_timeout](#input\_delete\_timeout) | Timeout value when deleting a fargate profile. | `string` | `null` | no |
| <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 |
| <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 |
| <a name="input_iam_path"></a> [iam\_path](#input\_iam\_path) | IAM roles will be created on this path. | `string` | `"/"` | no |
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 = var.create_timeout
delete = var.delete_timeout
}

tags = merge(var.tags, lookup(each.value, "tags", {}))
}
12 changes: 12 additions & 0 deletions modules/fargate/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ variable "fargate_profiles" {
default = {}
}

variable "create_timeout" {
description = "Timeout value when creating a fargate profile."
type = string
default = null
}

variable "delete_timeout" {
description = "Timeout value when deleting a fargate profile."
type = string
default = null
}

variable "permissions_boundary" {
description = "If provided, all IAM roles will be created with this permissions boundary attached."
type = string
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,18 @@ variable "fargate_profiles" {
default = {}
}

variable "fargate_profiles_create_timeout" {
description = "Timeout value when creating a fargate profile."
type = string
default = null
}

variable "fargate_profiles_delete_timeout" {
description = "Timeout value when deleting a fargate profile."
type = string
default = null
}

variable "create_fargate_pod_execution_role" {
description = "Controls if the EKS Fargate pod execution IAM role should be created."
type = bool
Expand Down

0 comments on commit a7ee60f

Please sign in to comment.