Skip to content

Commit 37d23d3

Browse files
authored
Allow enabled=false (#94)
* Allow enabled=false * Allow examples/complete to be disabled
1 parent aaf53c0 commit 37d23d3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

examples/complete/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
# The usage of the specific kubernetes.io/cluster/* resource tags below are required
2020
# for EKS and Kubernetes to discover and manage networking resources
2121
# https://www.terraform.io/docs/providers/aws/guides/eks-getting-started.html#base-vpc-networking
22-
tags = merge(module.label.tags, map("kubernetes.io/cluster/${module.label.id}", "shared"))
22+
tags = try(merge(module.label.tags, tomap("kubernetes.io/cluster/${module.label.id}", "shared")), null)
2323

2424
# Unfortunately, most_recent (https://github.com/cloudposse/terraform-aws-eks-workers/blob/34a43c25624a6efb3ba5d2770a601d7cb3c0d391/main.tf#L141)
2525
# variable does not work as expected, if you are not going to use custom ami you should
@@ -135,7 +135,7 @@ module "eks_cluster" {
135135
module "eks_node_group" {
136136
source = "../../"
137137

138-
subnet_ids = module.subnets.public_subnet_ids
138+
subnet_ids = module.this.enabled ? module.subnets.public_subnet_ids : ["filler_string_for_enabled_is_false"]
139139
cluster_name = module.eks_cluster.eks_cluster_id
140140
instance_types = var.instance_types
141141
desired_size = var.desired_size

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ data "aws_eks_cluster" "this" {
5656
locals {
5757
ng = {
5858
cluster_name = var.cluster_name
59-
node_role_arn = local.create_role ? join("", aws_iam_role.default.*.arn) : var.node_role_arn[0]
59+
node_role_arn = local.create_role ? join("", aws_iam_role.default.*.arn) : try(var.node_role_arn[0], null)
6060
# Keep sorted so that change in order does not trigger replacement via random_pet
6161
subnet_ids = sort(var.subnet_ids)
6262
# Always supply instance types via the node group, not the launch template,

0 commit comments

Comments
 (0)