diff --git a/builder/amazon/common/access_config.go b/builder/amazon/common/access_config.go
index d8e5cbc4f..d85911c2b 100644
--- a/builder/amazon/common/access_config.go
+++ b/builder/amazon/common/access_config.go
@@ -116,6 +116,9 @@ type AccessConfig struct {
// credential types) and GetFederationToken (for federation\_token
// credential types) for more details.
//
+ //
+ //
+ //
// ```json
// {
// "vault_aws_engine": {
@@ -124,7 +127,20 @@ type AccessConfig struct {
// "ttl": "3600s"
// }
// }
+ //
+ //
+ //
+ //
+ // ```hcl
+ // vault_aws_engine {
+ // name = "myrole"
+ // role_arn = "myarn"
+ // ttl = "3600s"
+ // }
// ```
+ //
+ //
+ //
VaultAWSEngine VaultAWSEngineOptions `mapstructure:"vault_aws_engine" required:"false"`
getEC2Connection func() ec2iface.EC2API
diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go
index b242f5380..82fe519be 100644
--- a/builder/amazon/common/run_config.go
+++ b/builder/amazon/common/run_config.go
@@ -96,12 +96,27 @@ type RunConfig struct {
// `true`, will cause a timeout.
// Example of a valid shutdown command:
//
+ //
+ //
+ //
// ```json
- // {
+ // "provisioners: [{
// "type": "windows-shell",
// "inline": ["\"c:\\Program Files\\Amazon\\Ec2ConfigService\\ec2config.exe\" -sysprep"]
+ // }]
+ // ```
+ //
+ //
+ //
+ //
+ // ```hcl
+ // provisioner "windows-shell"{
+ // inline = ["\"c:\\Program Files\\Amazon\\Ec2ConfigService\\ec2config.exe\" -sysprep"]
// }
// ```
+ //
+ //
+ //
DisableStopInstance bool `mapstructure:"disable_stop_instance" required:"false"`
// Mark instance as [EBS
// Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
@@ -164,6 +179,9 @@ type RunConfig struct {
InstanceType string `mapstructure:"instance_type" required:"true"`
// Filters used to populate the `security_group_ids` field. Example:
//
+ //
+ //
+ //
// ```json
// {
// "security_group_filter": {
@@ -174,6 +192,20 @@ type RunConfig struct {
// }
// ```
//
+ //
+ //
+ //
+ // ```hcl
+ // security_group_filter {
+ // filters = {
+ // "tag:Class": "packer"
+ // }
+ // }
+ // ```
+ //
+ //
+ //
+ //
// This selects the SG's with tag `Class` with the value `packer`.
//
// - `filters` (map of strings) - filters used to select a
@@ -211,19 +243,45 @@ type RunConfig struct {
// Filters used to populate the `source_ami`
// field. Example:
//
- // ```json
+ //
+ //
+ //
+ // ```json
+ // "builders" [
// {
+ // "type": "amazon-ebs",
// "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
+ // "filters": {
+ // "virtualization-type": "hvm",
+ // "name": "ubuntu/images/\*ubuntu-xenial-16.04-amd64-server-\*",
+ // "root-device-type": "ebs"
+ // },
+ // "owners": ["099720109477"],
+ // "most_recent": true
// }
// }
- // ```
+ // ]
+ // ```
+ //
+ //
+ //
+ //
+ // ```hcl
+ // source "amazon-ebs" "basic-example" {
+ // 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
+ // }
+ // }
+ // ```
+ //
+ //
+ //
//
// This selects the most recent Ubuntu 16.04 HVM EBS AMI from Canonical. NOTE:
// This will fail unless *exactly* one AMI is returned. In the above example,
@@ -293,8 +351,13 @@ type RunConfig struct {
// Filters used to populate the `subnet_id` field.
// Example:
//
- // ```json
+ //
+ //
+ //
+ // ```json
+ // "builders" [
// {
+ // "type": "amazon-ebs",
// "subnet_filter": {
// "filters": {
// "tag:Class": "build"
@@ -303,7 +366,26 @@ type RunConfig struct {
// "random": false
// }
// }
- // ```
+ // ]
+ // ```
+ //
+ //
+ //
+ //
+ // ```hcl
+ // source "amazon-ebs" "basic-example" {
+ // subnet_filter {
+ // filters = {
+ // "tag:Class": "build"
+ // }
+ // most_free = true
+ // random = false
+ // }
+ // }
+ // ```
+ //
+ //
+ //
//
// This selects the Subnet with tag `Class` with the value `build`, which has
// the most free IP addresses. NOTE: This will fail unless *exactly* one
@@ -350,10 +432,31 @@ type RunConfig struct {
// Filters used to populate the `vpc_id` field.
// Example:
//
+ //
+ //
+ //
// ```json
- // {
- // "vpc_filter": {
- // "filters": {
+ // "builders" [
+ // {
+ // "type": "amazon-ebs",
+ // "vpc_filter": {
+ // "filters": {
+ // "tag:Class": "build",
+ // "isDefault": "false",
+ // "cidr": "/24"
+ // }
+ // }
+ // }
+ // ]
+ // ```
+ //
+ //
+ //
+ //
+ // ```hcl
+ // source "amazon-ebs" "basic-example" {
+ // vpc_filter {
+ // filters = {
// "tag:Class": "build",
// "isDefault": "false",
// "cidr": "/24"
@@ -362,6 +465,9 @@ type RunConfig struct {
// }
// ```
//
+ //
+ //
+ //
// This selects the VPC with tag `Class` with the value `build`, which is not
// the default VPC, and have a IPv4 CIDR block of `/24`. NOTE: This will fail
// unless *exactly* one VPC is returned.
diff --git a/website/pages/partials/builder/amazon/common/AccessConfig-not-required.mdx b/website/pages/partials/builder/amazon/common/AccessConfig-not-required.mdx
index 715c71c22..fb04fe023 100644
--- a/website/pages/partials/builder/amazon/common/AccessConfig-not-required.mdx
+++ b/website/pages/partials/builder/amazon/common/AccessConfig-not-required.mdx
@@ -59,7 +59,10 @@
the DurationSeconds parameter for AssumeRole (for assumed\_role
credential types) and GetFederationToken (for federation\_token
credential types) for more details.
-
+
+
+
+
```json
{
"vault_aws_engine": {
@@ -69,3 +72,17 @@
}
}
```
+
+
+
+
+ ```hcl
+ vault_aws_engine {
+ name = "myrole"
+ role_arn = "myarn"
+ ttl = "3600s"
+ }
+ ```
+
+
+
diff --git a/website/pages/partials/builder/amazon/common/RunConfig-not-required.mdx b/website/pages/partials/builder/amazon/common/RunConfig-not-required.mdx
index a454eded7..46ce71d43 100644
--- a/website/pages/partials/builder/amazon/common/RunConfig-not-required.mdx
+++ b/website/pages/partials/builder/amazon/common/RunConfig-not-required.mdx
@@ -26,12 +26,27 @@
`true`, will cause a timeout.
Example of a valid shutdown command:
+
+
+
```json
- {
+ "provisioners: [{
"type": "windows-shell",
"inline": ["\"c:\\Program Files\\Amazon\\Ec2ConfigService\\ec2config.exe\" -sysprep"]
+ }]
+ ```
+
+
+
+
+ ```hcl
+ provisioner "windows-shell"{
+ inline = ["\"c:\\Program Files\\Amazon\\Ec2ConfigService\\ec2config.exe\" -sysprep"]
}
```
+
+
+
- `ebs_optimized` (bool) - Mark instance as [EBS
Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
@@ -90,6 +105,9 @@
- `security_group_filter` (SecurityGroupFilterOptions) - Filters used to populate the `security_group_ids` field. Example:
+
+
+
```json
{
"security_group_filter": {
@@ -100,6 +118,20 @@
}
```
+
+
+
+ ```hcl
+ security_group_filter {
+ filters = {
+ "tag:Class": "packer"
+ }
+ }
+ ```
+
+
+
+
This selects the SG's with tag `Class` with the value `packer`.
- `filters` (map of strings) - filters used to select a
@@ -132,19 +164,45 @@
- `source_ami_filter` (AmiFilterOptions) - Filters used to populate the `source_ami`
field. Example:
- ```json
+
+
+
+ ```json
+ "builders" [
{
+ "type": "amazon-ebs",
"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
+ "filters": {
+ "virtualization-type": "hvm",
+ "name": "ubuntu/images/\*ubuntu-xenial-16.04-amd64-server-\*",
+ "root-device-type": "ebs"
+ },
+ "owners": ["099720109477"],
+ "most_recent": true
}
}
- ```
+ ]
+ ```
+
+
+
+
+ ```hcl
+ source "amazon-ebs" "basic-example" {
+ 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
+ }
+ }
+ ```
+
+
+
This selects the most recent Ubuntu 16.04 HVM EBS AMI from Canonical. NOTE:
This will fail unless *exactly* one AMI is returned. In the above example,
@@ -208,8 +266,13 @@
- `subnet_filter` (SubnetFilterOptions) - Filters used to populate the `subnet_id` field.
Example:
- ```json
+
+
+
+ ```json
+ "builders" [
{
+ "type": "amazon-ebs",
"subnet_filter": {
"filters": {
"tag:Class": "build"
@@ -218,7 +281,26 @@
"random": false
}
}
- ```
+ ]
+ ```
+
+
+
+
+ ```hcl
+ source "amazon-ebs" "basic-example" {
+ subnet_filter {
+ filters = {
+ "tag:Class": "build"
+ }
+ most_free = true
+ random = false
+ }
+ }
+ ```
+
+
+
This selects the Subnet with tag `Class` with the value `build`, which has
the most free IP addresses. NOTE: This will fail unless *exactly* one
@@ -265,10 +347,31 @@
- `vpc_filter` (VpcFilterOptions) - Filters used to populate the `vpc_id` field.
Example:
+
+
+
```json
- {
- "vpc_filter": {
- "filters": {
+ "builders" [
+ {
+ "type": "amazon-ebs",
+ "vpc_filter": {
+ "filters": {
+ "tag:Class": "build",
+ "isDefault": "false",
+ "cidr": "/24"
+ }
+ }
+ }
+ ]
+ ```
+
+
+
+
+ ```hcl
+ source "amazon-ebs" "basic-example" {
+ vpc_filter {
+ filters = {
"tag:Class": "build",
"isDefault": "false",
"cidr": "/24"
@@ -277,6 +380,9 @@
}
```
+
+
+
This selects the VPC with tag `Class` with the value `build`, which is not
the default VPC, and have a IPv4 CIDR block of `/24`. NOTE: This will fail
unless *exactly* one VPC is returned.