Skip to content

Instantly share code, notes, and snippets.

@SwampDragons
Created February 20, 2019 21:12
Show Gist options
  • Save SwampDragons/444a752804c0b47e74137c59fe0e49e8 to your computer and use it in GitHub Desktop.
Save SwampDragons/444a752804c0b47e74137c59fe0e49e8 to your computer and use it in GitHub Desktop.
Cool New Features in Packer Sample Code
{
"builders": [
{
"type": "null",
"communicator": "none"
}
],
"provisioners": [
{
"type": "shell-local",
"inline": "echo hi"
},
{
"type": "breakpoint",
"note": "this is a breakpoint"
},
{
"type": "breakpoint",
"disable": true,
"note": "this is a disabled breakpoint"
},
{
"type": "shell-local",
"inline": "echo hi 2"
}
]
}
{
"builders": [
{
"type": "null",
"communicator": "none"
}
],
"provisioners": [
{
"type": "shell-local",
"environment_vars": ["VERS={{ user `service_version`}}"],
"command": "echo http://download.example.com/version/$VERS"
}
],
"variables": {
"service_version": "{{ consul_key `myservice/version`}}"
}
}
{
"variables": {
"super_secret_password": "ilovewaffles"
},
"sensitive-variables": [
"super_secret_password"
],
"builders": [
{
"type": "null",
"communicator": "none"
}
],
"provisioners": [
{
"type": "shell-local",
"environment_vars": ["MYPASS={{ user `super_secret_password`}}"],
"inline": ["echo $MYPASS > /dev/null"]
}
]
}
{
"builders": [
{
"ami_name": "packer-vault-aws-demo",
"force_deregister": true,
"force_delete_snapshot": true,
"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": ["099720109477"],
"most_recent": true
},
"ssh_username": "ubuntu",
"type": "amazon-ebs",
"vault_aws_engine": {
"name": "my-role"
}
}
],
"provisioners": [
{
"type": "shell",
"inline": ["echo hi"]
}
]
}
{
"builders": [
{
"type": "null",
"communicator": "none"
}
],
"provisioners": [
{
"type": "shell-local",
"environment_vars": ["MYSECRET={{ user `VAULT_SECRET`}}"],
"command": "echo MYSECRET is $MYSECRET"
}
],
"variables": {
"VAULT_SECRET": "{{ vault `/secret/data/hello` `foo`}}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment