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

Error in outputs when removing folders #16

Closed
morgante opened this issue Oct 17, 2019 · 5 comments · Fixed by #20
Closed

Error in outputs when removing folders #16

morgante opened this issue Oct 17, 2019 · 5 comments · Fixed by #20
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@morgante
Copy link
Contributor

morgante commented Oct 17, 2019

If you remove a folder from the list, it seems to introduce an error. I suspect this is because the resource still exists but the output is being interpolated.

Sample code: https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit/blob/master/infra/terraform/test-org/org/folders.tf#L17

Error:

Error: Error in function call

  on .terraform/modules/folders-root/terraform-google-modules-terraform-google-folders-0c75f1c/outputs.tf line 19, in output "names_and_display_names":
  19:   value       = zipmap(var.names, google_folder.folders.*.display_name)
    |----------------
    | google_folder.folders is tuple with 2 elements
    | var.names is list of string with 1 element

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

Likely fix is simply to only grab the first n google_folder resources for the zipmap.

@morgante morgante added bug Something isn't working good first issue Good for newcomers labels Oct 17, 2019
@ludoo
Copy link
Contributor

ludoo commented Oct 18, 2019

Yup, seen it happen in other places too, my usual workaround is to comment out outputs until things settle (which admittedly is not always possible).

We could remove zipmaps here and in the other multiple-resource modules, that would move the issue downstream in user's code but fix the issue at module levels.

@ludoo
Copy link
Contributor

ludoo commented Nov 5, 2019

@morgante shall we keepp this open? I don't see a good way of fixing this in a non-disruptive way.

@morgante
Copy link
Contributor Author

morgante commented Nov 5, 2019

I think I have a fix.

@morgante
Copy link
Contributor Author

morgante commented Nov 5, 2019

@ludoo Turns out it was a simple fix: #20

@ludoo
Copy link
Contributor

ludoo commented Nov 5, 2019

Simple and elegant, but I think it gives incorrect outputs in some of the cases it aims at fixing. Read my comment on the PR.

morgante added a commit that referenced this issue Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants