Auto-Refactor: Replace deprecated map() with HCL2 map literals in aws_vpc_msk#62
Open
lucasvaltl wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
map()function was deprecated in Terraform v0.12 and fully removed in later versions. All 11 usages across 7 files inaws/aws_vpc_msk/causeterraform validateto fail with:This PR replaces every
map("key", "value", ...)call with native HCL2{ "key" = "value" }syntax.Changes
vpc.tf— VPC resource tagssecurity_group.tf—KafkaClusterSGandKafkaClientInstanceSGtagssubnets.tf— Private and public subnet tagsmsk-cluster.tf— MSK cluster tags (also picks upterraform fmtfixes for indentation)msk-client.tf— EC2 Kafka client instance tagsnetwork-routing.tf— IGW, NAT gateway, and route table tagsvariables.tf—terraform fmtalignment only (no logic changes)Validation
After the fix,
terraform validateno longer reports anymap()errors for this module. One pre-existing error remains (ebs_volume_sizeargument moved to a nested block in newer AWS provider versions) — that is a separate issue unrelated to this change.