terraform/configs/configupgrade
Martin Atkins dd43926761 configs/configupgrade: Fix up uses of the .count pseudo-attribute
Terraform 0.11 and prior had an odd special case where a resource
attribute access for "count" would be resolved as the count for the
whole resource, rather than as an attribute of an individual instance as
for all other attributes.

Because Terraform 0.12 makes test_instance.foo appear as a list when count
is set (so it can be used in other expressions), it's no longer possible
to have an attribute in that position: lists don't have attributes.
Fortunately we don't really need that special case anymore since it
doesn't do anything we can't now do with the length(...) function.

This upgrade rule, then, detects references like test_instance.foo.count
and rewrites to length(test_instance.foo). As a special case, if
test_instance.foo doesn't have "count" set then it just rewrites as the
constant 1, which mimics what would've happened in that case in Terraform
0.11.
2019-02-22 16:18:53 -08:00
..
test-fixtures configs/configupgrade: Fix up uses of the .count pseudo-attribute 2019-02-22 16:18:53 -08:00
analysis.go configs/configupgrade: Include provisioner schemas in analysis 2019-02-22 12:32:56 -08:00
analysis_expr.go configs/configupgrade: Do type inference with input variables 2018-12-07 17:05:36 -08:00
doc.go configupgrade: new package for upgrading configs for 0.12 2018-10-16 18:50:29 -07:00
module_sources.go configupgrade: Load source code for a module and detect already upgraded 2018-10-16 18:50:29 -07:00
module_sources_test.go configupgrade: Load source code for a module and detect already upgraded 2018-10-16 18:50:29 -07:00
upgrade.go configs/configupgrade: Retain any .tf.json files unchanged 2018-12-04 11:37:39 -08:00
upgrade_body.go configs/configupgrade: Default arguments in "connection" blocks 2019-02-22 12:32:56 -08:00
upgrade_expr.go configs/configupgrade: Fix up uses of the .count pseudo-attribute 2019-02-22 16:18:53 -08:00
upgrade_native.go configs/configupgrade: Default arguments in "connection" blocks 2019-02-22 12:32:56 -08:00
upgrade_test.go configs/configupgrade: Default arguments in "connection" blocks 2019-02-22 12:32:56 -08:00
upgrader.go terraform: More wiring in of new provider types 2018-10-16 19:12:54 -07:00