Skip to content

Commit

Permalink
feat: Removed ng_depends_on variable and related hack (#1672)
Browse files Browse the repository at this point in the history
  • Loading branch information
daroga0002 authored Nov 6, 2021
1 parent fb3a7ce commit 56e93d7
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 17 deletions.
1 change: 0 additions & 1 deletion modules/node_groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ No modules.
| <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_default_iam_role_arn"></a> [default\_iam\_role\_arn](#input\_default\_iam\_role\_arn) | ARN of the default IAM worker role to use if one is not specified in `var.node_groups` or `var.node_groups_defaults` | `string` | `""` | no |
| <a name="input_ebs_optimized_not_supported"></a> [ebs\_optimized\_not\_supported](#input\_ebs\_optimized\_not\_supported) | List of instance types that do not support EBS optimization | `list(string)` | `[]` | no |
| <a name="input_ng_depends_on"></a> [ng\_depends\_on](#input\_ng\_depends\_on) | List of references to other resources this submodule depends on | `any` | `null` | no |
| <a name="input_node_groups"></a> [node\_groups](#input\_node\_groups) | Map of maps of `eks_node_groups` to create. See "`node_groups` and `node_groups_defaults` keys" section in README.md for more details | `any` | `{}` | no |
| <a name="input_node_groups_defaults"></a> [node\_groups\_defaults](#input\_node\_groups\_defaults) | map of maps of node groups to create. See "`node_groups` and `node_groups_defaults` keys" section in README.md for more details | `any` | `{}` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |
Expand Down
1 change: 0 additions & 1 deletion modules/node_groups/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,4 @@ resource "aws_eks_node_group" "workers" {
ignore_changes = [scaling_config[0].desired_size]
}

depends_on = [var.ng_depends_on]
}
8 changes: 0 additions & 8 deletions modules/node_groups/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ variable "node_groups" {
default = {}
}

# Hack for a homemade `depends_on` https://discuss.hashicorp.com/t/tips-howto-implement-module-depends-on-emulation/2305/2
# Will be removed in Terraform 0.13 with the support of module's `depends_on` https://github.com/hashicorp/terraform/issues/10462
variable "ng_depends_on" {
description = "List of references to other resources this submodule depends on"
type = any
default = null
}

variable "ebs_optimized_not_supported" {
description = "List of instance types that do not support EBS optimization"
type = list(string)
Expand Down
8 changes: 1 addition & 7 deletions node_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@ module "node_groups" {

tags = var.tags

# Hack to ensure ordering of resource creation.
# This is a homemade `depends_on` https://discuss.hashicorp.com/t/tips-howto-implement-module-depends-on-emulation/2305/2
# Do not create node_groups before other resources are ready and removes race conditions
# Ensure these resources are created before "unlocking" the data source.
# Will be removed in Terraform 0.13
ng_depends_on = [
depends_on = [
aws_eks_cluster.this,
kubernetes_config_map.aws_auth,
aws_iam_role_policy_attachment.workers_AmazonEKSWorkerNodePolicy,
aws_iam_role_policy_attachment.workers_AmazonEKS_CNI_Policy,
aws_iam_role_policy_attachment.workers_AmazonEC2ContainerRegistryReadOnly
Expand Down

0 comments on commit 56e93d7

Please sign in to comment.