github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/configs/testdata/warning-files/redundant_interp.tf (about) 1 # It's redundant to write an expression that is just a single template 2 # interpolation with another expression inside, like "${foo}", but it 3 # was required before Terraform v0.12 and so there are lots of existing 4 # examples out there using that style. 5 # 6 # We are generating warnings for that situation in order to guide those 7 # who are following old examples toward the new idiom. 8 9 variable "triggers" { 10 type = "map" # WARNING: Quoted type constraints are deprecated 11 } 12 13 provider "null" { 14 foo = "${var.triggers["foo"]}" # WARNING: Interpolation-only expressions are deprecated 15 } 16 17 resource "null_resource" "a" { 18 triggers = "${var.triggers}" # WARNING: Interpolation-only expressions are deprecated 19 20 connection { 21 type = "ssh" 22 host = "${var.triggers["host"]}" # WARNING: Interpolation-only expressions are deprecated 23 } 24 25 provisioner "local-exec" { 26 single = "${var.triggers["greeting"]}" # WARNING: Interpolation-only expressions are deprecated 27 28 # No warning for this one, because there's more than just one interpolation 29 # in the template. 30 template = " ${var.triggers["greeting"]} " 31 32 # No warning for this one, because it's embedded inside a more complex 33 # expression and our check is only for direct assignment to attributes. 34 wrapped = ["${var.triggers["greeting"]}"] 35 } 36 }