diff --git a/builder/alicloud/ecs/image_config.go b/builder/alicloud/ecs/image_config.go index 5f6218abd..7b3f47c55 100644 --- a/builder/alicloud/ecs/image_config.go +++ b/builder/alicloud/ecs/image_config.go @@ -192,7 +192,7 @@ type AlicloudImageConfig struct { AlicloudImageSkipRegionValidation bool `mapstructure:"skip_region_validation" required:"false"` // Tags applied to the destination image and relevant snapshots. AlicloudImageTags map[string]string `mapstructure:"tags" required:"false"` - // Same as [`tags`](#tags) but defined as a singular block containing a key + // Same as [`tags`](#tags) but defined as a singular repeatable 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. diff --git a/builder/amazon/common/ami_config.go b/builder/amazon/common/ami_config.go index 300c2e993..0174e7882 100644 --- a/builder/amazon/common/ami_config.go +++ b/builder/amazon/common/ami_config.go @@ -51,7 +51,7 @@ type AMIConfig struct { // [template engine](/docs/templates/engine.html), see [Build template // data](#build-template-data) for more information. AMITags TagMap `mapstructure:"tags" required:"false"` - // Same as [`tags`](#tags) but defined as a singular block containing a key + // Same as [`tags`](#tags) but defined as a singular repeatable 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. diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go index dc6e8b6e7..ef00e1cc8 100644 --- a/builder/amazon/common/run_config.go +++ b/builder/amazon/common/run_config.go @@ -187,11 +187,11 @@ type RunConfig struct { // EBS volumes. This is a [template engine](/docs/templates/engine.html), // see [Build template data](#build-template-data) for more information. RunTags map[string]string `mapstructure:"run_tags" required:"false"` - // Same as [`run_tags`](#run_tags) but defined as a singular block + // Same as [`run_tags`](#run_tags) but defined as a singular repeatable 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"` + RunTag hcl2template.KeyValues `mapstructure:"run_tag" required:"false"` // The ID (not the name) of the security // 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. @@ -284,7 +284,7 @@ type RunConfig struct { // Requires spot_price to be set. This tells Packer to apply tags to the // spot request that is issued. SpotTags map[string]string `mapstructure:"spot_tags" required:"false"` - // Same as [`spot_tags`](#spot_tags) but defined as a singular block + // Same as [`spot_tags`](#spot_tags) but defined as a singular repeatable 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. @@ -422,6 +422,16 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { // Validation errs := c.Comm.Prepare(ctx) + for _, s := range []struct { + tagMap TagMap + kvs hcl2template.KeyValues + }{ + {c.RunTags, c.RunTag}, + {c.SpotTags, c.SpotTag}, + } { + errs = append(errs, s.kvs.CopyOn(s.tagMap)...) + } + for _, preparer := range []interface{ Prepare() []error }{ &c.SourceAmiFilter, &c.SecurityGroupFilter, diff --git a/builder/amazon/ebsvolume/block_device.go b/builder/amazon/ebsvolume/block_device.go index c0253c227..fe4b51a15 100644 --- a/builder/amazon/ebsvolume/block_device.go +++ b/builder/amazon/ebsvolume/block_device.go @@ -15,7 +15,7 @@ type BlockDevice struct { // completes. This is a [template engine](/docs/templates/engine.html), see // [Build template data](#build-template-data) for more information. Tags awscommon.TagMap `mapstructure:"tags" required:"false"` - // Same as [`tags`](#tags) but defined as a singular block + // Same as [`tags`](#tags) but defined as a singular repeatable 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. diff --git a/builder/azure/arm/config.go b/builder/azure/arm/config.go index 3e2fbb659..ed088b489 100644 --- a/builder/azure/arm/config.go +++ b/builder/azure/arm/config.go @@ -241,7 +241,7 @@ type Config struct { // 256 characters. Tags are applied to every resource deployed by a Packer // build, i.e. Resource Group, VM, NIC, VNET, Public IP, KeyVault, etc. AzureTags map[string]*string `mapstructure:"azure_tags" required:"false"` - // Same as [`azure_tags`](#azure_tags) but defined as a singular block + // Same as [`azure_tags`](#azure_tags) but defined as a singular repeatable 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. diff --git a/builder/hyperone/config.go b/builder/hyperone/config.go index 413f77d92..07082f886 100644 --- a/builder/hyperone/config.go +++ b/builder/hyperone/config.go @@ -63,7 +63,7 @@ type Config struct { ImageDescription string `mapstructure:"image_description" required:"false"` // Key/value pair tags to add to the created image. ImageTags map[string]string `mapstructure:"image_tags" required:"false"` - // Same as [`image_tags`](#image_tags) but defined as a singular block + // Same as [`image_tags`](#image_tags) but defined as a singular repeatable 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. @@ -77,7 +77,7 @@ type Config struct { // Key/value pair tags to // add to the created server. VmTags map[string]string `mapstructure:"vm_tags" required:"false"` - // Same as [`vm_tags`](#vm_tags) but defined as a singular block containing + // Same as [`vm_tags`](#vm_tags) but defined as a singular repeatable 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. diff --git a/builder/tencentcloud/cvm/run_config.go b/builder/tencentcloud/cvm/run_config.go index 315ddcec8..96fe7956a 100644 --- a/builder/tencentcloud/cvm/run_config.go +++ b/builder/tencentcloud/cvm/run_config.go @@ -84,7 +84,7 @@ type TencentCloudRunConfig struct { // Tags to apply to the instance that is *launched* to create the image. // These tags are *not* applied to the resulting image. RunTags map[string]string `mapstructure:"run_tags" required:"false"` - // Same as [`run_tags`](#run_tags) but defined as a singular block + // Same as [`run_tags`](#run_tags) but defined as a singular repeatable 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. diff --git a/builder/triton/target_image_config.go b/builder/triton/target_image_config.go index 43dd6d34f..1e545ec75 100644 --- a/builder/triton/target_image_config.go +++ b/builder/triton/target_image_config.go @@ -37,7 +37,7 @@ type TargetImageConfig struct { ImageACL []string `mapstructure:"image_acls" required:"false"` // Tag applied to the image. ImageTags map[string]string `mapstructure:"image_tags" required:"false"` - // Same as [`image_tags`](#image_tags) but defined as a singular block + // Same as [`image_tags`](#image_tags) but defined as a singular repeatable 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.