2017-12-25 02:06:54 +00:00
|
|
|
variables:
|
|
|
|
security_group: ""
|
|
|
|
subnet: ""
|
2017-12-25 05:03:53 +00:00
|
|
|
|
|
|
|
# Treat this similar to a ABUILD pkgrel variable and increment with every
|
|
|
|
# release. Packer will notice an exiting AMI at build start and fail unless
|
|
|
|
# it is rmoved. To prevent a period of time where no Alpine AMI exists,
|
|
|
|
# create a new variant. Old AMIs should be pruned at some point.
|
|
|
|
ami_release: "1"
|
|
|
|
|
|
|
|
# Overriding this requires validating that the installation script still
|
|
|
|
# works as expected. It probably does but stuff changes between major
|
|
|
|
# version.
|
2017-12-25 02:06:54 +00:00
|
|
|
alpine_release: "3.7"
|
|
|
|
|
|
|
|
# Don't override this without a good reason and if you do just make sure it
|
|
|
|
# gets passed all the way through to the make_ami script
|
|
|
|
volume_name: "/dev/xvdf"
|
|
|
|
|
|
|
|
builders:
|
|
|
|
- type: "amazon-ebssurrogate"
|
|
|
|
|
|
|
|
# Image is built inside a custom VPC so let Packer use the existing
|
|
|
|
# resources
|
|
|
|
security_group_id: "{{user `security_group`}}"
|
|
|
|
subnet_id: "{{user `subnet`}}"
|
|
|
|
|
|
|
|
# Input Instance Setting
|
|
|
|
instance_type: "t2.micro"
|
|
|
|
launch_block_device_mappings:
|
|
|
|
- volume_type: "gp2"
|
|
|
|
device_name: "{{user `volume_name`}}"
|
2017-12-25 05:03:53 +00:00
|
|
|
delete_on_termination: true
|
2017-12-25 02:06:54 +00:00
|
|
|
volume_size: 5
|
|
|
|
|
|
|
|
# Output AMI Settings
|
|
|
|
ena_support: true
|
2017-12-25 05:03:53 +00:00
|
|
|
ami_name: "Alpine-{{user `alpine_release`}}-r{{user `ami_release`}}-Hardened-EC2"
|
|
|
|
ami_description: "Alpine Linux {{user `alpine_release`}}-r{{user `ami_release`}} Release with Hardened Kernel and EC2 Optimizations"
|
2017-12-25 02:06:54 +00:00
|
|
|
ami_groups:
|
|
|
|
- "all"
|
|
|
|
ami_virtualization_type: "hvm"
|
2017-12-25 05:03:53 +00:00
|
|
|
ami_regions:
|
|
|
|
- us-east-1
|
|
|
|
- us-east-2
|
|
|
|
- us-west-1
|
|
|
|
- us-west-2
|
|
|
|
- ca-central-1
|
|
|
|
- eu-central-1
|
|
|
|
- eu-west-1
|
|
|
|
- eu-west-2
|
|
|
|
# - eu-west-3
|
|
|
|
- ap-northeast-1
|
|
|
|
- ap-northeast-2
|
|
|
|
- ap-southeast-1
|
|
|
|
- ap-southeast-2
|
|
|
|
- ap-south-1
|
|
|
|
- sa-east-1
|
2017-12-25 02:06:54 +00:00
|
|
|
ami_root_device:
|
|
|
|
source_device_name: "{{user `volume_name`}}"
|
|
|
|
device_name: "/dev/xvda"
|
|
|
|
delete_on_termination: true
|
|
|
|
volume_size: 5
|
|
|
|
volume_type: "gp2"
|
|
|
|
|
|
|
|
# Use the most recent Amazon Linux AMI as our base
|
|
|
|
ssh_username: "ec2-user"
|
|
|
|
source_ami_filter:
|
|
|
|
filters:
|
|
|
|
virtualization-type: "hvm"
|
|
|
|
root-device-type: "ebs"
|
|
|
|
architecture: "x86_64"
|
|
|
|
name: "amzn-ami-hvm-*-x86_64-gp2"
|
|
|
|
owners:
|
|
|
|
- "137112412989"
|
|
|
|
most_recent: true
|
|
|
|
|
|
|
|
provisioners:
|
|
|
|
- type: "shell"
|
|
|
|
script: "make_ami.sh"
|
|
|
|
execute_command: "sudo sh -c '{{ .Vars }} {{ .Path }} {{user `volume_name`}}'"
|