cloudposse / terraform-aws-dynamic-subnets

Terraform module for public and private subnets provisioning in existing VPC
https://cloudposse.com/accelerate
Apache License 2.0
197 stars 167 forks source link

Remove use of deprecated map() #126

Closed alexjurkiewicz closed 3 years ago

alexjurkiewicz commented 3 years ago

Remove use of deprecated map()

This function is removed in the upcoming Terraform 0.15. Since Terraform 0.12, you can create maps with a literal syntax instead.

what

why

Adds compatibility with Terraform 0.15. Without this, you'll see errors like:

│ Error: Error in function call
│
│   on .terraform/modules/dynamic_subnets/private.tf line 8, in module "private_label":
│    8:     map(var.subnet_type_tag_key, format(var.subnet_type_tag_value_format, "private"))
│     ├────────────────
│     │ var.subnet_type_tag_key is a string, known only after apply
│     │ var.subnet_type_tag_value_format is a string, known only after apply
│
│ 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.
Nuru commented 3 years ago

/test all

Nuru commented 3 years ago

@alexjurkiewicz Thank you for this contribution. Unfortunately, we still need a bit more. First, please fix the following error (only first instance is copied below, but of course it happens twice):

Error: Ambiguous attribute key

  on public.tf line 8, in module "public_label":
   8:     { var.subnet_type_tag_key = format(var.subnet_type_tag_value_format, "public") }

If this expression is intended to be a reference, wrap it in parentheses. If
it's instead intended as a literal name containing periods, wrap it in quotes
to create a string literal.

Then, before you push your changes to the branch, please run

make init
make pr/auto-format

and include the changes in your commit. (We are close to eliminating this requirement, but have not quite gotten there yet.)

Thanks again.

alexjurkiewicz commented 3 years ago

/test all

Gowiem commented 3 years ago

/test all

Gowiem commented 3 years ago

/rebuild-readme

Gowiem commented 3 years ago

/test all