Skip to content
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

feat: Add ability to define custom timeout for fargate profiles #1614

Conversation

IvanDechovsky
Copy link
Contributor

Add ability to define custom timeout for create/delete operations for fargate profiles

#1610

Copy link
Contributor

@daroga0002 daroga0002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems be not tested, please test and fix a comments

Additionally I don`t know does changes in README.md where done by you or any automatic ?? (we use precommit hooks to generate some part of docs using terraform-docs)

@@ -96,6 +96,11 @@ module "eks" {
}
]

timeouts = {
create = "15"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: Error parsing "create" timeout: time: missing unit in duration "15"

@@ -51,6 +51,12 @@ module "eks" {
# Using specific subnets instead of the ones configured in EKS (`subnets` and `fargate_subnets`)
subnets = [local.vpc.private_subnets[1]]

# Use custom defaults for create/delete operations
timeouts = {
create = "15"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: Error parsing "create" timeout: time: missing unit in duration "15"

@@ -110,6 +116,12 @@ module "fargate_profile_existing_cluster" {
}
]

# Use custom defaults for create/delete operations
timeouts = {
create = "15"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: Error parsing "create" timeout: time: missing unit in duration "15"

| subnets | List of subnet IDs. Will replace the root module subnets. | `list(string)` | `var.subnets` | no |
| tags | Key-value map of resource tags. Will be merged with root module tags. | `map(string)` | `var.tags` | no |
| Name | Description | Type | Default | Required |
| --------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | :------: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does those changes where done by you or by some automation?

| <a name="output_fargate_profile_ids"></a> [fargate\_profile\_ids](#output\_fargate\_profile\_ids) | EKS Cluster name and EKS Fargate Profile names separated by a colon (:). |
| <a name="output_iam_role_arn"></a> [iam\_role\_arn](#output\_iam\_role\_arn) | IAM role ARN for EKS Fargate pods |
| <a name="output_iam_role_name"></a> [iam\_role\_name](#output\_iam\_role\_name) | IAM role name for EKS Fargate pods |
| Name | Description |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what has done those changes?

this part of file should be autogenerated via pre commit hooks

@@ -63,5 +63,10 @@ resource "aws_eks_fargate_profile" "this" {
}
}

timeouts {
create = lookup(each.value["timeouts"], "create", 10)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead assuming some values put failover to null value which will use provider defaults

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
create = lookup(each.value["timeouts"], "create", 10)
create = lookup(each.value["timeouts"], "create", null)

@@ -63,5 +63,10 @@ resource "aws_eks_fargate_profile" "this" {
}
}

timeouts {
create = lookup(each.value["timeouts"], "create", 10)
delete = lookup(each.value["timeouts"], "delete", 10)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
delete = lookup(each.value["timeouts"], "delete", 10)
delete = lookup(each.value["timeouts"], "delete", null)

@IvanDechovsky IvanDechovsky force-pushed the add_timeoute_fargate_profile branch from 5b22760 to a7ee60f Compare October 1, 2021 21:20
variables.tf Outdated
@@ -387,6 +387,18 @@ variable "fargate_profiles" {
default = {}
}

variable "fargate_profiles_create_timeout" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont want add additionall variables into submodule, it should follow previously used pattern. I dont know why you changed this as I given you direct suggestion how to make default null value

Copy link
Contributor

@daroga0002 daroga0002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should same pattern across timeouts (was used previously in this PR, I dont know why you changed)

@IvanDechovsky IvanDechovsky force-pushed the add_timeoute_fargate_profile branch 5 times, most recently from a50482f to 89bd8fb Compare October 4, 2021 13:16
@IvanDechovsky
Copy link
Contributor Author

@daroga0002 Do you mind taking a look again?

@daroga0002
Copy link
Contributor

does this was tested?

as I get on plan phase:

╷
│ Error: Invalid index
│ 
│   on ../../modules/fargate/main.tf line 67, in resource "aws_eks_fargate_profile" "this":
│   67:     create = lookup(each.value["timeouts"], "create", null)
│     ├────────────────
│     │ each.value is object with 3 attributes
│ 
│ The given key does not identify an element in this collection value.
╵
╷
│ Error: Invalid index
│ 
│   on ../../modules/fargate/main.tf line 68, in resource "aws_eks_fargate_profile" "this":
│   68:     delete = lookup(each.value["timeouts"], "delete", null)
│     ├────────────────
│     │ each.value is object with 3 attributes
│ 
│ The given key does not identify an element in this collection value.

@IvanDechovsky IvanDechovsky force-pushed the add_timeoute_fargate_profile branch 2 times, most recently from 7cf2229 to 2da840c Compare October 11, 2021 12:08
@IvanDechovsky
Copy link
Contributor Author

@daroga0002 Updated. The problem was that if timeouts is not defined the lookup() function throws the error you saw, instead of assigning the default value (null). I updated the logic and verified it works in both scenarios. Please review again.

@IvanDechovsky IvanDechovsky force-pushed the add_timeoute_fargate_profile branch 3 times, most recently from 446ddb7 to 2cea749 Compare October 14, 2021 11:27
@IvanDechovsky
Copy link
Contributor Author

@daroga0002 Will you have some time to review it this week perhaps?

@IvanDechovsky IvanDechovsky force-pushed the add_timeoute_fargate_profile branch from 2cea749 to 7ae6fc7 Compare October 18, 2021 10:47
@mhulscher
Copy link

Any chance this can make it in the next release? For some reason fargate profiles take considerably longer to create nowadays. Most of our terraform applies are failing because of this timeout, and it is failing our testing pipelines :(

@IvanDechovsky
Copy link
Contributor Author

Any chance this can be looked at please?

@daroga0002
Copy link
Contributor

I have this on my list, will do this till end of week

Copy link
Contributor

@daroga0002 daroga0002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add into file
https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/modules/fargate/README.md

in line 17 following content:

| timeouts | A map of timeouts for create/delete operations. | `map(string)` | Provider default behavior | no |


# Set custom timeout for create/delete operation on fargate profiles
timeouts = {
create = "20m"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets remove create just for test case when we have just one subargument

@@ -89,6 +95,12 @@ module "eks" {
tags = {
Owner = "secondary"
}

# Set custom timeout for create/delete operation on fargate profiles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove lines 99-103 for test case when we dont define any timeout arguments

@daroga0002
Copy link
Contributor

@IvanDechovsky thank you for your contribution, 3 comments and after fixing we will be able to merge it

@IvanDechovsky IvanDechovsky force-pushed the add_timeoute_fargate_profile branch from 7ae6fc7 to 6ecd9ec Compare November 2, 2021 21:39
@IvanDechovsky
Copy link
Contributor Author

@daroga0002 Thank you for taking a look. Updated!

Copy link
Contributor

@daroga0002 daroga0002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One typo in behaviour to fix and we can merge.

@antonbabenko this can be merged when typo will be fixed (maybe you can accept commit on suggestion?)

@antonbabenko antonbabenko merged commit b7539dc into terraform-aws-modules:master Nov 3, 2021
antonbabenko pushed a commit that referenced this pull request Nov 22, 2021
# [17.24.0](v17.23.0...v17.24.0) (2021-11-22)

### Bug Fixes

* Added Deny for CreateLogGroup action in EKS cluster role ([#1594](#1594)) ([6959b9b](6959b9b))
* update CI/CD process to enable auto-release workflow ([#1698](#1698)) ([b876ff9](b876ff9))

### Features

* Add ability to define custom timeout for fargate profiles ([#1614](#1614)) ([b7539dc](b7539dc))
* Removed ng_depends_on variable and related hack ([#1672](#1672)) ([56e93d7](56e93d7))
@antonbabenko
Copy link
Member

This PR is included in version 17.24.0 🎉

spr-mweber3 pushed a commit to spring-media/terraform-aws-eks that referenced this pull request Dec 1, 2021
spr-mweber3 pushed a commit to spring-media/terraform-aws-eks that referenced this pull request Dec 1, 2021
# [17.24.0](terraform-aws-modules/terraform-aws-eks@v17.23.0...v17.24.0) (2021-11-22)

### Bug Fixes

* Added Deny for CreateLogGroup action in EKS cluster role ([terraform-aws-modules#1594](terraform-aws-modules#1594)) ([6959b9b](terraform-aws-modules@6959b9b))
* update CI/CD process to enable auto-release workflow ([terraform-aws-modules#1698](terraform-aws-modules#1698)) ([b876ff9](terraform-aws-modules@b876ff9))

### Features

* Add ability to define custom timeout for fargate profiles ([terraform-aws-modules#1614](terraform-aws-modules#1614)) ([b7539dc](terraform-aws-modules@b7539dc))
* Removed ng_depends_on variable and related hack ([terraform-aws-modules#1672](terraform-aws-modules#1672)) ([56e93d7](terraform-aws-modules@56e93d7))
bryantbiggs pushed a commit to bryantbiggs/terraform-aws-eks that referenced this pull request Dec 13, 2021
# [17.24.0](terraform-aws-modules/terraform-aws-eks@v17.23.0...v17.24.0) (2021-11-22)

### Bug Fixes

* Added Deny for CreateLogGroup action in EKS cluster role ([terraform-aws-modules#1594](terraform-aws-modules#1594)) ([6959b9b](terraform-aws-modules@6959b9b))
* update CI/CD process to enable auto-release workflow ([terraform-aws-modules#1698](terraform-aws-modules#1698)) ([b876ff9](terraform-aws-modules@b876ff9))

### Features

* Add ability to define custom timeout for fargate profiles ([terraform-aws-modules#1614](terraform-aws-modules#1614)) ([b7539dc](terraform-aws-modules@b7539dc))
* Removed ng_depends_on variable and related hack ([terraform-aws-modules#1672](terraform-aws-modules#1672)) ([56e93d7](terraform-aws-modules@56e93d7))
bryantbiggs pushed a commit to bryantbiggs/terraform-aws-eks that referenced this pull request Dec 13, 2021
# [17.24.0](terraform-aws-modules/terraform-aws-eks@v17.23.0...v17.24.0) (2021-11-22)

### Bug Fixes

* Added Deny for CreateLogGroup action in EKS cluster role ([terraform-aws-modules#1594](terraform-aws-modules#1594)) ([6959b9b](terraform-aws-modules@6959b9b))
* update CI/CD process to enable auto-release workflow ([terraform-aws-modules#1698](terraform-aws-modules#1698)) ([b876ff9](terraform-aws-modules@b876ff9))

### Features

* Add ability to define custom timeout for fargate profiles ([terraform-aws-modules#1614](terraform-aws-modules#1614)) ([b7539dc](terraform-aws-modules@b7539dc))
* Removed ng_depends_on variable and related hack ([terraform-aws-modules#1672](terraform-aws-modules#1672)) ([56e93d7](terraform-aws-modules@56e93d7))
baibailiha added a commit to baibailiha/terraform-aws-eks that referenced this pull request Sep 13, 2022
# [17.24.0](terraform-aws-modules/terraform-aws-eks@v17.23.0...v17.24.0) (2021-11-22)

### Bug Fixes

* Added Deny for CreateLogGroup action in EKS cluster role ([#1594](terraform-aws-modules/terraform-aws-eks#1594)) ([d240238](terraform-aws-modules/terraform-aws-eks@d240238))
* update CI/CD process to enable auto-release workflow ([#1698](terraform-aws-modules/terraform-aws-eks#1698)) ([cd93161](terraform-aws-modules/terraform-aws-eks@cd93161))

### Features

* Add ability to define custom timeout for fargate profiles ([#1614](terraform-aws-modules/terraform-aws-eks#1614)) ([43b675b](terraform-aws-modules/terraform-aws-eks@43b675b))
* Removed ng_depends_on variable and related hack ([#1672](terraform-aws-modules/terraform-aws-eks#1672)) ([e610b83](terraform-aws-modules/terraform-aws-eks@e610b83))
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants