core: fix test fixtures for HCL2 syntax idiom
A number of our test fixtures were previously using the non-idiomatic form of including a single child attribute all on one line with the block header and bounding braces. This non-idiomatic form is an error in HCL2, and hclfmt has always "fixed" it to the expected form of each attribute being on a line of its own, and so here we just update all the affected test fixtures to canonical form (using hclfmt), allowing them to be parsed as intended. Since the these entire files were processed with hclfmt, there are some other unrelated style changes included in situations where the file layouts were non-idiomatic in other ways.
This commit is contained in:
parent
c82e3ec92f
commit
b33a970b62
|
@ -1,5 +1,8 @@
|
||||||
resource "aws_instance" "bar" {
|
resource "aws_instance" "bar" {
|
||||||
count = 2
|
count = 2
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
lifecycle { create_before_destroy = true }
|
|
||||||
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
resource "aws_instance" "bar" {
|
resource "aws_instance" "bar" {
|
||||||
lifecycle { create_before_destroy = true }
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
variable "count" { default = 15 }
|
variable "count" {
|
||||||
|
default = 15
|
||||||
|
}
|
||||||
|
|
||||||
resource "aws_instance" "bar" {
|
resource "aws_instance" "bar" {
|
||||||
count = "${var.count}"
|
count = "${var.count}"
|
||||||
foo = "index-${count.index}"
|
foo = "index-${count.index}"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_instance" "baz" {
|
resource "aws_instance" "baz" {
|
||||||
count = "${var.count}"
|
count = "${var.count}"
|
||||||
foo = "baz-${element(aws_instance.bar.*.foo, count.index)}"
|
foo = "baz-${element(aws_instance.bar.*.foo, count.index)}"
|
||||||
}
|
}
|
||||||
|
|
||||||
output "should-be-11" {
|
output "should-be-11" {
|
||||||
value = "${element(aws_instance.baz.*.foo, 11)}"
|
value = "${element(aws_instance.baz.*.foo, 11)}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
variable "count" { default = 15 }
|
variable "count" {
|
||||||
|
default = 15
|
||||||
|
}
|
||||||
|
|
||||||
resource "aws_instance" "bar" {
|
resource "aws_instance" "bar" {
|
||||||
count = "${var.count}"
|
count = "${var.count}"
|
||||||
foo = "index-${count.index}"
|
foo = "index-${count.index}"
|
||||||
}
|
}
|
||||||
|
|
||||||
output "should-be-11" {
|
output "should-be-11" {
|
||||||
value = "${element(aws_instance.bar.*.foo, 11)}"
|
value = "${element(aws_instance.bar.*.foo, 11)}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
output "foo" { value = "bar" }
|
output "foo" {
|
||||||
|
value = "bar"
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
output "foo" { value = "bar" }
|
output "foo" {
|
||||||
|
value = "bar"
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
provider "another" {
|
provider "another" {
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "another" {
|
provider "another" {
|
||||||
alias = "two"
|
alias = "two"
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "another_instance" "foo" {}
|
resource "another_instance" "foo" {}
|
||||||
resource "another_instance" "bar" { provider = "another.two" }
|
|
||||||
|
resource "another_instance" "bar" {
|
||||||
|
provider = "another.two"
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
module "child" { source = "./child" }
|
module "child" {
|
||||||
|
source = "./child"
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
resource "aws_instance" "foo" { foo = "bar" }
|
resource "aws_instance" "foo" {
|
||||||
|
foo = "bar"
|
||||||
|
}
|
||||||
|
|
||||||
module "child" {
|
module "child" {
|
||||||
source = "./child"
|
source = "./child"
|
||||||
|
|
||||||
var = "${aws_instance.foo.foo}"
|
var = "${aws_instance.foo.foo}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
terraform { required_version = ">= 0.5.0" }
|
terraform {
|
||||||
|
required_version = ">= 0.5.0"
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
resource "aws_instance" "A" {
|
resource "aws_instance" "A" {
|
||||||
lifecycle { create_before_destroy = true }
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_instance" "B" {
|
resource "aws_instance" "B" {
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
resource "aws_instance" "A" {
|
resource "aws_instance" "A" {
|
||||||
lifecycle { create_before_destroy = true }
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_instance" "B" {
|
resource "aws_instance" "B" {
|
||||||
value = ["${aws_instance.A.*.id}"]
|
value = ["${aws_instance.A.*.id}"]
|
||||||
|
|
||||||
lifecycle { create_before_destroy = true }
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
variable "input" {}
|
variable "input" {}
|
||||||
|
|
||||||
resource "null_resource" "foo" {
|
resource "null_resource" "foo" {
|
||||||
triggers { input = "${var.input}" }
|
triggers {
|
||||||
|
input = "${var.input}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output "output" { value = "${null_resource.foo.id}" }
|
output "output" {
|
||||||
|
value = "${null_resource.foo.id}"
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
variable "input" { default = "value" }
|
variable "input" {
|
||||||
|
default = "value"
|
||||||
|
}
|
||||||
|
|
||||||
module "A" {
|
module "A" {
|
||||||
source = "./A"
|
source = "./A"
|
||||||
input = "${var.input}"
|
input = "${var.input}"
|
||||||
}
|
}
|
||||||
|
|
||||||
module "B" {
|
module "B" {
|
||||||
source = "./A"
|
source = "./A"
|
||||||
input = "${module.A.output}"
|
input = "${module.A.output}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
variable "key" {}
|
variable "key" {}
|
||||||
provider "null" { key = "${var.key}" }
|
|
||||||
|
provider "null" {
|
||||||
|
key = "${var.key}"
|
||||||
|
}
|
||||||
|
|
||||||
resource "null_resource" "foo" {}
|
resource "null_resource" "foo" {}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
variable "key" {}
|
variable "key" {}
|
||||||
provider "null" { key = "${var.key}" }
|
|
||||||
|
provider "null" {
|
||||||
|
key = "${var.key}"
|
||||||
|
}
|
||||||
|
|
||||||
resource "null_resource" "foo" {}
|
resource "null_resource" "foo" {}
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
module "child1" { source = "./child1" }
|
module "child1" {
|
||||||
module "child2" { source = "./child2" }
|
source = "./child1"
|
||||||
|
}
|
||||||
|
|
||||||
|
module "child2" {
|
||||||
|
source = "./child2"
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
output "list" { value = "foo,bar,baz" }
|
output "list" {
|
||||||
|
value = "foo,bar,baz"
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
variable "c" { default = 1 }
|
variable "c" {
|
||||||
|
default = 1
|
||||||
|
}
|
||||||
|
|
||||||
resource "template_file" "parent" {
|
resource "template_file" "parent" {
|
||||||
count = "${var.c}"
|
count = "${var.c}"
|
||||||
template = "Hi"
|
template = "Hi"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
resource "aws_instance" "foo" {
|
resource "aws_instance" "foo" {
|
||||||
count = "2"
|
count = "2"
|
||||||
lifecycle { create_before_destroy = true }
|
|
||||||
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_instance" "bar" {
|
resource "aws_instance" "bar" {
|
||||||
count = "2"
|
count = "2"
|
||||||
lifecycle { create_before_destroy = true }
|
|
||||||
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output "out" {
|
output "out" {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
resource "aws_instance" "foo" {
|
resource "aws_instance" "foo" {
|
||||||
lifecycle { create_before_destroy = true }
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
resource "aws_instance" "foo" {
|
resource "aws_instance" "foo" {
|
||||||
count = 2
|
count = 2
|
||||||
num = "2"
|
num = "2"
|
||||||
compute = "${element(data.aws_vpc.bar.*.id, count.index)}"
|
compute = "${element(data.aws_vpc.bar.*.id, count.index)}"
|
||||||
lifecycle { create_before_destroy = true }
|
|
||||||
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data "aws_vpc" "bar" {
|
data "aws_vpc" "bar" {
|
||||||
count = 2
|
count = 2
|
||||||
foo = "${count.index}"
|
foo = "${count.index}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,14 @@ resource "aws_computed_source" "intermediates" {}
|
||||||
module "test_mod" {
|
module "test_mod" {
|
||||||
source = "./mod"
|
source = "./mod"
|
||||||
|
|
||||||
services {
|
services = [
|
||||||
"exists" = "true"
|
{
|
||||||
"elb" = "${aws_computed_source.intermediates.computed_read_only}"
|
"exists" = "true"
|
||||||
}
|
"elb" = "${aws_computed_source.intermediates.computed_read_only}"
|
||||||
|
},
|
||||||
services {
|
{
|
||||||
"otherexists" = " true"
|
"otherexists" = " true"
|
||||||
"elb" = "${aws_computed_source.intermediates.computed_read_only}"
|
"elb" = "${aws_computed_source.intermediates.computed_read_only}"
|
||||||
}
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
variable "foo" { default = "3" }
|
variable "foo" {
|
||||||
|
default = "3"
|
||||||
|
}
|
||||||
|
|
||||||
module "child" {
|
module "child" {
|
||||||
source = "./child"
|
source = "./child"
|
||||||
value = "${var.foo}"
|
value = "${var.foo}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
variable "foo" { default = "3" }
|
variable "foo" {
|
||||||
|
default = "3"
|
||||||
|
}
|
||||||
|
|
||||||
module "child" {
|
module "child" {
|
||||||
source = "./child"
|
source = "./child"
|
||||||
value = "${var.foo}"
|
value = "${var.foo}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
resource "aws_instance" "foo" {
|
resource "aws_instance" "foo" {
|
||||||
count = "${length("abc")}"
|
count = "${length("abc")}"
|
||||||
lifecycle { create_before_destroy = true }
|
|
||||||
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
module "B" { source = "../B" }
|
module "B" {
|
||||||
|
source = "../B"
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
module "C" { source = "../C" }
|
module "C" {
|
||||||
|
source = "../C"
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
variable "foo" { default = "bar" }
|
variable "foo" {
|
||||||
|
default = "bar"
|
||||||
|
}
|
||||||
|
|
||||||
module "child" {
|
module "child" {
|
||||||
source = "./child"
|
source = "./child"
|
||||||
foo = "${var.foo}"
|
foo = "${var.foo}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
resource "aws_instance" "foo" {
|
resource "aws_instance" "foo" {
|
||||||
num = "2"
|
num = "2"
|
||||||
}
|
}
|
||||||
|
|
||||||
output "num" {
|
output "num" {
|
||||||
value = "${aws_instance.foo.num}"
|
value = "${aws_instance.foo.num}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module "child" {
|
module "child" {
|
||||||
source = "./child"
|
source = "./child"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_instance" "bar" {
|
resource "aws_instance" "bar" {
|
||||||
foo = "${module.child.num}"
|
foo = "${module.child.num}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
variable "map_in" {
|
variable "map_in" {
|
||||||
type = "map"
|
type = "map"
|
||||||
default = {
|
|
||||||
us-west-1 = "ami-12345"
|
default = {
|
||||||
us-west-2 = "ami-67890"
|
us-west-1 = "ami-12345"
|
||||||
}
|
us-west-2 = "ami-67890"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have to reference it so it isn't pruned
|
// We have to reference it so it isn't pruned
|
||||||
output "output" { value = "${var.map_in}" }
|
output "output" {
|
||||||
|
value = "${var.map_in}"
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
resource "aws_instance" "foo" {
|
resource "aws_instance" "foo" {
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
}
|
}
|
||||||
|
|
||||||
output "value" { value = "${aws_instance.foo.id}" }
|
output "value" {
|
||||||
|
value = "${aws_instance.foo.id}"
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
variable "key" {}
|
variable "key" {}
|
||||||
provider "null" { key = "${var.key}" }
|
|
||||||
|
provider "null" {
|
||||||
|
key = "${var.key}"
|
||||||
|
}
|
||||||
|
|
||||||
resource "null_resource" "foo" {}
|
resource "null_resource" "foo" {}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
variable "key" {}
|
variable "key" {}
|
||||||
provider "null" { key = "${var.key}" }
|
|
||||||
|
provider "null" {
|
||||||
|
key = "${var.key}"
|
||||||
|
}
|
||||||
|
|
||||||
resource "null_resource" "foo" {}
|
resource "null_resource" "foo" {}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
output "foo" {}
|
output "foo" {
|
||||||
|
value = ""
|
||||||
|
}
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
resource "test" "A" {}
|
resource "test" "A" {}
|
||||||
resource "test" "B" { value = "${test.A.value}" }
|
|
||||||
|
resource "test" "B" {
|
||||||
|
value = "${test.A.value}"
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
resource "aws_instance" "b" {
|
resource "aws_instance" "b" {
|
||||||
value = "foo"
|
value = "foo"
|
||||||
}
|
}
|
||||||
|
|
||||||
output "output" { value = "${aws_instance.b.value}" }
|
output "output" {
|
||||||
|
value = "${aws_instance.b.value}"
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
resource "test" "A" {}
|
resource "test" "A" {}
|
||||||
resource "test" "B" { value = "${test.A.value}" }
|
|
||||||
resource "test" "C" { value = "${test.B.value}" }
|
resource "test" "B" {
|
||||||
|
value = "${test.A.value}"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "test" "C" {
|
||||||
|
value = "${test.B.value}"
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
resource "aws_instance" "foo" {}
|
resource "aws_instance" "foo" {}
|
||||||
resource "aws_instance" "bar" { value = "${aws_instance.foo.value}" }
|
|
||||||
|
resource "aws_instance" "bar" {
|
||||||
|
value = "${aws_instance.foo.value}"
|
||||||
|
}
|
||||||
|
|
||||||
module "child" {
|
module "child" {
|
||||||
source = "./child"
|
source = "./child"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
variable "value" {}
|
variable "value" {}
|
||||||
|
|
||||||
output "result" { value = "${var.value}" }
|
output "result" {
|
||||||
|
value = "${var.value}"
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
variable "value" {}
|
variable "value" {}
|
||||||
|
|
||||||
output "result" { value = "${var.value}" }
|
output "result" {
|
||||||
|
value = "${var.value}"
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
resource "aws_instance" "foo" { count = 3 }
|
resource "aws_instance" "foo" {
|
||||||
|
count = 3
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
resource "aws_instance" "source" { }
|
resource "aws_instance" "source" {}
|
||||||
|
|
||||||
output "sourceout" { value = "${aws_instance.source.id}" }
|
output "sourceout" {
|
||||||
|
value = "${aws_instance.source.id}"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue