This commit is contained in:
Adrien Delorme 2020-03-13 18:04:48 +01:00
parent 260dc59500
commit 6e6490d688
22 changed files with 174 additions and 35 deletions

View File

@ -7,6 +7,7 @@ import (
"regexp" "regexp"
"strings" "strings"
"github.com/hashicorp/packer/hcl2template"
"github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/helper/config"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
) )
@ -189,14 +190,19 @@ type AlicloudImageConfig struct {
// The region validation can be skipped // The region validation can be skipped
// if this value is true, the default value is false. // if this value is true, the default value is false.
AlicloudImageSkipRegionValidation bool `mapstructure:"skip_region_validation" required:"false"` AlicloudImageSkipRegionValidation bool `mapstructure:"skip_region_validation" required:"false"`
// Tags applied to the destination // Tags applied to the destination image and relevant snapshots.
// image and relevant snapshots. AlicloudImageTags map[string]string `mapstructure:"tags" required:"false"`
AlicloudImageTags map[string]string `mapstructure:"tags" required:"false"` // Same as [`tags`](#tags) but defined as a singular block containing a key
// and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
AlicloudImageTag hcl2template.KeyValues `mapstructure:"tag" required:"false"`
AlicloudDiskDevices `mapstructure:",squash"` AlicloudDiskDevices `mapstructure:",squash"`
} }
func (c *AlicloudImageConfig) Prepare(ctx *interpolate.Context) []error { func (c *AlicloudImageConfig) Prepare(ctx *interpolate.Context) []error {
var errs []error var errs []error
errs = append(errs, c.AlicloudImageTag.CopyOn(c.AlicloudImageTags)...)
if c.AlicloudImageName == "" { if c.AlicloudImageName == "" {
errs = append(errs, fmt.Errorf("image_name must be specified")) errs = append(errs, fmt.Errorf("image_name must be specified"))
} else if len(c.AlicloudImageName) < 2 || len(c.AlicloudImageName) > 128 { } else if len(c.AlicloudImageName) < 2 || len(c.AlicloudImageName) > 128 {

View File

@ -18,6 +18,7 @@ import (
awscommon "github.com/hashicorp/packer/builder/amazon/common" awscommon "github.com/hashicorp/packer/builder/amazon/common"
"github.com/hashicorp/packer/common" "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/common/chroot" "github.com/hashicorp/packer/common/chroot"
"github.com/hashicorp/packer/hcl2template"
"github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/helper/config"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
@ -163,6 +164,11 @@ type Config struct {
// engine](/docs/templates/engine.html), see [Build template // engine](/docs/templates/engine.html), see [Build template
// data](#build-template-data) for more information. // data](#build-template-data) for more information.
RootVolumeTags awscommon.TagMap `mapstructure:"root_volume_tags" required:"false"` RootVolumeTags awscommon.TagMap `mapstructure:"root_volume_tags" required:"false"`
// Same as [`root_volume_tags`](#root_volume_tags) but defined as a
// singular block containing a key and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
RootVolumeTag hcl2template.KeyValues `mapstructure:"root_volume_tag" required:"false"`
// what architecture to use when registering the final AMI; valid options // what architecture to use when registering the final AMI; valid options
// are "x86_64" or "arm64". Defaults to "x86_64". // are "x86_64" or "arm64". Defaults to "x86_64".
Architecture string `mapstructure:"ami_architecture" required:"false"` Architecture string `mapstructure:"ami_architecture" required:"false"`
@ -253,10 +259,12 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
var errs *packer.MultiError var errs *packer.MultiError
var warns []string var warns []string
for _, preparer := range []interface{ Prepare() error }{ errs = packer.MultiErrorAppend(errs, b.RootVolumeTag.CopyOn(b.RootVolumeTags)...)
for _, preparer := range []interface{ Prepare() []error }{
&b.config.SourceAmiFilter, &b.config.SourceAmiFilter,
} { } {
errs = packer.MultiErrorAppend(errs, preparer.Prepare()) errs = packer.MultiErrorAppend(errs, preparer.Prepare()...)
} }
errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...)

View File

@ -7,6 +7,7 @@ import (
"log" "log"
"regexp" "regexp"
"github.com/hashicorp/packer/hcl2template"
"github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/helper/config"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
) )
@ -50,6 +51,11 @@ type AMIConfig struct {
// [template engine](/docs/templates/engine.html), see [Build template // [template engine](/docs/templates/engine.html), see [Build template
// data](#build-template-data) for more information. // data](#build-template-data) for more information.
AMITags TagMap `mapstructure:"tags" required:"false"` AMITags TagMap `mapstructure:"tags" required:"false"`
// Same as [`tags`](#tags) but defined as a singular block containing a key
// and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
AMITag hcl2template.KeyValues `mapstructure:"tag" required:"false"`
// Enable enhanced networking (ENA but not SriovNetSupport) on // Enable enhanced networking (ENA but not SriovNetSupport) on
// HVM-compatible AMIs. If set, add `ec2:ModifyInstanceAttribute` to your // HVM-compatible AMIs. If set, add `ec2:ModifyInstanceAttribute` to your
// AWS IAM policy. // AWS IAM policy.
@ -116,6 +122,11 @@ type AMIConfig struct {
// [template engine](../templates/engine.html), see [Build template // [template engine](../templates/engine.html), see [Build template
// data](#build-template-data) for more information. // data](#build-template-data) for more information.
SnapshotTags TagMap `mapstructure:"snapshot_tags" required:"false"` SnapshotTags TagMap `mapstructure:"snapshot_tags" required:"false"`
// Same as [`snapshot_tags`](#snapshot_tags) but defined as a singular
// block containing a key and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
SnapshotTag []hcl2template.KeyValues `mapstructure:"snapshot_tag" required:"false"`
// A list of account IDs that have // A list of account IDs that have
// access to create volumes from the snapshot(s). By default no additional // access to create volumes from the snapshot(s). By default no additional
// users other than the user creating the AMI has permissions to create // users other than the user creating the AMI has permissions to create

View File

@ -187,6 +187,11 @@ type RunConfig struct {
// EBS volumes. This is a [template engine](/docs/templates/engine.html), // EBS volumes. This is a [template engine](/docs/templates/engine.html),
// see [Build template data](#build-template-data) for more information. // see [Build template data](#build-template-data) for more information.
RunTags map[string]string `mapstructure:"run_tags" required:"false"` RunTags map[string]string `mapstructure:"run_tags" required:"false"`
// Same as [`run_tags`](#run_tags) but defined as a singular block
// containing a key and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
RunTag []hcl2template.KeyValues `mapstructure:"run_tag" required:"false"`
// The ID (not the name) of the security // The ID (not the name) of the security
// group to assign to the instance. By default this is not set and Packer will // group to assign to the instance. By default this is not set and Packer will
// automatically create a new temporary security group to allow SSH access. // automatically create a new temporary security group to allow SSH access.
@ -276,9 +281,14 @@ type RunConfig struct {
// Windows, Linux/UNIX (Amazon VPC), SUSE Linux (Amazon VPC), // Windows, Linux/UNIX (Amazon VPC), SUSE Linux (Amazon VPC),
// Windows (Amazon VPC) // Windows (Amazon VPC)
SpotPriceAutoProduct string `mapstructure:"spot_price_auto_product" required:"false"` SpotPriceAutoProduct string `mapstructure:"spot_price_auto_product" required:"false"`
// Requires spot_price to be // Requires spot_price to be set. This tells Packer to apply tags to the
// set. This tells Packer to apply tags to the spot request that is issued. // spot request that is issued.
SpotTags map[string]string `mapstructure:"spot_tags" required:"false"` SpotTags map[string]string `mapstructure:"spot_tags" required:"false"`
// Same as [`spot_tags`](#spot_tags) but defined as a singular block
// containing a key and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
SpotTag hcl2template.KeyValues `mapstructure:"spot_tag" required:"false"`
// Filters used to populate the `subnet_id` field. // Filters used to populate the `subnet_id` field.
// Example: // Example:
// //
@ -412,15 +422,13 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
// Validation // Validation
errs := c.Comm.Prepare(ctx) errs := c.Comm.Prepare(ctx)
for _, preparer := range []interface{ Prepare() error }{ for _, preparer := range []interface{ Prepare() []error }{
&c.SourceAmiFilter, &c.SourceAmiFilter,
&c.SecurityGroupFilter, &c.SecurityGroupFilter,
&c.SubnetFilter, &c.SubnetFilter,
&c.VpcFilter, &c.VpcFilter,
} { } {
if err := preparer.Prepare(); err != nil { errs = append(errs, preparer.Prepare()...)
errs = append(errs, err)
}
} }
// Validating ssh_interface // Validating ssh_interface

View File

@ -5,6 +5,7 @@ package ebsvolume
import ( import (
"github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2"
awscommon "github.com/hashicorp/packer/builder/amazon/common" awscommon "github.com/hashicorp/packer/builder/amazon/common"
"github.com/hashicorp/packer/hcl2template"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
) )
@ -14,6 +15,11 @@ type BlockDevice struct {
// completes. This is a [template engine](/docs/templates/engine.html), see // completes. This is a [template engine](/docs/templates/engine.html), see
// [Build template data](#build-template-data) for more information. // [Build template data](#build-template-data) for more information.
Tags awscommon.TagMap `mapstructure:"tags" required:"false"` Tags awscommon.TagMap `mapstructure:"tags" required:"false"`
// Same as [`tags`](#tags) but defined as a singular block
// containing a key and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
Tag hcl2template.KeyValues `mapstructure:"tag" required:"false"`
} }
type BlockDevices []BlockDevice type BlockDevices []BlockDevice

View File

@ -27,6 +27,7 @@ import (
"github.com/hashicorp/packer/builder/azure/common/constants" "github.com/hashicorp/packer/builder/azure/common/constants"
"github.com/hashicorp/packer/builder/azure/pkcs12" "github.com/hashicorp/packer/builder/azure/pkcs12"
"github.com/hashicorp/packer/common" "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/hcl2template"
"github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/helper/config"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
@ -240,6 +241,11 @@ type Config struct {
// 256 characters. Tags are applied to every resource deployed by a Packer // 256 characters. Tags are applied to every resource deployed by a Packer
// build, i.e. Resource Group, VM, NIC, VNET, Public IP, KeyVault, etc. // build, i.e. Resource Group, VM, NIC, VNET, Public IP, KeyVault, etc.
AzureTags map[string]*string `mapstructure:"azure_tags" required:"false"` AzureTags map[string]*string `mapstructure:"azure_tags" required:"false"`
// Same as [`azure_tags`](#azure_tags) but defined as a singular block
// containing a key and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
AzureTag []hcl2template.KeyValues `mapstructure:"azure_tag" required:"false"`
// Resource group under which the final artifact will be stored. // Resource group under which the final artifact will be stored.
ResourceGroupName string `mapstructure:"resource_group_name"` ResourceGroupName string `mapstructure:"resource_group_name"`
// Storage account under which the final artifact will be stored. // Storage account under which the final artifact will be stored.

View File

@ -13,6 +13,7 @@ import (
"github.com/hashicorp/packer/common" "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/common/json" "github.com/hashicorp/packer/common/json"
"github.com/hashicorp/packer/common/uuid" "github.com/hashicorp/packer/common/uuid"
"github.com/hashicorp/packer/hcl2template"
"github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/helper/config"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
@ -60,9 +61,13 @@ type Config struct {
ImageName string `mapstructure:"image_name" required:"false"` ImageName string `mapstructure:"image_name" required:"false"`
// The description of the resulting image. // The description of the resulting image.
ImageDescription string `mapstructure:"image_description" required:"false"` ImageDescription string `mapstructure:"image_description" required:"false"`
// Key/value pair tags to // Key/value pair tags to add to the created image.
// add to the created image.
ImageTags map[string]string `mapstructure:"image_tags" required:"false"` ImageTags map[string]string `mapstructure:"image_tags" required:"false"`
// Same as [`image_tags`](#image_tags) but defined as a singular block
// containing a key and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
ImageTag []hcl2template.KeyValues `mapstructure:"image_tag" required:"false"`
// The service of the resulting image. // The service of the resulting image.
ImageService string `mapstructure:"image_service" required:"false"` ImageService string `mapstructure:"image_service" required:"false"`
// ID or name of the type this server should be created with. // ID or name of the type this server should be created with.
@ -72,6 +77,11 @@ type Config struct {
// Key/value pair tags to // Key/value pair tags to
// add to the created server. // add to the created server.
VmTags map[string]string `mapstructure:"vm_tags" required:"false"` VmTags map[string]string `mapstructure:"vm_tags" required:"false"`
// Same as [`vm_tags`](#vm_tags) but defined as a singular block containing
// a key and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
VmTag []hcl2template.KeyValues `mapstructure:"vm_tag" required:"false"`
// The name of the created disk. // The name of the created disk.
DiskName string `mapstructure:"disk_name" required:"false"` DiskName string `mapstructure:"disk_name" required:"false"`
// The type of the created disk. Defaults to ssd. // The type of the created disk. Defaults to ssd.

View File

@ -104,15 +104,13 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
// Validation // Validation
errs := c.Comm.Prepare(ctx) errs := c.Comm.Prepare(ctx)
for _, preparer := range []interface{ Prepare() error }{ for _, preparer := range []interface{ Prepare() []error }{
&c.SourceOmiFilter, &c.SourceOmiFilter,
&c.SecurityGroupFilter, &c.SecurityGroupFilter,
&c.SubnetFilter, &c.SubnetFilter,
&c.NetFilter, &c.NetFilter,
} { } {
if err := preparer.Prepare(); err != nil { errs = append(errs, preparer.Prepare()...)
errs = append(errs, err)
}
} }
// Validating ssh_interface // Validating ssh_interface

View File

@ -9,6 +9,7 @@ import (
"strings" "strings"
"github.com/hashicorp/packer/common/uuid" "github.com/hashicorp/packer/common/uuid"
"github.com/hashicorp/packer/hcl2template"
"github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -83,6 +84,11 @@ type TencentCloudRunConfig struct {
// Tags to apply to the instance that is *launched* to create the image. // Tags to apply to the instance that is *launched* to create the image.
// These tags are *not* applied to the resulting image. // These tags are *not* applied to the resulting image.
RunTags map[string]string `mapstructure:"run_tags" required:"false"` RunTags map[string]string `mapstructure:"run_tags" required:"false"`
// Same as [`run_tags`](#run_tags) but defined as a singular block
// containing a key and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
RunTag []hcl2template.KeyValues `mapstructure:"run_tag" required:"false"`
// Communicator settings // Communicator settings
Comm communicator.Config `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"`

View File

@ -6,6 +6,7 @@ package triton
import ( import (
"fmt" "fmt"
"github.com/hashicorp/packer/hcl2template"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
) )
@ -52,9 +53,13 @@ type SourceMachineConfig struct {
// set the user-script metadata key to have Triton start a user supplied // set the user-script metadata key to have Triton start a user supplied
// script after the VM has booted. // script after the VM has booted.
MachineMetadata map[string]string `mapstructure:"source_machine_metadata" required:"false"` MachineMetadata map[string]string `mapstructure:"source_machine_metadata" required:"false"`
// Tags applied to the // Tags applied to the VM used to create the image.
// VM used to create the image.
MachineTags map[string]string `mapstructure:"source_machine_tags" required:"false"` MachineTags map[string]string `mapstructure:"source_machine_tags" required:"false"`
// Same as [`source_machine_tags`](#source_machine_tags) but defined as a
// singular block containing a key and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
MachineTag []hcl2template.KeyValues `mapstructure:"source_machine_tag" required:"false"`
// Whether or not the firewall // Whether or not the firewall
// of the VM used to create an image of is enabled. The Triton firewall only // of the VM used to create an image of is enabled. The Triton firewall only
// filters inbound traffic to the VM. All outbound traffic is always allowed. // filters inbound traffic to the VM. All outbound traffic is always allowed.

View File

@ -5,6 +5,7 @@ package triton
import ( import (
"fmt" "fmt"
"github.com/hashicorp/packer/hcl2template"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
) )
@ -36,6 +37,11 @@ type TargetImageConfig struct {
ImageACL []string `mapstructure:"image_acls" required:"false"` ImageACL []string `mapstructure:"image_acls" required:"false"`
// Tag applied to the image. // Tag applied to the image.
ImageTags map[string]string `mapstructure:"image_tags" required:"false"` ImageTags map[string]string `mapstructure:"image_tags" required:"false"`
// Same as [`image_tags`](#image_tags) but defined as a singular block
// containing a key and a value field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
ImageTag []hcl2template.KeyValues `mapstructure:"image_tag" required:"false"`
} }
// Prepare performs basic validation on a TargetImageConfig struct. // Prepare performs basic validation on a TargetImageConfig struct.

View File

@ -1,4 +1,4 @@
//go:generate mapstructure-to-hcl2 -type KeyValue //go:generate mapstructure-to-hcl2 -type KeyValue,KeyValues,KVFilter
package hcl2template package hcl2template
@ -7,15 +7,22 @@ type KeyValue struct {
Value string Value string
} }
type KVFilter struct { type KeyValues []KeyValue
Filters map[string]string
Filter []KeyValue func (kvs KeyValues) CopyOn(to map[string]string) []error {
for _, kv := range kvs {
to[kv.Key] = kv.Value
}
return nil
} }
func (kvf *KVFilter) Prepare() error { type KVFilter struct {
for _, filter := range kvf.Filter { Filters map[string]string
kvf.Filters[filter.Key] = filter.Value Filter KeyValues
} }
func (kvf *KVFilter) Prepare() []error {
kvf.Filter.CopyOn(kvf.Filters)
return nil return nil
} }

View File

@ -49,6 +49,10 @@
- `skip_region_validation` (bool) - The region validation can be skipped - `skip_region_validation` (bool) - The region validation can be skipped
if this value is true, the default value is false. if this value is true, the default value is false.
- `tags` (map[string]string) - Tags applied to the destination - `tags` (map[string]string) - Tags applied to the destination image and relevant snapshots.
image and relevant snapshots.
- `tag` (hcl2template.KeyValues) - Same as [`tags`](#tags) but defined as a singular block containing a key
and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.

View File

@ -125,6 +125,11 @@
engine](/docs/templates/engine.html), see [Build template engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information. data](#build-template-data) for more information.
- `root_volume_tag` (hcl2template.KeyValues) - Same as [`root_volume_tags`](#root_volume_tags) but defined as a
singular block containing a key and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.
- `ami_architecture` (string) - what architecture to use when registering the final AMI; valid options - `ami_architecture` (string) - what architecture to use when registering the final AMI; valid options
are "x86_64" or "arm64". Defaults to "x86_64". are "x86_64" or "arm64". Defaults to "x86_64".

View File

@ -32,6 +32,11 @@
[template engine](/docs/templates/engine.html), see [Build template [template engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information. data](#build-template-data) for more information.
- `tag` (hcl2template.KeyValues) - Same as [`tags`](#tags) but defined as a singular block containing a key
and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.
- `ena_support` (boolean) - Enable enhanced networking (ENA but not SriovNetSupport) on - `ena_support` (boolean) - Enable enhanced networking (ENA but not SriovNetSupport) on
HVM-compatible AMIs. If set, add `ec2:ModifyInstanceAttribute` to your HVM-compatible AMIs. If set, add `ec2:ModifyInstanceAttribute` to your
AWS IAM policy. AWS IAM policy.
@ -98,6 +103,11 @@
[template engine](../templates/engine.html), see [Build template [template engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information. data](#build-template-data) for more information.
- `snapshot_tag` ([]hcl2template.KeyValues) - Same as [`snapshot_tags`](#snapshot_tags) but defined as a singular
block containing a key and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.
- `snapshot_users` ([]string) - A list of account IDs that have - `snapshot_users` ([]string) - A list of account IDs that have
access to create volumes from the snapshot(s). By default no additional access to create volumes from the snapshot(s). By default no additional
users other than the user creating the AMI has permissions to create users other than the user creating the AMI has permissions to create

View File

@ -113,6 +113,11 @@
EBS volumes. This is a [template engine](/docs/templates/engine.html), EBS volumes. This is a [template engine](/docs/templates/engine.html),
see [Build template data](#build-template-data) for more information. see [Build template data](#build-template-data) for more information.
- `run_tag` ([]hcl2template.KeyValues) - Same as [`run_tags`](#run_tags) but defined as a singular block
containing a key and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.
- `security_group_id` (string) - The ID (not the name) of the security - `security_group_id` (string) - The ID (not the name) of the security
group to assign to the instance. By default this is not set and Packer will group to assign to the instance. By default this is not set and Packer will
automatically create a new temporary security group to allow SSH access. automatically create a new temporary security group to allow SSH access.
@ -197,8 +202,13 @@
Windows, Linux/UNIX (Amazon VPC), SUSE Linux (Amazon VPC), Windows, Linux/UNIX (Amazon VPC), SUSE Linux (Amazon VPC),
Windows (Amazon VPC) Windows (Amazon VPC)
- `spot_tags` (map[string]string) - Requires spot_price to be - `spot_tags` (map[string]string) - Requires spot_price to be set. This tells Packer to apply tags to the
set. This tells Packer to apply tags to the spot request that is issued. spot request that is issued.
- `spot_tag` (hcl2template.KeyValues) - Same as [`spot_tags`](#spot_tags) but defined as a singular block
containing a key and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.
- `subnet_filter` (SubnetFilterOptions) - Filters used to populate the `subnet_id` field. - `subnet_filter` (SubnetFilterOptions) - Filters used to populate the `subnet_id` field.
Example: Example:

View File

@ -3,4 +3,9 @@
- `tags` (awscommon.TagMap) - Tags to apply to the volume. These are retained after the builder - `tags` (awscommon.TagMap) - Tags to apply to the volume. These are retained after the builder
completes. This is a [template engine](/docs/templates/engine.html), see completes. This is a [template engine](/docs/templates/engine.html), see
[Build template data](#build-template-data) for more information. [Build template data](#build-template-data) for more information.
- `tag` (hcl2template.KeyValues) - Same as [`tags`](#tags) but defined as a singular block
containing a key and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.

View File

@ -100,6 +100,11 @@
256 characters. Tags are applied to every resource deployed by a Packer 256 characters. Tags are applied to every resource deployed by a Packer
build, i.e. Resource Group, VM, NIC, VNET, Public IP, KeyVault, etc. build, i.e. Resource Group, VM, NIC, VNET, Public IP, KeyVault, etc.
- `azure_tag` ([]hcl2template.KeyValues) - Same as [`azure_tags`](#azure_tags) but defined as a singular block
containing a key and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.
- `resource_group_name` (string) - Resource group under which the final artifact will be stored. - `resource_group_name` (string) - Resource group under which the final artifact will be stored.
- `storage_account` (string) - Storage account under which the final artifact will be stored. - `storage_account` (string) - Storage account under which the final artifact will be stored.

View File

@ -15,8 +15,12 @@
- `image_description` (string) - The description of the resulting image. - `image_description` (string) - The description of the resulting image.
- `image_tags` (map[string]string) - Key/value pair tags to - `image_tags` (map[string]string) - Key/value pair tags to add to the created image.
add to the created image.
- `image_tag` ([]hcl2template.KeyValues) - Same as [`image_tags`](#image_tags) but defined as a singular block
containing a key and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.
- `image_service` (string) - The service of the resulting image. - `image_service` (string) - The service of the resulting image.
@ -25,6 +29,11 @@
- `vm_tags` (map[string]string) - Key/value pair tags to - `vm_tags` (map[string]string) - Key/value pair tags to
add to the created server. add to the created server.
- `vm_tag` ([]hcl2template.KeyValues) - Same as [`vm_tags`](#vm_tags) but defined as a singular block containing
a key and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.
- `disk_name` (string) - The name of the created disk. - `disk_name` (string) - The name of the created disk.
- `disk_type` (string) - The type of the created disk. Defaults to ssd. - `disk_type` (string) - The type of the created disk. Defaults to ssd.

View File

@ -55,4 +55,9 @@
- `run_tags` (map[string]string) - Tags to apply to the instance that is *launched* to create the image. - `run_tags` (map[string]string) - Tags to apply to the instance that is *launched* to create the image.
These tags are *not* applied to the resulting image. These tags are *not* applied to the resulting image.
- `run_tag` ([]hcl2template.KeyValues) - Same as [`run_tags`](#run_tags) but defined as a singular block
containing a key and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.
- `ssh_private_ip` (bool) - SSH Private Ip - `ssh_private_ip` (bool) - SSH Private Ip

View File

@ -23,8 +23,12 @@
set the user-script metadata key to have Triton start a user supplied set the user-script metadata key to have Triton start a user supplied
script after the VM has booted. script after the VM has booted.
- `source_machine_tags` (map[string]string) - Tags applied to the - `source_machine_tags` (map[string]string) - Tags applied to the VM used to create the image.
VM used to create the image.
- `source_machine_tag` ([]hcl2template.KeyValues) - Same as [`source_machine_tags`](#source_machine_tags) but defined as a
singular block containing a key and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.
- `source_machine_firewall_enabled` (bool) - Whether or not the firewall - `source_machine_firewall_enabled` (bool) - Whether or not the firewall
of the VM used to create an image of is enabled. The Triton firewall only of the VM used to create an image of is enabled. The Triton firewall only

View File

@ -14,4 +14,9 @@
credentials are used) will have access to the image. credentials are used) will have access to the image.
- `image_tags` (map[string]string) - Tag applied to the image. - `image_tags` (map[string]string) - Tag applied to the image.
- `image_tag` ([]hcl2template.KeyValues) - Same as [`image_tags`](#image_tags) but defined as a singular block
containing a key and a value field. In HCL2 mode the
[`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
will allow you to create those programatically.