Skip to content

Auto-Refactor: Replace deprecated map() with HCL2 map literals in aws_vpc_msk#62

Open
lucasvaltl wants to merge 1 commit into
futurice:masterfrom
lucasvaltl:auto-refactor/replace-deprecated-map-function
Open

Auto-Refactor: Replace deprecated map() with HCL2 map literals in aws_vpc_msk#62
lucasvaltl wants to merge 1 commit into
futurice:masterfrom
lucasvaltl:auto-refactor/replace-deprecated-map-function

Conversation

@lucasvaltl

Copy link
Copy Markdown

Summary

The map() function was deprecated in Terraform v0.12 and fully removed in later versions. All 11 usages across 7 files in aws/aws_vpc_msk/ cause terraform validate to fail with:

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 PR replaces every map("key", "value", ...) call with native HCL2 { "key" = "value" } syntax.

Changes

  • vpc.tf — VPC resource tags
  • security_group.tfKafkaClusterSG and KafkaClientInstanceSG tags
  • subnets.tf — Private and public subnet tags
  • msk-cluster.tf — MSK cluster tags (also picks up terraform fmt fixes for indentation)
  • msk-client.tf — EC2 Kafka client instance tags
  • network-routing.tf — IGW, NAT gateway, and route table tags
  • variables.tfterraform fmt alignment only (no logic changes)

Validation

After the fix, terraform validate no longer reports any map() errors for this module. One pre-existing error remains (ebs_volume_size argument moved to a nested block in newer AWS provider versions) — that is a separate issue unrelated to this change.

The map() function was removed in Terraform v0.12+ and causes
terraform validate to fail. Replace all map() calls with native
HCL2 { key = value } syntax.

Co-authored-by: Ona <no-reply@ona.com>
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

Successfully merging this pull request may close these issues.

1 participant