Skip to content

Commit

Permalink
feat: Drop random pets from Managed Node Groups
Browse files Browse the repository at this point in the history
  • Loading branch information
BARRY Thierno Ibrahima (Canal Plus Prestataire) committed May 19, 2021
1 parent f719bc8 commit 4071cd8
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 43 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
| <a name="requirement_http"></a> [http](#requirement\_http) | >= 2.4.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 1.11.1 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.4 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.1 |

## Providers

Expand Down
3 changes: 0 additions & 3 deletions modules/node_groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ The role ARN specified in `var.default_iam_role_arn` will be used by default. In
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.22.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.1 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.22.0 |
| <a name="provider_cloudinit"></a> [cloudinit](#provider\_cloudinit) | n/a |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.1 |

## Modules

Expand All @@ -70,7 +68,6 @@ No modules.
|------|------|
| [aws_eks_node_group.workers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_node_group) | resource |
| [aws_launch_template.workers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_template) | resource |
| [random_pet.node_groups](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource |
| [cloudinit_config.workers_userdata](https://registry.terraform.io/providers/hashicorp/cloudinit/latest/docs/data-sources/config) | data source |

## Inputs
Expand Down
8 changes: 4 additions & 4 deletions modules/node_groups/launchtemplate.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ data "cloudinit_config" "workers_userdata" {
# then the default user-data for bootstrapping a cluster is merged in the copy.
resource "aws_launch_template" "workers" {
for_each = { for k, v in local.node_groups_expanded : k => v if v["create_launch_template"] }
name_prefix = lookup(each.value, "name", join("-", [var.cluster_name, each.key, random_pet.node_groups[each.key].id]))
description = lookup(each.value, "name", join("-", [var.cluster_name, each.key, random_pet.node_groups[each.key].id]))
name_prefix = lookup(each.value, "name", join("-", [var.cluster_name, each.key]))
description = lookup(each.value, "name", join("-", [var.cluster_name, each.key]))
update_default_version = true

block_device_mappings {
Expand Down Expand Up @@ -79,7 +79,7 @@ resource "aws_launch_template" "workers" {
lookup(var.node_groups_defaults, "additional_tags", {}),
lookup(var.node_groups[each.key], "additional_tags", {}),
{
Name = lookup(each.value, "name", join("-", [var.cluster_name, each.key, random_pet.node_groups[each.key].id]))
Name = lookup(each.value, "name", join("-", [var.cluster_name, each.key]))
}
)
}
Expand All @@ -93,7 +93,7 @@ resource "aws_launch_template" "workers" {
lookup(var.node_groups_defaults, "additional_tags", {}),
lookup(var.node_groups[each.key], "additional_tags", {}),
{
Name = lookup(each.value, "name", join("-", [var.cluster_name, each.key, random_pet.node_groups[each.key].id]))
Name = lookup(each.value, "name", join("-", [var.cluster_name, each.key]))
}
)
}
Expand Down
2 changes: 1 addition & 1 deletion modules/node_groups/node_groups.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "aws_eks_node_group" "workers" {
for_each = local.node_groups_expanded

node_group_name = lookup(each.value, "name", join("-", [var.cluster_name, each.key, random_pet.node_groups[each.key].id]))
node_group_name_prefix = format("%s-", lookup(each.value, "name", join("-", [var.cluster_name, each.key])))

cluster_name = var.cluster_name
node_role_arn = each.value["iam_role_arn"]
Expand Down
31 changes: 0 additions & 31 deletions modules/node_groups/random.tf

This file was deleted.

3 changes: 1 addition & 2 deletions modules/node_groups/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.22.0"
random = ">= 2.1"
aws = ">= 3.22.0"
}
}
1 change: 0 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ terraform {
required_providers {
aws = ">= 3.37.0"
local = ">= 1.4"
random = ">= 2.1"
kubernetes = ">= 1.11.1"
http = {
source = "terraform-aws-modules/http"
Expand Down

0 comments on commit 4071cd8

Please sign in to comment.