Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: Fixed output when create_api_domain_name is false #44

Merged
merged 5 commits into from
Sep 16, 2021

Conversation

mike-carey
Copy link
Contributor

Description

When disabling the entire module by:

  • Setting create = false
  • Not setting create_api_domain_name = false, the outputs cause a plan time error.

Error:

Error: Error in function call

  on .terraform/modules/environment.maintenance.this.apigateway.this/outputs.tf line 70, in output "apigatewayv2_domain_name_target_domain_name":
  70:   value       = var.create_api_domain_name ? lookup(tomap(element(element(concat(aws_apigatewayv2_domain_name.this.*.domain_name_configuration, [""]), 0), 0)), "target_domain_name", "") : ""
    |----------------
    | aws_apigatewayv2_domain_name.this is empty tuple

Call to function "element" failed: cannot read elements from string.

Error: Error in function call

  on .terraform/modules/environment.maintenance.this.apigateway.this/outputs.tf line 75, in output "apigatewayv2_domain_name_hosted_zone_id":
  75:   value       = var.create_api_domain_name ? lookup(tomap(element(element(concat(aws_apigatewayv2_domain_name.this.*.domain_name_configuration, [""]), 0), 0)), "hosted_zone_id", "") : ""
    |----------------
    | aws_apigatewayv2_domain_name.this is empty tuple

Call to function "element" failed: cannot read elements from string.

Motivation and Context

We would like to disable the module.

Breaking Changes

No

How Has This Been Tested?

  • I have tested and validated these changes using one or more of the provided examples/* projects

Yes, this is to get it to plan properly.

@mike-carey mike-carey changed the title Disables outputs when create is false bug create_api_domain_name is true [bugfix] Disables outputs when create is false bug create_api_domain_name is true Jul 20, 2021
@mike-carey mike-carey changed the title [bugfix] Disables outputs when create is false bug create_api_domain_name is true fix: Disables outputs when create is false bug create_api_domain_name is true Jul 21, 2021
@mike-carey mike-carey changed the title fix: Disables outputs when create is false bug create_api_domain_name is true fix: Disables outputs when create is false but create_api_domain_name is true Aug 10, 2021
@tfrigini
Copy link

Hi, do you have some plan to merge this fix? I'm running into the same problem and done the same fix locally, I came here to check if this problem wasn't seen by anyone to send a fix, but you already had an PR opened.

@antonbabenko antonbabenko changed the title fix: Disables outputs when create is false but create_api_domain_name is true fix: Fixed output when create_api_domain_name is false Sep 16, 2021
@antonbabenko antonbabenko merged commit ed0381d into terraform-aws-modules:master Sep 16, 2021
@antonbabenko
Copy link
Member

Thanks for the PR and nudge. :)

I have updated the code to use Terraform 0.13 and try().

v1.3.0 has been just released.

@github-actions
Copy link

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 Oct 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants