terraform/config/test-fixtures
Martin Atkins 410b60cb7f Stop requiring multi-vars (splats) to be in array brackets
Prior to Terraform 0.7, lists in Terraform were just a shallow abstraction
on top of strings with a magic delimiter between items. Wrapping a single
string in brackets in the configuration was Terraform's prompt that it
needed to split the string on that delimiter during interpolation.

In 0.7, when first-class lists were added, this convention was preserved
by flattening lists-of-lists by one level when they were encountered in
configuration. However, there was an oversight in that change where it
did not correctly handle the case where the inner list was unknown.

In #14135 we removed some code that was flattening partially-unknown lists
into fully-unknown (untyped) values. This inadvertently exposed the missed
case from the previous paragraph, causing issues for list-wrapped splat
expressions with unknown members. While this worked fine for resources,
due to some fixup done inside helper/schema, this did not work for other
interpolation contexts such as module blocks.

Various attempts to fix this up and restore the flattening behavior
selectively were unsuccessful, due to a proliferation of assumptions all
over the core code that would be too risky to change just to fix this bug.

This change, then, takes the different approach of removing the
requirement that splats be presented inside list brackets. This
requirement didn't make much sense anymore anyway, since no other
list-returning expression had this constraint and so the rest of Terraform
was already successfully dealing with both cases.

This leaves us with two different scenarios:

- For resource arguments, existing normalization code in helper/schema
  does its own flattening that preserves compatibility with the common
  practice of using bracketed splats. This change proves this with a test
  within the "test" provider that exercises the whole Terraform core and
  helper/schema stack that assigns bracketed splats to list and set
  attributes.

- For arguments in other blocks, such as in module callsites, the
  interpolator's own flattening behavior applies to known lists,
  preserving compatibility with configurations from before
  partially-computed splats were possible, but those wishing to use
  partially-computed splats are required to drop the surrounding brackets.
  This is less concerning because this scenario was introduced only in
  0.9.5, so the scope for breakage is limited to those who adopted this
  new feature quickly after upgrading.

As of this commit, the recommendation is to stop using brackets around
splats but the old form continues to be supported for backward
compatibility. In a future _major_ version of Terraform we will probably
phase out this legacy form to improve consistency, but for now both
forms are acceptable at the expense of some (pre-existing) weird behavior
when _actual_ lists-of-lists are used.

This addresses #14521 by officially adopting the suggested workaround of
dropping the brackets around the splat. However, it doesn't yet allow
passing of a partially-unknown list between modules: that still violates
assumptions in Terraform's core, so for the moment partially-unknown lists
work only within a _single_ interpolation expression, and cannot be
passed around between expressions. Until more holistic work is done to
improve Terraform's type handling, passing a partially-unknown splat
through to a module will result in a fully-unknown list emerging on
the other side, just as was the case before #14135; this change just
addresses the fact that this was failing with an error in 0.9.5.
2017-05-23 11:22:37 -07:00
..
backend-hash-basic config: add "backend" loading to the Terraform section 2017-01-26 14:33:49 -08:00
backend-hash-empty config: add "backend" loading to the Terraform section 2017-01-26 14:33:49 -08:00
backend-hash-no-terraform config: add "backend" loading to the Terraform section 2017-01-26 14:33:49 -08:00
backend-hash-type-only config: add "backend" loading to the Terraform section 2017-01-26 14:33:49 -08:00
copy-basic core: Make copies when creating destroy nodes 2016-02-09 09:25:16 -06:00
count-int config: add Config method 2014-10-02 11:34:08 -07:00
count-list config: Resource.Count should type check 2017-02-10 10:41:41 -08:00
count-string config: add Config method 2014-10-02 11:34:08 -07:00
count-var config: add Config method 2014-10-02 11:34:08 -07:00
data-count Add a test load of a data source with count 2016-09-03 13:08:41 -07:00
dir-basic config: Data source loading 2016-05-14 08:26:35 -07:00
dir-empty config: LoadDir with no matching files errors 2014-07-11 21:04:59 -07:00
dir-merge config: HCL loader 2014-08-11 09:58:53 -07:00
dir-override config: Data source loading 2016-05-14 08:26:35 -07:00
dir-override-var config: test for var uniqueness in overrides 2016-08-26 13:48:21 -07:00
dir-temporary-files Ignore hidden files per Unix conventions 2015-03-18 07:50:33 +00:00
empty-collections core: Fix detection of empty list/map defaults 2016-06-12 11:19:03 +02:00
import dos2unix 2014-07-28 10:43:00 -07:00
interpolations config: unit tests for lexer 2014-09-09 14:34:03 -07:00
validate-backend-interpolate config: validate backend configuration can't contain interpolations 2017-02-17 16:27:01 -08:00
validate-bad-depends-on dos2unix 2014-07-28 10:43:00 -07:00
validate-bad-multi-resource dos2unix 2014-07-28 10:43:00 -07:00
validate-bad-tf-version config: parse and validate terraform.required_version 2016-11-12 16:22:35 -08:00
validate-basic-provisioners config: parse "when" and "on_failure" on provisioners 2017-01-19 18:10:21 -08:00
validate-count-bad-context core: protect against count.index in modules 2015-04-15 10:41:56 -05:00
validate-count-below-zero dos2unix 2014-07-28 10:43:00 -07:00
validate-count-count-var config: count can't interpolate count variables 2014-10-02 18:22:32 -07:00
validate-count-int config: validate that count is an int 2014-10-02 16:51:20 -07:00
validate-count-module-var config: validate that only proper variables can be in the count 2014-10-02 16:30:46 -07:00
validate-count-not-int config: validate that count is an int 2014-10-02 16:51:20 -07:00
validate-count-resource-var config: validate that only proper variables can be in the count 2014-10-02 16:30:46 -07:00
validate-count-resource-var-multi command/meta: validate config immediately 2016-09-03 15:26:49 -07:00
validate-count-user-var config: validate that only proper variables can be in the count 2014-10-02 16:30:46 -07:00
validate-count-var config: validate good count variables 2014-10-02 18:25:18 -07:00
validate-count-var-invalid config: validate that count vars are valid types 2014-10-02 18:24:37 -07:00
validate-count-var-unknown config: count can't be a SimpleVariable 2016-08-16 13:48:12 -07:00
validate-count-zero dos2unix 2014-07-28 10:43:00 -07:00
validate-data-provisioner config: validate that data sources don't have provisioners 2016-11-23 08:46:13 -08:00
validate-depends-on-bad-module config: validate depends_on with module values 2016-11-12 08:21:27 -08:00
validate-depends-on-module config: validate depends_on with module values 2016-11-12 08:21:27 -08:00
validate-depends-on-var config: depends on cannot contain interpolations [GH-985] 2015-02-20 09:07:41 -08:00
validate-dup-module config: validate no duplicate modules 2014-09-11 16:02:36 -07:00
validate-dup-resource dos2unix 2014-07-28 10:43:00 -07:00
validate-good core: Better error for dot indexing on user vars 2016-06-12 10:45:48 -05:00
validate-ignore-changes Add wildcard (match all) support to ignore_changes (#8599) 2016-09-02 15:44:35 +02:00
validate-ignore-changes-bad Add wildcard (match all) support to ignore_changes (#8599) 2016-09-02 15:44:35 +02:00
validate-ignore-changes-interpolate config: ignore_changes cannot have interpolations 2016-10-24 23:06:33 -07:00
validate-module-name-bad config: validate module names are valid 2014-10-08 16:03:22 -07:00
validate-module-source-var config: validate that module source can't contain interpolations 2014-10-07 20:19:32 -07:00
validate-module-var-int config: validate that module variables can go to ints, convert [GH-624] 2014-12-15 22:10:16 -08:00
validate-module-var-list core: support native list variables in config 2016-05-10 14:49:14 -04:00
validate-module-var-map core: support native list variables in config 2016-05-10 14:49:14 -04:00
validate-module-var-self config: error in validation if module has self variable 2015-04-22 10:39:07 +02:00
validate-output-bad-field dos2unix 2014-07-28 10:43:00 -07:00
validate-output-description core: allow outputs to have descriptions (#9722) 2016-11-18 19:09:43 +02:00
validate-output-dup config: outputs must be unique 2016-08-25 14:43:57 -07:00
validate-path-var config: parse ${path.module} 2014-10-07 18:03:11 -07:00
validate-path-var-invalid config: parse ${path.module} 2014-10-07 18:03:11 -07:00
validate-prov-conn-splat-other config: test we can ref splat of other resources 2015-02-20 09:19:13 -08:00
validate-prov-conn-splat-self config: validate configuration doens't contain splats to ourselves 2015-02-20 09:18:08 -08:00
validate-prov-splat-other config: validate provisioner splats can only reference others 2015-02-20 09:21:29 -08:00
validate-prov-splat-self config: validate provisioner splats can only reference others 2015-02-20 09:21:29 -08:00
validate-provider-multi config: validate that a multi provider is only configured once each 2015-04-20 14:25:33 -07:00
validate-provider-multi-good config: happy case test for multiple providers 2015-04-20 14:27:44 -07:00
validate-provider-multi-ref-bad config: test that resources reference good providers 2015-04-20 14:47:31 -07:00
validate-provider-multi-ref-good config: test that resources reference good providers 2015-04-20 14:47:31 -07:00
validate-resource-prov-self config: self var validation 2015-02-23 14:43:14 -08:00
validate-resource-self config: self var validation 2015-02-23 14:43:14 -08:00
validate-tf-version config: parse and validate terraform.required_version 2016-11-12 16:22:35 -08:00
validate-tf-version-interp config: parse and validate terraform.required_version 2016-11-12 16:22:35 -08:00
validate-unknown-resource-var dos2unix 2014-07-28 10:43:00 -07:00
validate-unknown-resource-var-output dos2unix 2014-07-28 10:43:00 -07:00
validate-unknownthing config: HCL loader 2014-08-11 09:58:53 -07:00
validate-unknownvar config: HCL loader 2014-08-11 09:58:53 -07:00
validate-unknownvar-count config: validate unknown var in count 2014-10-02 11:18:57 -07:00
validate-var-default config: vars must be unique 2016-08-25 14:51:49 -07:00
validate-var-default-interpolate config: validate no interp in var [GH-180] 2014-08-11 09:46:56 -07:00
validate-var-default-interpolate-escaped Allow escaped interpolation-like sequences in variable defaults 2017-03-29 09:25:57 -07:00
validate-var-default-list-type core: support native list variables in config 2016-05-10 14:49:14 -04:00
validate-var-dup config: vars must be unique 2016-08-25 14:51:49 -07:00
validate-var-module config: validate that variables reference valid modules 2014-09-15 11:45:41 -07:00
validate-var-module-invalid config: validate that variables reference valid modules 2014-09-15 11:45:41 -07:00
validate-var-multi-exact-non-slice config: allow exact multi-resource references outside slices 2014-10-11 17:20:39 -07:00
validate-var-multi-func config: multi-variable access in slice validation fixed [GH-798] 2015-01-15 09:40:13 -08:00
validate-var-nested Add test for Validate crash 2017-03-07 15:01:29 -05:00
.gitattributes Add regression test for #4069 2015-12-01 13:37:18 -05:00
attributes.tf Add failing tests for JSON configuration parsing 2015-11-19 16:06:30 +02:00
attributes.tf.json Add failing tests for JSON configuration parsing 2015-11-19 16:06:30 +02:00
bad-variable-type.tf core: Support explicit variable type declaration 2016-01-24 11:40:02 -06:00
bad_type.tf.nope dos2unix 2014-07-28 10:43:00 -07:00
basic.tf config: parse and validate terraform.required_version 2016-11-12 16:22:35 -08:00
basic.tf.json config: Data source loading 2016-05-14 08:26:35 -07:00
connection.tf dos2unix 2014-07-28 10:43:00 -07:00
create-before-destroy.tf terraform: Adding lifecycle config block 2014-09-29 15:20:02 -07:00
data-source-arity-mistake.tf config: Data source loading 2016-05-14 08:26:35 -07:00
empty.tf config: add test for empty file 2014-09-15 09:41:00 -07:00
escapedquotes.tf config: test covering escaped quotes syntax error 2015-11-19 12:11:42 -06:00
git-crypt.tf config: test that null characters show up as errors in parse 2016-11-21 18:11:11 -08:00
heredoc.tf config: test replicating #4079 2015-12-01 10:31:05 -06:00
ignore-changes.tf Adding ignore_changes lifecycle meta property 2015-10-14 16:34:27 -05:00
import.tf config: HCL loader 2014-08-11 09:58:53 -07:00
lifecycle_cbd_typo.tf config: validate lifecycle keys [GH-4413] 2016-01-19 11:28:45 -08:00
module-unnamed.tf config: generate errors for unnamed blocks of various sources 2017-05-02 16:29:57 -07:00
modules.tf config: change module syntax 2014-09-14 14:43:54 -07:00
output-depends-on.tf config: parse depends_on for outputs 2016-11-11 17:46:34 -08:00
output-unnamed.tf config: generate errors for unnamed blocks of various sources 2017-05-02 16:29:57 -07:00
prevent-destroy-string.tf config: parse lifecycle block with mapstructure for weak decode 2015-06-07 22:04:23 -07:00
provisioners-destroy.tf config: parse "when" and "on_failure" on provisioners 2017-01-19 18:10:21 -08:00
provisioners.tf dos2unix 2014-07-28 10:43:00 -07:00
resource-arity-mistake.tf config: friendlier error message on resource arity mismatch 2015-12-09 18:05:49 -06:00
resource-multi-lifecycle.tf config: error when loading multiple lifecycle blocks 2016-12-10 18:52:13 -05:00
resource-no-name.tf.json config: JSON resource keys with only one item load properly GH-5140 2016-08-25 17:18:18 -07:00
terraform-backend-2.tf.json restructure JSON terraform config block AST 2017-03-21 18:15:58 -04:00
terraform-backend-multi.tf config: add "backend" loading to the Terraform section 2017-01-26 14:33:49 -08:00
terraform-backend.tf config: add "backend" loading to the Terraform section 2017-01-26 14:33:49 -08:00
terraform-backend.tf.json config: test that JSON loading terraform backend info works 2017-03-16 14:51:26 -07:00
var-invalid-key.tf config: validate invalid variable keys 2016-12-10 19:27:01 -05:00
var_int.tf config: disallow names starting with ints 2016-12-08 23:01:51 -05:00
var_int_bare.tf config: disallow names starting with ints 2016-12-08 23:01:51 -05:00
variable-mismatched-type.tf core: Support explicit variable type declaration 2016-01-24 11:40:02 -06:00
variable-no-name.tf config: generate errors for unnamed blocks of various sources 2017-05-02 16:29:57 -07:00
variables.tf dos2unix 2014-07-28 10:43:00 -07:00
windows-line-endings.tf Add regression test for #4069 2015-12-01 13:37:18 -05:00