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

6.11.0 does not adhere to semver: iteration over null value #250

Closed
Fabian1976 opened this issue May 30, 2022 · 3 comments
Closed

6.11.0 does not adhere to semver: iteration over null value #250

Fabian1976 opened this issue May 30, 2022 · 3 comments

Comments

@Fabian1976
Copy link

Description

In our terraform code we have this defined:

module "FPX-NLB" {
  source  = "terraform-aws-modules/alb/aws"
  version = "~> 6.5"

So according to semver, we should be good with all updated above 6.5. But our terraform pipeline recently failed for unknown reasons (we didn't update any versions). So by comparing the last run which worked to the failed run, we found that the AWS ALB module was the only one that was updated by a minor version (from 6.10.0 to 6.11.0). Normally this shouldn't be an issue when properly adhering to semver. But version 6.11.0 gave this error in our pipeline:

Error: Iteration over null value

  on .terraform/modules/FPX-NLB/main.tf line 140, in locals:
 139:   target_group_attachments_lambda = {
 140:     for k, v in local.target_group_attachments :
 141:     (k) => merge(v, { lambda_function_name = split(":", v.target_id)[6] })
 142:     if try(v.attach_lambda_permission, false)
 143:   }
    |----------------
    | local.target_group_attachments is null

A null value cannot be used as the collection in a 'for' expression.

So apparently something was added in a non backwards compatible way.

Versions

  • Module version [Required]: 6.11.0

Reproduction Code [Required]

Steps to reproduce the behavior:

Expected behavior

Because of a minor update, the existing terraform code should keep working without changes.

Actual behavior

producing this error:

Error: Iteration over null value

  on .terraform/modules/FPX-NLB/main.tf line 140, in locals:
 139:   target_group_attachments_lambda = {
 140:     for k, v in local.target_group_attachments :
 141:     (k) => merge(v, { lambda_function_name = split(":", v.target_id)[6] })
 142:     if try(v.attach_lambda_permission, false)
 143:   }
    |----------------
    | local.target_group_attachments is null

A null value cannot be used as the collection in a 'for' expression.

Should we add some code to terraform to fix this? Is this documented somewhere?

@antonbabenko
Copy link
Member

Hi @Fabian1976 !

You are right, I have just removed the incorrect version (6.11.0) to avoid unnecessary confusion since it does not work.

Please use v7.0.0 (#249) if you can upgrade, or v6.10.0 if you can't.

@Fabian1976
Copy link
Author

Tnx for the quick response!

@github-actions
Copy link

I'm going to lock this issue 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 similar to this, 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 Nov 15, 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

No branches or pull requests

2 participants