-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Diff output incorrectly double-quotes map keys on update #30854
Copy link
Copy link
Closed
Labels
bugcliconfirmeda Terraform Core team member has reproduced this issuea Terraform Core team member has reproduced this issue
Description
Terraform Version
Terraform v1.1.8
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v4.9.0
Terraform Configuration Files
provider "aws" {
region = "us-east-1"
}
variable "use_tags" {
default = false
}
locals {
tags = {
foo = "my"
"bar" = "test"
"foo/bar" = "my-test"
}
}
resource "aws_instance" "web" {
ami = "ami-2757f631"
instance_type = "t2.micro"
tags = var.use_tags ? local.tags : null
}Expected Behavior
# aws_instance.web will be updated in-place
~ resource "aws_instance" "web" {
id = "i-005c16f62aeb7220a"
~ tags = {
+ "bar" = "test"
+ "foo" = "my"
+ "foo/bar" = "my-test"
}
~ tags_all = {
+ "bar" = "test"
+ "foo" = "my"
+ "foo/bar" = "my-test"
}
Actual Behavior
# aws_instance.web will be updated in-place
~ resource "aws_instance" "web" {
id = "i-005c16f62aeb7220a"
~ tags = {
+ "bar" = "test"
+ "foo" = "my"
+ "\"foo/bar\"" = "my-test"
}
~ tags_all = {
+ "bar" = "test"
+ "foo" = "my"
+ "\"foo/bar\"" = "my-test"
}
Steps to Reproduce
Create a resource with no tags, then plan to add tags:
terraform initterraform apply -auto-approve3.terraform plan -var use_tags=true
References
- Reported by @stevehipwell in the post-merge comments of command/format: Correctly quote diff object keys #30766, which probably introduced this behaviour
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugcliconfirmeda Terraform Core team member has reproduced this issuea Terraform Core team member has reproduced this issue