github.com/hashicorp/terraform-plugin-sdk@v1.17.2/terraform/testdata/apply-provisioner-destroy-multiple-locals/main.tf (about)

     1  locals {
     2    value  = "local"
     3    foo_id = aws_instance.foo.id
     4  
     5    // baz is not in the state during destroy, but this is a valid config that
     6    // should not fail.
     7    baz_id = aws_instance.baz.id
     8  }
     9  
    10  resource "aws_instance" "baz" {}
    11  
    12  resource "aws_instance" "foo" {
    13    provisioner "shell" {
    14      id      = self.id
    15      command = local.value
    16      when    = "destroy"
    17    }
    18  }
    19  
    20  resource "aws_instance" "bar" {
    21    provisioner "shell" {
    22      id      = self.id
    23      command = local.foo_id
    24      when    = "destroy"
    25    }
    26  }