github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/configs/configupgrade/testdata/valid/redundant-list/want/redundant-list.tf (about) 1 variable "listy" { 2 type = list(string) 3 } 4 5 resource "test_instance" "other" { 6 count = 2 7 } 8 9 resource "test_instance" "bad1" { 10 security_groups = test_instance.other.*.id 11 } 12 13 resource "test_instance" "bad2" { 14 security_groups = var.listy 15 } 16 17 resource "test_instance" "bad3" { 18 # TF-UPGRADE-TODO: In Terraform v0.10 and earlier, it was sometimes necessary to 19 # force an interpolation expression to be interpreted as a list by wrapping it 20 # in an extra set of list brackets. That form was supported for compatibility in 21 # v0.11, but is no longer supported in Terraform v0.12. 22 # 23 # If the expression in the following list itself returns a list, remove the 24 # brackets to avoid interpretation as a list of lists. If the expression 25 # returns a single list item then leave it as-is and remove this TODO comment. 26 security_groups = [module.foo.outputs_always_dynamic] 27 } 28 29 resource "test_instance" "bad4" { 30 security_groups = ["a", "b", "c"] 31 } 32 33 resource "test_instance" "bad5" { 34 security_groups = test_instance.bad1.subnet_ids # this one references a set 35 } 36 37 resource "test_instance" "bad6" { 38 subnet_ids = test_instance.bad1.security_groups # this one defines a set 39 } 40 41 resource "test_instance" "bad7" { 42 subnet_ids = test_instance.bad1.*.id # this one defines a set 43 } 44 45 # The rest of these should keep the same amount of list-ness 46 47 resource "test_instance" "ok1" { 48 security_groups = [] 49 } 50 51 resource "test_instance" "ok2" { 52 security_groups = ["notalist"] 53 } 54 55 resource "test_instance" "ok3" { 56 security_groups = [path.module] 57 } 58 59 resource "test_instance" "ok4" { 60 security_groups = [["foo"], ["bar"]] 61 } 62 63 resource "test_instance" "ok5" { 64 security_groups = test_instance.other.*.id 65 } 66 67 resource "test_instance" "ok6" { 68 security_groups = [ 69 test_instance.other1.*.id, 70 test_instance.other2.*.id, 71 ] 72 }