terraform-aws-elasticache-redis icon indicating copy to clipboard operation
terraform-aws-elasticache-redis copied to clipboard

Planning fails when module is disabled

Open bentmann opened this issue 1 year ago • 1 comments
trafficstars

Describe the Bug

When the input variable enabled is set to false, terraform fails to plan. The issue exists since https://github.com/cloudposse/terraform-aws-elasticache-redis/releases/tag/1.3.0 up until the current 1.6.0

The same issue was previously mentioned by https://github.com/cloudposse/terraform-aws-elasticache-redis/issues/236#issuecomment-2214176533 but the particular scenario apparently overlooked when a fix was implemented

Expected Behavior

When the module is disabled, terraform plan succeeds.

Steps to Reproduce

Try invoking terraform plan on a project using this module with its enabled argument set to false:

module "redis" {
  enabled = false
  source  = "cloudposse/elasticache-redis/aws"
  version = "1.6.0"
  ...
}

Screenshots

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: Error in function call
│ 
│   on .terraform/modules/redis/main.tf line 113, in locals:
│  113:   endpoint_address = coalesce(local.endpoint_serverless, local.endpoint_cluster, local.endpoint_instance)
│     ├────────────────
│     │ while calling coalesce(vals...)
│     │ local.endpoint_cluster is null
│     │ local.endpoint_instance is null
│     │ local.endpoint_serverless is null
│ 
│ Call to function "coalesce" failed: no non-null, non-empty-string
│ arguments.
╵

Environment

  • Terraform 1.7.5
  • Module version 1.6.0

Additional Context

No response

bentmann avatar Oct 01 '24 13:10 bentmann

For us it happens also when the variable is set to true.

To reproduce:

  • create with cluster mode enable - the first create works
  • Then try just plan without any changes - fails with the same error

Version 1.4.1

ItgixSupport avatar Oct 14 '24 10:10 ItgixSupport