cloudposse/terraform-aws-elasticsearch

create variable leads to module failing if set to `false`

Opened this issue · 1 comments

Describe the Bug

If you use the module and pass the variable create with the value false you get a lot of errors regarding the coalesce function used inside the module: Call to function "coalesce" failed: no non-null, non-empty-string arguments which breaks the module completely

Expected Behavior

Setting create to false should allow terraform to succeed and just not create the module (or even remove it if it had been created before)

Steps to Reproduce

Setup the module and pass create with the value false

Screenshots


│ Error: Error in function call

│ on .terraform/modules/tds_opensearch_public.elasticsearch/main.tf line 7, in locals:
│ 7: aws_service_domain_arn = coalesce(join("", aws_elasticsearch_domain.default[].arn), join("", aws_opensearch_domain.default[].arn))
│ ├────────────────
│ │ while calling coalesce(vals...)
│ │ aws_elasticsearch_domain.default is empty tuple
│ │ aws_opensearch_domain.default is empty tuple

│ Call to function "coalesce" failed: no non-null, non-empty-string
│ arguments.


│ Error: Error in function call

│ on .terraform/modules/tds_opensearch_public.elasticsearch/main.tf line 8, in locals:
│ 8: aws_service_domain_endpoint = coalesce(join("", aws_elasticsearch_domain.default[].endpoint), join("", aws_opensearch_domain.default[].endpoint))
│ ├────────────────
│ │ while calling coalesce(vals...)
│ │ aws_elasticsearch_domain.default is empty tuple
│ │ aws_opensearch_domain.default is empty tuple

│ Call to function "coalesce" failed: no non-null, non-empty-string
│ arguments.


│ Error: Error in function call

│ on .terraform/modules/tds_opensearch_public.elasticsearch/main.tf line 9, in locals:
│ 9: aws_service_domain_id = coalesce(join("", aws_elasticsearch_domain.default[].domain_id), join("", aws_opensearch_domain.default[].domain_id))
│ ├────────────────
│ │ while calling coalesce(vals...)
│ │ aws_elasticsearch_domain.default is empty tuple
│ │ aws_opensearch_domain.default is empty tuple

│ Call to function "coalesce" failed: no non-null, non-empty-string
│ arguments.


│ Error: Error in function call

│ on .terraform/modules/tds_opensearch_public.elasticsearch/main.tf line 10, in locals:
│ 10: aws_service_domain_name = coalesce(join("", aws_elasticsearch_domain.default[].domain_name), join("", aws_opensearch_domain.default[].domain_name))
│ ├────────────────
│ │ while calling coalesce(vals...)
│ │ aws_elasticsearch_domain.default is empty tuple
│ │ aws_opensearch_domain.default is empty tuple

│ Call to function "coalesce" failed: no non-null, non-empty-string
│ arguments.


│ Error: Error in function call

│ on .terraform/modules/tds_opensearch_public.elasticsearch/main.tf line 11, in locals:
│ 11: aws_service_domain_kibana_endpoint = coalesce(join("", aws_elasticsearch_domain.default[].kibana_endpoint), join("", aws_opensearch_domain.default[].kibana_endpoint))
│ ├────────────────
│ │ while calling coalesce(vals...)
│ │ aws_elasticsearch_domain.default is empty tuple
│ │ aws_opensearch_domain.default is empty tuple

│ Call to function "coalesce" failed: no non-null, non-empty-string
│ arguments.

Environment

No response

Additional Context

No response

@maximmi @osterman sorry for tagging but this is currently completly preventing us from using this module. Any suggestions or advice regarding this?