github.com/hashicorp/packer@v1.14.3/hcl2template/testdata/init/imports/build.pkr.hcl (about)

     1  
     2  packer {
     3      required_version = ">= v1"
     4  
     5      required_plugins {
     6          amazon = {
     7              source  = "github.com/hashicorp/amazon"
     8              version = ">= v0"
     9          }
    10          amazon-v1 = {
    11              source  = "github.com/hashicorp/amazon"
    12              version = ">= v1"
    13          }
    14          amazon-v2 = {
    15              source  = "github.com/hashicorp/amazon"
    16              version = ">= v2"
    17          }
    18          amazon-v3 = {
    19              source  = "github.com/hashicorp/amazon"
    20              version = ">= v3"
    21          }
    22          amazon-v3-azr = {
    23              source  = "github.com/azr/amazon"
    24              version = ">= v3"
    25          }
    26          amazon-v4 = {
    27              source  = "github.com/hashicorp/amazon"
    28              version = ">= v4"
    29          }
    30      }
    31  }
    32  
    33  // starts resources to provision them.
    34  build {
    35      sources = [ 
    36          "source.virtualbox-iso.ubuntu-1204",
    37      ]
    38  
    39      source "source.amazon-v3-ebs.my-image" {
    40          string = "setting from build section"
    41      }
    42  
    43      provisioner "shell" {
    44          name     = "provisioner that does something"
    45          not_squashed = "${var.foo} ${upper(build.ID)}"
    46          string   = "string"
    47          int      = "${41 + 1}"
    48          int64    = "${42 + 1}"
    49          bool     = "true"
    50          trilean  = true
    51          duration = "${9 + 1}s"
    52          map_string_string = {
    53              a = "b"
    54              c = "d"
    55          }
    56          slice_string = [for s in var.availability_zone_names : lower(s)]
    57          slice_slice_string = [
    58              ["a","b"],
    59              ["c","d"]
    60          ]
    61  
    62          nested {
    63              string   = "string"
    64              int      = 42
    65              int64    = 43
    66              bool     = true
    67              trilean  = true
    68              duration = "10s"
    69              map_string_string = {
    70                  a = "b"
    71                  c = "d"
    72              }
    73              slice_string = [for s in var.availability_zone_names : lower(s)]
    74              slice_slice_string = [
    75                  ["a","b"],
    76                  ["c","d"]
    77              ]
    78          }
    79  
    80          nested_slice {
    81              tag {
    82                  key = "first_tag_key"
    83                  value = "first_tag_value"
    84              }
    85              dynamic "tag" {
    86                  for_each = local.standard_tags
    87                  content {
    88                      key                 = tag.key
    89                      value               = tag.value
    90                  }
    91              }
    92          }
    93      }
    94  
    95      provisioner "file" {
    96          not_squashed = "${var.foo} ${upper(build.ID)}"
    97          string   = "string"
    98          int      = 42
    99          int64    = 43
   100          bool     = true
   101          trilean  = true
   102          duration = "10s"
   103          map_string_string = {
   104              a = "b"
   105              c = "d"
   106          }
   107          slice_string = local.abc_map[*].id
   108          slice_slice_string = [
   109              ["a","b"],
   110              ["c","d"]
   111          ]
   112  
   113          nested {
   114              string   = "string"
   115              int      = 42
   116              int64    = 43
   117              bool     = true
   118              trilean  = true
   119              duration = "10s"
   120              map_string_string = {
   121                  a = "b"
   122                  c = "d"
   123              }
   124              slice_string = [
   125                  "a",
   126                  "b",
   127                  "c",
   128              ]
   129              slice_slice_string = [
   130                  ["a","b"],
   131                  ["c","d"]
   132              ]
   133          }
   134  
   135          nested_slice {
   136              tag {
   137                  key = "first_tag_key"
   138                  value = "first_tag_value"
   139              }
   140              dynamic "tag" {
   141                  for_each = local.standard_tags
   142                  content {
   143                      key                 = tag.key
   144                      value               = tag.value
   145                  }
   146              }
   147          }
   148      }
   149  
   150      post-processor "amazon-import" {
   151          name     = "something"
   152          string   = "string"
   153          int      = 42
   154          int64    = 43
   155          bool     = true
   156          trilean  = true
   157          duration = "10s"
   158          keep_input_artifact = true
   159          map_string_string = {
   160              a = "b"
   161              c = "d"
   162          }
   163          slice_string = [
   164              "a",
   165              "b",
   166              "c",
   167          ]
   168          slice_slice_string = [
   169              ["a","b"],
   170              ["c","d"]
   171          ]
   172          not_squashed = "${var.foo} ${upper(build.ID)}"
   173  
   174          nested {
   175              string   = "string"
   176              int      = 42
   177              int64    = 43
   178              bool     = true
   179              trilean  = true
   180              duration = "10s"
   181              map_string_string = {
   182                  a = "b"
   183                  c = "d"
   184              }
   185              slice_string = [
   186                  "a",
   187                  "b",
   188                  "c",
   189              ]
   190              slice_slice_string = [
   191                  ["a","b"],
   192                  ["c","d"]
   193              ]
   194          }
   195  
   196          nested_slice {
   197              tag {
   198                  key = "first_tag_key"
   199                  value = "first_tag_value"
   200              }
   201              dynamic "tag" {
   202                  for_each = local.standard_tags
   203                  content {
   204                      key                 = tag.key
   205                      value               = tag.value
   206                  }
   207              }
   208          }
   209      }
   210  
   211      post-processor "amazon-import" {
   212          string   = "string"
   213          int      = 42
   214          int64    = 43
   215          bool     = true
   216          trilean  = true
   217          duration = "10s"
   218          map_string_string = {
   219              a = "b"
   220              c = "d"
   221          }
   222          slice_string = [
   223              "a",
   224              "b",
   225              "c",
   226          ]
   227          slice_slice_string = [
   228              ["a","b"],
   229              ["c","d"]
   230          ]
   231          not_squashed = "${var.foo} ${upper(build.ID)}"
   232  
   233          nested {
   234              string   = "string"
   235              int      = 42
   236              int64    = 43
   237              bool     = true
   238              trilean  = true
   239              duration = "10s"
   240              map_string_string = {
   241                  a = "b"
   242                  c = "d"
   243              }
   244              slice_string = [
   245                  "a",
   246                  "b",
   247                  "c",
   248              ]
   249              slice_slice_string = [
   250                  ["a","b"],
   251                  ["c","d"]
   252              ]
   253          }
   254  
   255          nested_slice {
   256          }
   257      }
   258  
   259      post-processors {
   260  
   261          post-processor "amazon-import" {
   262              name     = "first-nested-post-processor"
   263              string   = "string"
   264              int      = 42
   265              int64    = 43
   266              bool     = true
   267              trilean  = true
   268              duration = "10s"
   269              map_string_string = {
   270                  a = "b"
   271                  c = "d"
   272              }
   273              slice_string = [
   274                  "a",
   275                  "b",
   276                  "c",
   277              ]
   278              slice_slice_string = [
   279                  ["a","b"],
   280                  ["c","d"]
   281              ]
   282              not_squashed = "${var.foo} ${upper(build.ID)}"
   283  
   284              nested {
   285                  string   = "string"
   286                  int      = 42
   287                  int64    = 43
   288                  bool     = true
   289                  trilean  = true
   290                  duration = "10s"
   291                  map_string_string = {
   292                      a = "b"
   293                      c = "d"
   294                  }
   295                  slice_string = [
   296                      "a",
   297                      "b",
   298                      "c",
   299                  ]
   300                  slice_slice_string = [
   301                      ["a","b"],
   302                      ["c","d"]
   303                  ]
   304              }
   305  
   306              nested_slice {
   307              }
   308          }
   309  
   310          post-processor "amazon-import" {
   311              name     = "second-nested-post-processor"
   312              string   = "string"
   313              int      = 42
   314              int64    = 43
   315              bool     = true
   316              trilean  = true
   317              duration = "10s"
   318              map_string_string = {
   319                  a = "b"
   320                  c = "d"
   321              }
   322              slice_string = [
   323                  "a",
   324                  "b",
   325                  "c",
   326              ]
   327              slice_slice_string = [
   328                  ["a","b"],
   329                  ["c","d"]
   330              ]
   331              not_squashed = "${var.foo} ${upper(build.ID)}"
   332  
   333              nested {
   334                  string   = "string"
   335                  int      = 42
   336                  int64    = 43
   337                  bool     = true
   338                  trilean  = true
   339                  duration = "10s"
   340                  map_string_string = {
   341                      a = "b"
   342                      c = "d"
   343                  }
   344                  slice_string = [
   345                      "a",
   346                      "b",
   347                      "c",
   348                  ]
   349                  slice_slice_string = [
   350                      ["a","b"],
   351                      ["c","d"]
   352                  ]
   353              }
   354  
   355              nested_slice {
   356              }
   357          }
   358  
   359      }
   360  
   361      post-processors {
   362  
   363          post-processor "amazon-import" {
   364              name     = "third-nested-post-processor"
   365              string   = "string"
   366              int      = 42
   367              int64    = 43
   368              bool     = true
   369              trilean  = true
   370              duration = "10s"
   371              map_string_string = {
   372                  a = "b"
   373                  c = "d"
   374              }
   375              slice_string = [
   376                  "a",
   377                  "b",
   378                  "c",
   379              ]
   380              slice_slice_string = [
   381                  ["a","b"],
   382                  ["c","d"]
   383              ]
   384              not_squashed = "${var.foo} ${upper(build.ID)}"
   385  
   386              nested {
   387                  string   = "string"
   388                  int      = 42
   389                  int64    = 43
   390                  bool     = true
   391                  trilean  = true
   392                  duration = "10s"
   393                  map_string_string = {
   394                      a = "b"
   395                      c = "d"
   396                  }
   397                  slice_string = [
   398                      "a",
   399                      "b",
   400                      "c",
   401                  ]
   402                  slice_slice_string = [
   403                      ["a","b"],
   404                      ["c","d"]
   405                  ]
   406              }
   407  
   408              nested_slice {
   409              }
   410          }
   411  
   412          post-processor "amazon-import" {
   413              name     = "fourth-nested-post-processor"
   414              string   = "string"
   415              int      = 42
   416              int64    = 43
   417              bool     = true
   418              trilean  = true
   419              duration = "10s"
   420              map_string_string = {
   421                  a = "b"
   422                  c = "d"
   423              }
   424              slice_string = [
   425                  "a",
   426                  "b",
   427                  "c",
   428              ]
   429              slice_slice_string = [
   430                  ["a","b"],
   431                  ["c","d"]
   432              ]
   433              not_squashed = "${var.foo} ${upper(build.ID)}"
   434  
   435              nested {
   436                  string   = "string"
   437                  int      = 42
   438                  int64    = 43
   439                  bool     = true
   440                  trilean  = true
   441                  duration = "10s"
   442                  map_string_string = {
   443                      a = "b"
   444                      c = "d"
   445                  }
   446                  slice_string = [
   447                      "a",
   448                      "b",
   449                      "c",
   450                  ]
   451                  slice_slice_string = [
   452                      ["a","b"],
   453                      ["c","d"]
   454                  ]
   455              }
   456  
   457              nested_slice {
   458              }
   459          }
   460  
   461      }
   462  }