Created
January 29, 2020 22:48
-
-
Save pkolyvas/5514e7f46a812e3da8dea34b2f395048 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# folder/sources.pkr.hcl | |
source "amazon-ebs" "example" { | |
ami_name = "packer-partyparrot-{{timestamp}}" | |
region = "us-east-1" | |
instance_type = "t2.micro" | |
source_ami_filter { | |
filters { | |
virtualization-type = "hvm" | |
name = "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*" | |
root-device-type = "ebs" | |
} | |
owners = ["amazon"] | |
most_recent = true | |
} | |
communicator = "ssh" | |
ssh_username = "ubuntu" | |
} | |
# folder/build.pkr.hcl | |
// A build starts sources and runs provisioning steps on those sources. | |
build { | |
sources = [ | |
// there can be multiple sources per build | |
"source.amazon-ebs.example" | |
] | |
// All provisioners and post-processors have a 1:1 correspondence to their | |
// current layout. The argument name (ie: inline) must to be unquoted | |
// and can be set using the equal sign operator (=). | |
provisioner "shell" { | |
inline = ["sleep 5"] | |
} | |
provisioner "shell-local" { | |
inline = ["echo the address is: $PACKER_HTTP_ADDR and build name is: $PACKER_BUILD_NAME"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment