github.com/hashicorp/packer@v1.14.3/command/test-fixtures/hcl2_upgrade/source-name/expected.pkr.hcl (about)

     1  # This file was autogenerated by the 'packer hcl2_upgrade' command. We
     2  # recommend double checking that everything is correct before going forward. We
     3  # also recommend treating this file as disposable. The HCL2 blocks in this
     4  # file can be moved to other files. For example, the variable blocks could be
     5  # moved to their own 'variables.pkr.hcl' file, etc. Those files need to be
     6  # suffixed with '.pkr.hcl' to be visible to Packer. To use multiple files at
     7  # once they also need to be in the same folder. 'packer inspect folder/'
     8  # will describe to you what is in that folder.
     9  
    10  # Avoid mixing go templating calls ( for example ```{{ upper(`string`) }}``` )
    11  # and HCL2 calls (for example '${ var.string_value_example }' ). They won't be
    12  # executed together and the outcome will be unknown.
    13  
    14  # See https://www.packer.io/docs/templates/hcl_templates/blocks/packer for more info
    15  packer {
    16    required_version = ">= 1.6.0"
    17    required_plugins {
    18      amazon = {
    19        source  = "github.com/hashicorp/amazon"
    20        version = "~> 1"
    21      }
    22    }
    23  }
    24  
    25  # All generated input variables will be of 'string' type as this is how Packer JSON
    26  # views them; you can change their type later on. Read the variables type
    27  # constraints documentation
    28  # https://www.packer.io/docs/templates/hcl_templates/variables#type-constraints for more info.
    29  variable "aws_access_key" {
    30    type    = string
    31    default = ""
    32  }
    33  
    34  variable "aws_region" {
    35    type = string
    36  }
    37  
    38  variable "aws_secret_key" {
    39    type    = string
    40    default = ""
    41  }
    42  
    43  # "timestamp" template function replacement
    44  locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
    45  
    46  # source blocks are generated from your builders; a source can be referenced in
    47  # build blocks. A build block runs provisioner and post-processors on a
    48  # source. Read the documentation for source blocks here:
    49  # https://www.packer.io/docs/templates/hcl_templates/blocks/source
    50  source "amazon-ebs" "party_parrot" {
    51    access_key      = "${var.aws_access_key}"
    52    ami_description = "Ubuntu 16.04 LTS - expand root partition"
    53    ami_name        = "ubuntu-16-04-test-${local.timestamp}"
    54    encrypt_boot    = true
    55    launch_block_device_mappings {
    56      delete_on_termination = true
    57      device_name           = "/dev/sda1"
    58      volume_size           = 48
    59      volume_type           = "gp2"
    60    }
    61    region              = "${var.aws_region}"
    62    secret_key          = "${var.aws_secret_key}"
    63    source_ami          = "ami1234567"
    64    spot_instance_types = ["t2.small", "t2.medium", "t2.large"]
    65    spot_price          = "0.0075"
    66    ssh_interface       = "session_manager"
    67    ssh_username        = "ubuntu"
    68    temporary_iam_instance_profile_policy_document {
    69      Statement {
    70        Action   = ["*"]
    71        Effect   = "Allow"
    72        Resource = ["*"]
    73      }
    74      Version = "2012-10-17"
    75    }
    76  }
    77  
    78  # a build block invokes sources and runs provisioning steps on them. The
    79  # documentation for build blocks can be found here:
    80  # https://www.packer.io/docs/templates/hcl_templates/blocks/build
    81  build {
    82    sources = ["source.amazon-ebs.party_parrot"]
    83  
    84  }