cloudposse / terraform-aws-nlb

Terraform module to provision a standard NLB for TCP/UDP/TLS traffic https://cloudposse.com/accelerate
https://cloudposse.com/accelerate
Apache License 2.0
24 stars 36 forks source link

'enabled' input is broken #52

Open karaluh opened 1 year ago

karaluh commented 1 year ago

Describe the Bug

The 'enabled' input value is not actually used in the code for most of the resources. terraform plan for this module with enabled = false not only wants to create the NLB but also fails with an error:

Plan: 1 to add, 0 to change, 0 to destroy. ╷ │ Error: only alphanumeric characters and hyphens allowed in "name" │ │ with module.nlb.aws_lb_target_group.default[0], │ on .terraform/modules/nlb/main.tf line 109, in resource "aws_lb_target_group" "default": │ 109: name = var.target_group_name == "" ? module.default_target_group_label.id : var.target_group_name │

Expected Behavior

The input value should be respected for all resources.

Steps to Reproduce

execute terraform plan for the code below.

module "nlb" {
  source  = "cloudposse/nlb/aws"
  version = "0.15.0"
  enabled = false

  vpc_id     = "vpc"
  subnet_ids = ["subnet"]
}

Screenshots

No response

Environment

No response

Additional Context

No response

QuentinBtd commented 7 months ago

I will open a PR in next days to fix that. I think this will include a breaking change

QuentinBtd commented 7 months ago

Can be closed 😄

karaluh commented 2 months ago

Not quite:

│ Error: only alphanumeric characters and hyphens allowed in "name"
│ 
│   with module.nlb.aws_lb_target_group.default[0],
│   on .terraform/modules/nlb/main.tf line 155, in resource "aws_lb_target_group" "default":
│  155:   name                 = var.target_group_name == "" ? module.default_target_group_label.id : var.target_group_name
│