diff --git a/website/pages/docs/builders/amazon/chroot.mdx b/website/pages/docs/builders/amazon/chroot.mdx index 1aaaf22dd..9a37f8b0f 100644 --- a/website/pages/docs/builders/amazon/chroot.mdx +++ b/website/pages/docs/builders/amazon/chroot.mdx @@ -110,6 +110,11 @@ Block devices can be nested in the Here is a basic example. It is completely valid except for the access keys: + + + + + ```json { "type": "amazon-chroot", @@ -120,6 +125,34 @@ Here is a basic example. It is completely valid except for the access keys: } ``` + + + +```hcl +variable "aws_access_key" { + type = string +} + +variable "aws_secret_key" { + type = string +} + +source "amazon-chroot" "basic-example" { + access_key = var.aws_access_key + secret_key = var.aws_secret_key + source_ami = "ami-e81d5881" +} + +build { + source "sources.amazon-chroot.basic-example" { + ami_name = "packer-amazon-chroot {{timestamp}}" + } +} +``` + + + + ## Chroot Mounts The `chroot_mounts` configuration can be used to mount specific devices within diff --git a/website/pages/docs/builders/amazon/ebs.mdx b/website/pages/docs/builders/amazon/ebs.mdx index 864da8385..351f97915 100644 --- a/website/pages/docs/builders/amazon/ebs.mdx +++ b/website/pages/docs/builders/amazon/ebs.mdx @@ -107,6 +107,9 @@ Here is a basic example. You will need to provide access keys, and may need to change the AMI IDs according to what images exist at the time the template is run: + + + ```json { "variables": { @@ -128,6 +131,37 @@ run: } ``` + + + +```hcl +variable "aws_access_key" { + type = string +} + +variable "aws_secret_key" { + type = string +} + +source "amazon-ebs" "basic-example" { + access_key = var.aws_access_key + secret_key = var.aws_secret_key + region = "us-east-1" + source_ami = "ami-fce3c696" + instance_type = "t2.micro" + ssh_username = "ubuntu" +} + +build { + source "sources.amazon-ebs.basic-example" { + ami_name = "packer_AWS {{timestamp}}" + } +} +``` + + + + -> **Note:** Packer can also read the access key and secret access key from environmental variables. See the configuration reference in the section above for more information on what environmental variables Packer will look for. diff --git a/website/pages/docs/builders/amazon/ebssurrogate.mdx b/website/pages/docs/builders/amazon/ebssurrogate.mdx index 54b59cfee..deb506e13 100644 --- a/website/pages/docs/builders/amazon/ebssurrogate.mdx +++ b/website/pages/docs/builders/amazon/ebssurrogate.mdx @@ -102,6 +102,10 @@ Block devices can be nested in the ## Basic Example + + + + ```json { "type": "amazon-ebssurrogate", @@ -129,6 +133,46 @@ Block devices can be nested in the } ``` + + + +```hcl +source "amazon-ebssurrogate" "basic-example" { + region = "us-east-1" + ssh_username = "ubuntu" + instance_type = "t2.medium" + source_ami = "ami-40d28157" + ami_name = "packer-test-adrien" + ami_virtualization_type = "paravirtual" + + launch_block_device_mappings { + volume_type = "gp2" + device_name = "/dev/xvdf" + delete_on_termination = false + volume_size = 10 + } + + ami_root_device { + source_device_name = "/dev/xvdf" + device_name = "/dev/xvda" + delete_on_termination = true + volume_size = 16 + volume_type = "gp2" + } +} + +build { + sources = ["sources.amazon-ebssurrogate.basic-example"] + + provisioner "shell" { + inline = ["..."] + } +} +``` + + + + -> **Note:** Packer can also read the access key and secret access key from environmental variables. See the configuration reference in the section above for more information on what environmental variables Packer will look for. diff --git a/website/pages/docs/builders/amazon/ebsvolume.mdx b/website/pages/docs/builders/amazon/ebsvolume.mdx index 26470661e..1b5b6aabc 100644 --- a/website/pages/docs/builders/amazon/ebsvolume.mdx +++ b/website/pages/docs/builders/amazon/ebsvolume.mdx @@ -106,11 +106,12 @@ Block devices can be nested in the ## Basic Example + + + ```json { "type": "amazon-ebsvolume", - "secret_key": "YOUR SECRET KEY HERE", - "access_key": "YOUR KEY HERE", "region": "us-east-1", "ssh_username": "ubuntu", "instance_type": "t2.medium", @@ -150,6 +151,58 @@ Block devices can be nested in the } ``` + + + +```hcl +source "amazon-ebsvolume" "basic-example" { + region = "us-east-1" + ssh_username = "ubuntu" + instance_type = "t2.medium" + source_ami = "ami-40d28157" + + ebs_volumes { + volume_type = "gp2" + device_name = "/dev/xvdf" + delete_on_termination = false + tags = { + zpool = "data" + Name = "Data1" + } + volume_size = 10 + } + + ebs_volumes { + volume_type = "gp2" + device_name = "/dev/xvdg" + tags = { + zpool = "data" + Name = "Data2" + } + delete_on_termination = false + volume_size = 10 + } + + ebs_volumes { + volume_size = 10 + tags = { + zpool = "data" + Name = "Data3" + } + delete_on_termination = false + device_name = "/dev/xvdh" + volume_type = "gp2" + } +} + +build { + sources = ["sources.amazon-ebsvolume.basic-example"] +} +``` + + + + -> **Note:** Packer can also read the access key and secret access key from environmental variables. See the configuration reference in the section above for more information on what environmental variables Packer will look for. diff --git a/website/pages/docs/builders/amazon/instance.mdx b/website/pages/docs/builders/amazon/instance.mdx index fce52d0bd..69410bbcf 100644 --- a/website/pages/docs/builders/amazon/instance.mdx +++ b/website/pages/docs/builders/amazon/instance.mdx @@ -121,6 +121,9 @@ Block devices can be nested in the Here is a basic example. It is completely valid except for the access keys: + + + ```json { "type": "amazon-instance", @@ -141,6 +144,33 @@ Here is a basic example. It is completely valid except for the access keys: } ``` + + + +```hcl +source "amazon-instance" "basic-example" { + region = "us-east-1" + source_ami = "ami-d9d6a6b0" + instance_type = "m1.small" + ssh_username = "ubuntu" + + account_id = "0123-4567-0890" + s3_bucket = "packer-images" + x509_cert_path = "x509.cert" + x509_key_path = "x509.key" + x509_upload_path = "/tmp" +} + +build { + source "sources.amazon-instance.basic-example" { + ami_name = "packer-quick-start {{timestamp}}" + } +} +``` + + + + -> **Note:** Packer can also read the access key and secret access key from environmental variables. See the configuration reference in the section above for more information on what environmental variables Packer will look for.