github.com/hashicorp/packer@v1.14.3/command/test-fixtures/hcl/var-in-pp-name.pkr.hcl (about)

     1  source "null" "example1" {
     2    communicator = "none"
     3  }
     4  
     5  source "null" "example2" {
     6    communicator = "none"
     7  }
     8  
     9  locals {
    10    except_example2 = "null.example2"
    11    true   = true
    12  }
    13  
    14  variable "only_example2" {
    15    default = "null.example2"
    16  }
    17  
    18  variable "foo" {
    19    default = "bar"
    20  }
    21  
    22  build {
    23    sources = ["source.null.example1", "source.null.example2"]
    24    post-processor "shell-local" {
    25      keep_input_artifact = local.true
    26      except              = [local.except_example2]
    27      inline              = ["echo 1 > ${source.name}.1.txt"]
    28    }
    29  
    30    post-processor "shell-local" {
    31      name   = var.foo
    32      only   = [var.only_example2]
    33      inline = ["echo 2 > ${source.name}.2.txt"]
    34    }
    35  }