From 085ac6d8ca4f3b332d22ecd64a29317195feeee2 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Wed, 20 Feb 2019 15:52:48 -0800 Subject: [PATCH] configs/configupgrade: Test for removing commas between block arguments The comma-separated syntax is now reserved only for object constructor expressions in attribute values, so the upgrade tool rewrites block arguments to be newline-separated instead. This was already working but we didn't have an explicit test for it until now. --- .../valid/argument-commas/input/argument-commas.tf | 7 +++++++ .../valid/argument-commas/want/argument-commas.tf | 9 +++++++++ .../test-fixtures/valid/argument-commas/want/versions.tf | 3 +++ 3 files changed, 19 insertions(+) create mode 100644 configs/configupgrade/test-fixtures/valid/argument-commas/input/argument-commas.tf create mode 100644 configs/configupgrade/test-fixtures/valid/argument-commas/want/argument-commas.tf create mode 100644 configs/configupgrade/test-fixtures/valid/argument-commas/want/versions.tf diff --git a/configs/configupgrade/test-fixtures/valid/argument-commas/input/argument-commas.tf b/configs/configupgrade/test-fixtures/valid/argument-commas/input/argument-commas.tf new file mode 100644 index 000000000..9c15a6fdb --- /dev/null +++ b/configs/configupgrade/test-fixtures/valid/argument-commas/input/argument-commas.tf @@ -0,0 +1,7 @@ +locals { + foo = "bar", baz = "boop" +} + +resource "test_instance" "foo" { + image = "b", type = "d" +} diff --git a/configs/configupgrade/test-fixtures/valid/argument-commas/want/argument-commas.tf b/configs/configupgrade/test-fixtures/valid/argument-commas/want/argument-commas.tf new file mode 100644 index 000000000..c0a514e1c --- /dev/null +++ b/configs/configupgrade/test-fixtures/valid/argument-commas/want/argument-commas.tf @@ -0,0 +1,9 @@ +locals { + foo = "bar" + baz = "boop" +} + +resource "test_instance" "foo" { + image = "b" + type = "d" +} diff --git a/configs/configupgrade/test-fixtures/valid/argument-commas/want/versions.tf b/configs/configupgrade/test-fixtures/valid/argument-commas/want/versions.tf new file mode 100644 index 000000000..d9b6f790b --- /dev/null +++ b/configs/configupgrade/test-fixtures/valid/argument-commas/want/versions.tf @@ -0,0 +1,3 @@ +terraform { + required_version = ">= 0.12" +}