terraform-aws-couchbase icon indicating copy to clipboard operation
terraform-aws-couchbase copied to clipboard

Not able to update load_balancer.https_listener_ports_and_certs

Open raffienficiaud opened this issue 6 years ago • 2 comments

Hi,

I am using terraform 0.12.12 and I have a load_balancer resource pointing to "gruntwork-io/couchbase/aws//modules/load-balancer" version "0.2.2".

When I try to modify the segment https_listener_ports_and_certs by removing one listener and I do a terraform plan, terraform complains with the following message:

Error: Error in function call

  on .terraform/modules/load_balancer/gruntwork-io-terraform-aws-couchbase-b2c210b/modules/load-balancer/outputs.tf line 27, in output "https_listener_arns":
  27:   value = zipmap(
  28:
  29:
  30:
    |----------------
    | aws_alb_listener.https is tuple with 4 elements
    | data.template_file.https_listener_ports is tuple with 3 elements

Call to function "zipmap" failed: number of keys (3) does not match number of
values (4).

This seems to be a terraform issue. Modifying the file gruntwork-io-terraform-aws-couchbase-b2c210b/modules/load-balancer/outputs.tf by explicitly adding a dependency on var.https_listener_ports_and_certs solves the problem:

data "template_file" "https_listener_ports" {
  count    = length(var.https_listener_ports_and_certs)
  template = var.https_listener_ports_and_certs[count.index]["port"]

  depends_on = [
    var.https_listener_ports_and_certs
  ]
}

raffienficiaud avatar Nov 02 '19 17:11 raffienficiaud

Wow, what a strange issue. Perhaps open a bug with in the Terraform repo to ask what could be causing this? I can't understand how adding depends_on could possibly help... But if it does, I suppose a PR to add that as a temporary workaround would be welcome. Thanks!

brikis98 avatar Nov 05 '19 20:11 brikis98

@brikis98 Hi, sorry for the late reply. I just created a tiny PR for addressing this.

raffienficiaud avatar Dec 11 '19 08:12 raffienficiaud

This repo is being archived, feel free to use a fork if necessary.

ellisonc avatar Mar 29 '23 18:03 ellisonc