github.com/hugorut/terraform@v1.1.3/src/terraform/testdata/apply-provisioner-interp-count/provisioner-interp-count.tf (about) 1 variable "num" { 2 default = 3 3 } 4 5 resource "aws_instance" "a" { 6 count = var.num 7 } 8 9 resource "aws_instance" "b" { 10 provisioner "local-exec" { 11 # Since we're in a provisioner block here, this expression is 12 # resolved during the apply walk and so the resource count must 13 # be known during that walk, even though apply walk doesn't 14 # do DynamicExpand. 15 command = "echo ${length(aws_instance.a)}" 16 } 17 }