Skip to content

Instantly share code, notes, and snippets.

@limakzi
Last active June 6, 2019 22:35
Show Gist options
  • Save limakzi/3eefda80b89415591d1105b94b10663a to your computer and use it in GitHub Desktop.
Save limakzi/3eefda80b89415591d1105b94b10663a to your computer and use it in GitHub Desktop.
hlc2-map-with-list
locals {
a = map("key-a", list("val-a", "val-b"))
}
locals {
b = lookup(local.a, "key-a")
}
@limakzi
Copy link
Author

limakzi commented Jun 6, 2019

❯ terraform console

Warning: Due to the problems above, some expressions may produce unexpected results.



Error: Error in function call

>   on /tmp/sample.tf line 6, in locals:
   6:   b = lookup(local.a, "key-a")
    |----------------
    | local.a is map of list of string with 1 element

Call to function "lookup" failed: lookup() can only be used with flat lists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment