Skip to content

fix: Local cluster_name error when var.cluster_arn is empty #218

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

rvaralda
Copy link
Contributor

@rvaralda rvaralda commented Aug 7, 2024

Description

When configuring modules/service to disable service creation with parameters:

  create         = false
  create_service = false

The following error happens

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

╷
│ Error: Invalid function argument
│ 
│   on .terraform/modules/service/main.tf line 1206, in locals:
│ 1206:   cluster_name = element(split("/", var.cluster_arn), 1)
│     ├────────────────
│     │ while calling split(separator, str)
│     │ var.cluster_arn is null
│ 
│ Invalid value for "str" parameter: argument must not be null.
╵

This change make it works in with create true/false without error.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

@rvaralda rvaralda changed the title fix: cluster_name error when var.cluster_arn is empty fix: cluster_name error when var.cluster_arn is empty Aug 7, 2024
@rvaralda rvaralda changed the title fix: cluster_name error when var.cluster_arn is empty fix: Local var cluster_name error when var.cluster_arn is empty Aug 7, 2024
@bryantbiggs bryantbiggs changed the title fix: Local var cluster_name error when var.cluster_arn is empty fix: Local cluster_name error when var.cluster_arn is empty Aug 7, 2024
@bryantbiggs bryantbiggs merged commit 42f11fe into terraform-aws-modules:master Aug 7, 2024
12 of 14 checks passed
antonbabenko pushed a commit that referenced this pull request Aug 7, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
## [5.11.4](v5.11.3...v5.11.4) (2024-08-07)

### Bug Fixes

* Local `cluster_name` error when `var.cluster_arn` is empty ([#218](#218)) ([42f11fe](42f11fe))
@antonbabenko
Copy link
Member

This PR is included in version 5.11.4 🎉

@rvaralda rvaralda deleted the fix-local-cluster-name branch August 8, 2024 14:21
Copy link

github-actions bot commented Sep 8, 2024

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants