printer: fix assigning equal sign for multi keys
This commit is contained in:
parent
69f125c80f
commit
5e525249f3
@ -50,7 +50,7 @@ func (p *printer) objectItem(o *ast.ObjectItem) []byte {
|
|||||||
buf.WriteByte(blank)
|
buf.WriteByte(blank)
|
||||||
|
|
||||||
// reach end of key
|
// reach end of key
|
||||||
if i == len(o.Keys)-1 {
|
if i == len(o.Keys)-1 && len(o.Keys) == 1 {
|
||||||
buf.WriteString("=")
|
buf.WriteString("=")
|
||||||
buf.WriteByte(blank)
|
buf.WriteByte(blank)
|
||||||
}
|
}
|
||||||
|
14
printer/testdata/complexhcl.golden
vendored
14
printer/testdata/complexhcl.golden
vendored
@ -1,22 +1,22 @@
|
|||||||
variable "foo" = {
|
variable "foo" {
|
||||||
default = "bar"
|
default = "bar"
|
||||||
description = "bar"
|
description = "bar"
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "aws" = {
|
provider "aws" {
|
||||||
access_key = "foo"
|
access_key = "foo"
|
||||||
secret_key = "bar"
|
secret_key = "bar"
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "do" = {
|
provider "do" {
|
||||||
api_key = "${var.foo}"
|
api_key = "${var.foo}"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_security_group" "firewall" = {
|
resource "aws_security_group" "firewall" {
|
||||||
count = 5
|
count = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
resource aws_instance "web" = {
|
resource aws_instance "web" {
|
||||||
ami = "${var.foo}"
|
ami = "${var.foo}"
|
||||||
security_groups = [
|
security_groups = [
|
||||||
"foo",
|
"foo",
|
||||||
@ -28,12 +28,12 @@ resource aws_instance "web" = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_instance" "db" = {
|
resource "aws_instance" "db" {
|
||||||
security_groups = "${aws_security_group.firewall.*.id}"
|
security_groups = "${aws_security_group.firewall.*.id}"
|
||||||
VPC = "foo"
|
VPC = "foo"
|
||||||
depends_on = [ "aws_instance.web"]
|
depends_on = [ "aws_instance.web"]
|
||||||
}
|
}
|
||||||
|
|
||||||
output "web_ip" = {
|
output "web_ip" {
|
||||||
value = "${aws_instance.web.private_ip}"
|
value = "${aws_instance.web.private_ip}"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user