-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #964 from gruntwork-io/support-packer-init
Support for packer v1.7.0
- Loading branch information
Showing
23 changed files
with
403 additions
and
128 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
packer { | ||
required_plugins { | ||
googlecompute = { | ||
version = ">=v1.0.0" | ||
source = "github.com/hashicorp/googlecompute" | ||
} | ||
} | ||
} | ||
|
||
variable "gcp_project_id" { | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "gcp_zone" { | ||
type = string | ||
default = "us-central1-a" | ||
} | ||
|
||
source "googlecompute" "ubuntu-bionic" { | ||
image_family = "terratest" | ||
image_name = "terratest-packer-example-${formatdate("YYYYMMDD-hhmm", timestamp())}" | ||
project_id = var.gcp_project_id | ||
source_image_family = "ubuntu-1804-lts" | ||
ssh_username = "ubuntu" | ||
zone = var.gcp_zone | ||
} | ||
|
||
|
||
build { | ||
sources = [ | ||
"source.googlecompute.ubuntu-bionic" | ||
] | ||
|
||
provisioner "shell" { | ||
inline = ["sudo DEBIAN_FRONTEND=noninteractive apt-get update", "sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y"] | ||
pause_before = "30s" | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
packer { | ||
required_plugins { | ||
amazon = { | ||
version = ">=v1.0.0" | ||
source = "github.com/hashicorp/amazon" | ||
} | ||
oracle = { | ||
version = ">=v1.0.0" | ||
source = "github.com/hashicorp/oracle" | ||
} | ||
} | ||
} | ||
|
||
variable "ami_base_name" { | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "aws_region" { | ||
type = string | ||
default = "us-east-1" | ||
} | ||
|
||
variable "instance_type" { | ||
type = string | ||
default = "t2.micro" | ||
} | ||
|
||
variable "oci_availability_domain" { | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "oci_base_image_ocid" { | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "oci_compartment_ocid" { | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "oci_pass_phrase" { | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "oci_subnet_ocid" { | ||
type = string | ||
default = "" | ||
} | ||
|
||
data "amazon-ami" "ubuntu-xenial" { | ||
filters = { | ||
architecture = "x86_64" | ||
"block-device-mapping.volume-type" = "gp2" | ||
name = "*ubuntu-xenial-16.04-amd64-server-*" | ||
root-device-type = "ebs" | ||
virtualization-type = "hvm" | ||
} | ||
most_recent = true | ||
owners = ["099720109477"] | ||
region = var.aws_region | ||
} | ||
|
||
source "amazon-ebs" "ubuntu-example" { | ||
ami_description = "An example of how to create a custom AMI on top of Ubuntu" | ||
ami_name = "${var.ami_base_name}-terratest-packer-example" | ||
encrypt_boot = false | ||
instance_type = var.instance_type | ||
region = var.aws_region | ||
source_ami = data.amazon-ami.ubuntu-xenial.id | ||
ssh_username = "ubuntu" | ||
} | ||
|
||
source "oracle-oci" "oracle-example" { | ||
availability_domain = var.oci_availability_domain | ||
base_image_ocid = var.oci_base_image_ocid | ||
compartment_ocid = var.oci_compartment_ocid | ||
image_name = "terratest-packer-example-${formatdate("YYYYMMDD-hhmm", timestamp())}" | ||
pass_phrase = var.oci_pass_phrase | ||
shape = "VM.Standard2.1" | ||
ssh_username = "ubuntu" | ||
subnet_ocid = var.oci_subnet_ocid | ||
} | ||
|
||
build { | ||
sources = [ | ||
"source.amazon-ebs.ubuntu-example", | ||
"source.oracle-oci.oracle-example" | ||
] | ||
|
||
provisioner "shell" { | ||
inline = ["sudo DEBIAN_FRONTEND=noninteractive apt-get update", "sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y"] | ||
pause_before = "30s" | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
packer { | ||
required_plugins { | ||
amazon = { | ||
version = ">=v1.0.0" | ||
source = "github.com/hashicorp/amazon" | ||
} | ||
} | ||
} | ||
|
||
variable "ami_name_base" { | ||
type = string | ||
default = "terratest-packer-docker-example" | ||
} | ||
|
||
variable "aws_region" { | ||
type = string | ||
default = "us-east-1" | ||
} | ||
|
||
variable "instance_type" { | ||
type = string | ||
default = "t2.micro" | ||
} | ||
|
||
data "amazon-ami" "aws" { | ||
filters = { | ||
architecture = "x86_64" | ||
"block-device-mapping.volume-type" = "gp2" | ||
name = "*ubuntu-xenial-16.04-amd64-server-*" | ||
root-device-type = "ebs" | ||
virtualization-type = "hvm" | ||
} | ||
most_recent = true | ||
owners = ["099720109477"] | ||
region = var.aws_region | ||
} | ||
|
||
source "amazon-ebs" "ubuntu-ami" { | ||
ami_description = "An example of how to create a custom AMI with a simple web app on top of Ubuntu" | ||
ami_name = "${var.ami_name_base}-${formatdate("YYYYMMDD-hhmm", timestamp())}" | ||
encrypt_boot = false | ||
instance_type = var.instance_type | ||
region = var.aws_region | ||
source_ami = data.amazon-ami.aws.id | ||
ssh_username = "ubuntu" | ||
} | ||
|
||
source "docker" "ubuntu-docker" { | ||
changes = ["ENTRYPOINT [\"\"]"] | ||
commit = true | ||
image = "gruntwork/ubuntu-test:16.04" | ||
} | ||
|
||
build { | ||
sources = ["source.amazon-ebs.ubuntu-ami", "source.docker.ubuntu-docker"] | ||
|
||
provisioner "shell" { | ||
inline = ["echo 'Sleeping for a few seconds to give Ubuntu time to boot up'", "sleep 30"] | ||
only = ["amazon-ebs.ubuntu-ami"] | ||
} | ||
|
||
provisioner "file" { | ||
destination = "/tmp/packer-docker-example" | ||
source = path.root | ||
} | ||
|
||
provisioner "shell" { | ||
inline = ["/tmp/packer-docker-example/configure-sinatra-app.sh"] | ||
} | ||
|
||
post-processor "docker-tag" { | ||
only = ["docker.ubuntu-docker"] | ||
repository = "gruntwork/packer-docker-example" | ||
tag = ["latest"] | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.