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

map() deprecated #18

Open
Makuziker opened this issue Dec 14, 2023 · 0 comments
Open

map() deprecated #18

Makuziker opened this issue Dec 14, 2023 · 0 comments

Comments

@Makuziker
Copy link

My terraform version:

Terraform v1.3.7
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.30.0

I'm trying out this awesome looking module and I encountered these errors:

│ Error: Error in function call
│ 
│   on main.tf line 146, in resource "aws_iam_user" "users":
│  146:     map("Name", lookup(each.value, "name")),
│     ├────────────────
│     │ while calling map(vals...)
│ 
│ Call to function "map" failed: the "map" function was deprecated in
│ Terraform v0.12 and is no longer available; use tomap({ ... }) syntax to
│ write a literal map.
╵
╷
│ Error: Error in function call
│ 
│   on main.tf line 246, in resource "aws_iam_role" "roles":
│  246:     map("Name", lookup(each.value, "name")),
│     ├────────────────
│     │ while calling map(vals...)
│ 
│ Call to function "map" failed: the "map" function was deprecated in
│ Terraform v0.12 and is no longer available; use tomap({ ... }) syntax to
│ write a literal map.

This is the page describing the deprecation: https://developer.hashicorp.com/terraform/language/functions/map

I made a local copy of the module and edited those lines to:

tags = merge(
  tomap({ Name = lookup(each.value, "name") }),
  var.tags
)

It looks like it solved the bug on my end. I created a resource with it and got merged tags as I expect. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant