add tabs to generated docs from access_config and run_config structs

This commit is contained in:
Megan Marsh 2020-07-17 15:10:55 -07:00
parent 8964367eb5
commit a1651977b3
4 changed files with 276 additions and 31 deletions

View File

@ -116,6 +116,9 @@ type AccessConfig struct {
// credential types) and GetFederationToken (for federation\_token
// credential types) for more details.
//
// <Tabs>
// <Tab heading="JSON">
//
// ```json
// {
// "vault_aws_engine": {
@ -124,7 +127,20 @@ type AccessConfig struct {
// "ttl": "3600s"
// }
// }
//
// </Tab>
// <Tab heading="HCL2">
//
// ```hcl
// vault_aws_engine {
// name = "myrole"
// role_arn = "myarn"
// ttl = "3600s"
// }
// ```
//
// </Tab>
// </Tabs>
VaultAWSEngine VaultAWSEngineOptions `mapstructure:"vault_aws_engine" required:"false"`
getEC2Connection func() ec2iface.EC2API

View File

@ -96,12 +96,27 @@ type RunConfig struct {
// `true`, will cause a timeout.
// Example of a valid shutdown command:
//
// <Tabs>
// <Tab heading="JSON">
//
// ```json
// {
// "provisioners: [{
// "type": "windows-shell",
// "inline": ["\"c:\\Program Files\\Amazon\\Ec2ConfigService\\ec2config.exe\" -sysprep"]
// }]
// ```
//
// </Tab>
// <Tab heading="HCL2">
//
// ```hcl
// provisioner "windows-shell"{
// inline = ["\"c:\\Program Files\\Amazon\\Ec2ConfigService\\ec2config.exe\" -sysprep"]
// }
// ```
//
// </Tab>
// </Tabs>
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:
//
// <Tabs>
// <Tab heading="JSON">
//
// ```json
// {
// "security_group_filter": {
@ -174,6 +192,20 @@ type RunConfig struct {
// }
// ```
//
// </Tab>
// <Tab heading="HCL2">
//
// ```hcl
// security_group_filter {
// filters = {
// "tag:Class": "packer"
// }
// }
// ```
//
// </Tab>
// </Tabs>
//
// 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
// <Tabs>
// <Tab heading="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
// }
// }
// ```
// ]
// ```
//
// </Tab>
// <Tab heading="HCL2">
//
// ```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
// }
// }
// ```
//
// </Tab>
// </Tabs>
//
// 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
// <Tabs>
// <Tab heading="JSON">
//
// ```json
// "builders" [
// {
// "type": "amazon-ebs",
// "subnet_filter": {
// "filters": {
// "tag:Class": "build"
@ -303,7 +366,26 @@ type RunConfig struct {
// "random": false
// }
// }
// ```
// ]
// ```
//
// </Tab>
// <Tab heading="HCL2">
//
// ```hcl
// source "amazon-ebs" "basic-example" {
// subnet_filter {
// filters = {
// "tag:Class": "build"
// }
// most_free = true
// random = false
// }
// }
// ```
//
// </Tab>
// </Tabs>
//
// 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:
//
// <Tabs>
// <Tab heading="JSON">
//
// ```json
// {
// "vpc_filter": {
// "filters": {
// "builders" [
// {
// "type": "amazon-ebs",
// "vpc_filter": {
// "filters": {
// "tag:Class": "build",
// "isDefault": "false",
// "cidr": "/24"
// }
// }
// }
// ]
// ```
//
// </Tab>
// <Tab heading="HCL2">
//
// ```hcl
// source "amazon-ebs" "basic-example" {
// vpc_filter {
// filters = {
// "tag:Class": "build",
// "isDefault": "false",
// "cidr": "/24"
@ -362,6 +465,9 @@ type RunConfig struct {
// }
// ```
//
// </Tab>
// </Tabs>
//
// 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.

View File

@ -59,7 +59,10 @@
the DurationSeconds parameter for AssumeRole (for assumed\_role
credential types) and GetFederationToken (for federation\_token
credential types) for more details.
<Tabs>
<Tab heading="JSON">
```json
{
"vault_aws_engine": {
@ -69,3 +72,17 @@
}
}
```
</Tab>
<Tab heading="HCL2">
```hcl
vault_aws_engine {
name = "myrole"
role_arn = "myarn"
ttl = "3600s"
}
```
</Tab>
</Tabs>

View File

@ -26,12 +26,27 @@
`true`, will cause a timeout.
Example of a valid shutdown command:
<Tabs>
<Tab heading="JSON">
```json
{
"provisioners: [{
"type": "windows-shell",
"inline": ["\"c:\\Program Files\\Amazon\\Ec2ConfigService\\ec2config.exe\" -sysprep"]
}]
```
</Tab>
<Tab heading="HCL2">
```hcl
provisioner "windows-shell"{
inline = ["\"c:\\Program Files\\Amazon\\Ec2ConfigService\\ec2config.exe\" -sysprep"]
}
```
</Tab>
</Tabs>
- `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:
<Tabs>
<Tab heading="JSON">
```json
{
"security_group_filter": {
@ -100,6 +118,20 @@
}
```
</Tab>
<Tab heading="HCL2">
```hcl
security_group_filter {
filters = {
"tag:Class": "packer"
}
}
```
</Tab>
</Tabs>
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
<Tabs>
<Tab heading="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
}
}
```
]
```
</Tab>
<Tab heading="HCL2">
```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
}
}
```
</Tab>
</Tabs>
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
<Tabs>
<Tab heading="JSON">
```json
"builders" [
{
"type": "amazon-ebs",
"subnet_filter": {
"filters": {
"tag:Class": "build"
@ -218,7 +281,26 @@
"random": false
}
}
```
]
```
</Tab>
<Tab heading="HCL2">
```hcl
source "amazon-ebs" "basic-example" {
subnet_filter {
filters = {
"tag:Class": "build"
}
most_free = true
random = false
}
}
```
</Tab>
</Tabs>
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:
<Tabs>
<Tab heading="JSON">
```json
{
"vpc_filter": {
"filters": {
"builders" [
{
"type": "amazon-ebs",
"vpc_filter": {
"filters": {
"tag:Class": "build",
"isDefault": "false",
"cidr": "/24"
}
}
}
]
```
</Tab>
<Tab heading="HCL2">
```hcl
source "amazon-ebs" "basic-example" {
vpc_filter {
filters = {
"tag:Class": "build",
"isDefault": "false",
"cidr": "/24"
@ -277,6 +380,9 @@
}
```
</Tab>
</Tabs>
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.