Skip to content

Planning fails when module is disabled #248

Closed
@bentmann

Description

@bentmann

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.7.0

The same issue was previously mentioned by #236 (comment) 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛 An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions