From 73242e8de422228c0345b75d46bed9a21cdd8fa8 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Thu, 16 Apr 2020 15:37:22 +0200 Subject: [PATCH 1/3] make sure keyvalue and namevalue filters are using the same naming as the service being used --- builder/alicloud/ecs/builder.hcl2spec.go | 190 +++++++++--------- builder/alicloud/ecs/image_config.go | 7 +- builder/amazon/chroot/builder.go | 8 +- builder/amazon/chroot/builder.hcl2spec.go | 12 +- builder/amazon/common/ami_config.go | 18 +- builder/amazon/common/run_config.go | 35 ++-- builder/amazon/common/run_config.hcl2spec.go | 10 +- builder/amazon/common/run_config_test.go | 2 +- builder/amazon/ebs/builder.hcl2spec.go | 16 +- .../amazon/ebssurrogate/builder.hcl2spec.go | 16 +- builder/amazon/ebsvolume/block_device.go | 6 +- builder/amazon/ebsvolume/builder.go | 12 +- builder/amazon/ebsvolume/builder.hcl2spec.go | 38 ++-- builder/amazon/instance/builder.hcl2spec.go | 16 +- builder/azure/arm/config.go | 8 +- builder/hyperone/config.go | 9 +- builder/hyperone/config.hcl2spec.go | 4 +- builder/osc/common/run_config.go | 25 ++- builder/osc/common/run_config_test.go | 4 +- builder/tencentcloud/cvm/builder.hcl2spec.go | 172 ++++++++-------- builder/tencentcloud/cvm/run_config.go | 8 +- builder/triton/config.hcl2spec.go | 4 +- builder/triton/source_machine_config.go | 6 +- builder/triton/target_image_config.go | 2 +- hcl2template/types.kv.go | 52 ++++- hcl2template/types.kv.hcl2spec.go | 78 +++++-- .../post-processor.hcl2spec.go | 4 +- website/pages/docs/from-1.5/expressions.mdx | 6 +- .../ecs/AlicloudImageConfig-not-required.mdx | 7 +- .../amazon/chroot/Config-not-required.mdx | 8 +- .../amazon/common/AMIConfig-not-required.mdx | 18 +- .../amazon/common/RunConfig-not-required.mdx | 17 +- .../ebsvolume/BlockDevice-not-required.mdx | 6 +- .../amazon/ebsvolume/Config-not-required.mdx | 12 +- .../builder/azure/arm/Config-not-required.mdx | 8 +- .../builder/hyperone/Config-not-required.mdx | 9 +- .../TencentCloudRunConfig-not-required.mdx | 8 +- .../SourceMachineConfig-not-required.mdx | 6 +- .../triton/TargetImageConfig-not-required.mdx | 2 +- 39 files changed, 481 insertions(+), 388 deletions(-) diff --git a/builder/alicloud/ecs/builder.hcl2spec.go b/builder/alicloud/ecs/builder.hcl2spec.go index dc7c9bc49..1c2161d39 100644 --- a/builder/alicloud/ecs/builder.hcl2spec.go +++ b/builder/alicloud/ecs/builder.hcl2spec.go @@ -47,100 +47,100 @@ func (*FlatAlicloudDiskDevice) HCL2Spec() map[string]hcldec.Spec { // FlatConfig is an auto-generated flat version of Config. // Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. type FlatConfig struct { - PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name"` - PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type"` - PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug"` - PackerForce *bool `mapstructure:"packer_force" cty:"packer_force"` - PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error"` - PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables"` - PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables"` - AlicloudAccessKey *string `mapstructure:"access_key" required:"false" cty:"access_key"` - AlicloudSecretKey *string `mapstructure:"secret_key" required:"false" cty:"secret_key"` - AlicloudRegion *string `mapstructure:"region" required:"false" cty:"region"` - AlicloudSkipValidation *bool `mapstructure:"skip_region_validation" required:"false" cty:"skip_region_validation"` - AlicloudSkipImageValidation *bool `mapstructure:"skip_image_validation" required:"false" cty:"skip_image_validation"` - AlicloudProfile *string `mapstructure:"profile" required:"false" cty:"profile"` - AlicloudSharedCredentialsFile *string `mapstructure:"shared_credentials_file" required:"false" cty:"shared_credentials_file"` - SecurityToken *string `mapstructure:"security_token" required:"false" cty:"security_token"` - AlicloudImageName *string `mapstructure:"image_name" required:"true" cty:"image_name"` - AlicloudImageVersion *string `mapstructure:"image_version" required:"false" cty:"image_version"` - AlicloudImageDescription *string `mapstructure:"image_description" required:"false" cty:"image_description"` - AlicloudImageShareAccounts []string `mapstructure:"image_share_account" required:"false" cty:"image_share_account"` - AlicloudImageUNShareAccounts []string `mapstructure:"image_unshare_account" cty:"image_unshare_account"` - AlicloudImageDestinationRegions []string `mapstructure:"image_copy_regions" required:"false" cty:"image_copy_regions"` - AlicloudImageDestinationNames []string `mapstructure:"image_copy_names" required:"false" cty:"image_copy_names"` - ImageEncrypted *bool `mapstructure:"image_encrypted" required:"false" cty:"image_encrypted"` - AlicloudImageForceDelete *bool `mapstructure:"image_force_delete" required:"false" cty:"image_force_delete"` - AlicloudImageForceDeleteSnapshots *bool `mapstructure:"image_force_delete_snapshots" required:"false" cty:"image_force_delete_snapshots"` - AlicloudImageForceDeleteInstances *bool `mapstructure:"image_force_delete_instances" cty:"image_force_delete_instances"` - AlicloudImageIgnoreDataDisks *bool `mapstructure:"image_ignore_data_disks" required:"false" cty:"image_ignore_data_disks"` - AlicloudImageTags map[string]string `mapstructure:"tags" required:"false" cty:"tags"` - AlicloudImageTag []hcl2template.FlatNameValue `mapstructure:"tag" required:"false" cty:"tag"` - ECSSystemDiskMapping *FlatAlicloudDiskDevice `mapstructure:"system_disk_mapping" required:"false" cty:"system_disk_mapping"` - ECSImagesDiskMappings []FlatAlicloudDiskDevice `mapstructure:"image_disk_mappings" required:"false" cty:"image_disk_mappings"` - AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" cty:"associate_public_ip_address"` - ZoneId *string `mapstructure:"zone_id" required:"false" cty:"zone_id"` - IOOptimized *bool `mapstructure:"io_optimized" required:"false" cty:"io_optimized"` - InstanceType *string `mapstructure:"instance_type" required:"true" cty:"instance_type"` - Description *string `mapstructure:"description" cty:"description"` - AlicloudSourceImage *string `mapstructure:"source_image" required:"true" cty:"source_image"` - ForceStopInstance *bool `mapstructure:"force_stop_instance" required:"false" cty:"force_stop_instance"` - DisableStopInstance *bool `mapstructure:"disable_stop_instance" required:"false" cty:"disable_stop_instance"` - SecurityGroupId *string `mapstructure:"security_group_id" required:"false" cty:"security_group_id"` - SecurityGroupName *string `mapstructure:"security_group_name" required:"false" cty:"security_group_name"` - UserData *string `mapstructure:"user_data" required:"false" cty:"user_data"` - UserDataFile *string `mapstructure:"user_data_file" required:"false" cty:"user_data_file"` - VpcId *string `mapstructure:"vpc_id" required:"false" cty:"vpc_id"` - VpcName *string `mapstructure:"vpc_name" required:"false" cty:"vpc_name"` - CidrBlock *string `mapstructure:"vpc_cidr_block" required:"false" cty:"vpc_cidr_block"` - VSwitchId *string `mapstructure:"vswitch_id" required:"false" cty:"vswitch_id"` - VSwitchName *string `mapstructure:"vswitch_name" required:"false" cty:"vswitch_name"` - InstanceName *string `mapstructure:"instance_name" required:"false" cty:"instance_name"` - InternetChargeType *string `mapstructure:"internet_charge_type" required:"false" cty:"internet_charge_type"` - InternetMaxBandwidthOut *int `mapstructure:"internet_max_bandwidth_out" required:"false" cty:"internet_max_bandwidth_out"` - WaitSnapshotReadyTimeout *int `mapstructure:"wait_snapshot_ready_timeout" required:"false" cty:"wait_snapshot_ready_timeout"` - Type *string `mapstructure:"communicator" cty:"communicator"` - PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting"` - SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host"` - SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port"` - SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username"` - SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password"` - SSHKeyPairName *string `mapstructure:"ssh_keypair_name" cty:"ssh_keypair_name"` - SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" cty:"temporary_key_pair_name"` - SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys"` - SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" cty:"ssh_private_key_file"` - SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty"` - SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout"` - SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" cty:"ssh_agent_auth"` - SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding"` - SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts"` - SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host"` - SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port"` - SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth"` - SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username"` - SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password"` - SSHBastionInteractive *bool `mapstructure:"ssh_bastion_interactive" cty:"ssh_bastion_interactive"` - SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file"` - SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method"` - SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host"` - SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port"` - SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username"` - SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password"` - SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval"` - SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout"` - SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels"` - SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels"` - SSHPublicKey []byte `mapstructure:"ssh_public_key" cty:"ssh_public_key"` - SSHPrivateKey []byte `mapstructure:"ssh_private_key" cty:"ssh_private_key"` - WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username"` - WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password"` - WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host"` - WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port"` - WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout"` - WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl"` - WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure"` - WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm"` - SSHPrivateIp *bool `mapstructure:"ssh_private_ip" required:"false" cty:"ssh_private_ip"` + PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name"` + PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type"` + PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug"` + PackerForce *bool `mapstructure:"packer_force" cty:"packer_force"` + PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error"` + PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables"` + PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables"` + AlicloudAccessKey *string `mapstructure:"access_key" required:"false" cty:"access_key"` + AlicloudSecretKey *string `mapstructure:"secret_key" required:"false" cty:"secret_key"` + AlicloudRegion *string `mapstructure:"region" required:"false" cty:"region"` + AlicloudSkipValidation *bool `mapstructure:"skip_region_validation" required:"false" cty:"skip_region_validation"` + AlicloudSkipImageValidation *bool `mapstructure:"skip_image_validation" required:"false" cty:"skip_image_validation"` + AlicloudProfile *string `mapstructure:"profile" required:"false" cty:"profile"` + AlicloudSharedCredentialsFile *string `mapstructure:"shared_credentials_file" required:"false" cty:"shared_credentials_file"` + SecurityToken *string `mapstructure:"security_token" required:"false" cty:"security_token"` + AlicloudImageName *string `mapstructure:"image_name" required:"true" cty:"image_name"` + AlicloudImageVersion *string `mapstructure:"image_version" required:"false" cty:"image_version"` + AlicloudImageDescription *string `mapstructure:"image_description" required:"false" cty:"image_description"` + AlicloudImageShareAccounts []string `mapstructure:"image_share_account" required:"false" cty:"image_share_account"` + AlicloudImageUNShareAccounts []string `mapstructure:"image_unshare_account" cty:"image_unshare_account"` + AlicloudImageDestinationRegions []string `mapstructure:"image_copy_regions" required:"false" cty:"image_copy_regions"` + AlicloudImageDestinationNames []string `mapstructure:"image_copy_names" required:"false" cty:"image_copy_names"` + ImageEncrypted *bool `mapstructure:"image_encrypted" required:"false" cty:"image_encrypted"` + AlicloudImageForceDelete *bool `mapstructure:"image_force_delete" required:"false" cty:"image_force_delete"` + AlicloudImageForceDeleteSnapshots *bool `mapstructure:"image_force_delete_snapshots" required:"false" cty:"image_force_delete_snapshots"` + AlicloudImageForceDeleteInstances *bool `mapstructure:"image_force_delete_instances" cty:"image_force_delete_instances"` + AlicloudImageIgnoreDataDisks *bool `mapstructure:"image_ignore_data_disks" required:"false" cty:"image_ignore_data_disks"` + AlicloudImageTags map[string]string `mapstructure:"tags" required:"false" cty:"tags"` + AlicloudImageTag []hcl2template.FlatKeyValue `mapstructure:"tag" required:"false" cty:"tag"` + ECSSystemDiskMapping *FlatAlicloudDiskDevice `mapstructure:"system_disk_mapping" required:"false" cty:"system_disk_mapping"` + ECSImagesDiskMappings []FlatAlicloudDiskDevice `mapstructure:"image_disk_mappings" required:"false" cty:"image_disk_mappings"` + AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" cty:"associate_public_ip_address"` + ZoneId *string `mapstructure:"zone_id" required:"false" cty:"zone_id"` + IOOptimized *bool `mapstructure:"io_optimized" required:"false" cty:"io_optimized"` + InstanceType *string `mapstructure:"instance_type" required:"true" cty:"instance_type"` + Description *string `mapstructure:"description" cty:"description"` + AlicloudSourceImage *string `mapstructure:"source_image" required:"true" cty:"source_image"` + ForceStopInstance *bool `mapstructure:"force_stop_instance" required:"false" cty:"force_stop_instance"` + DisableStopInstance *bool `mapstructure:"disable_stop_instance" required:"false" cty:"disable_stop_instance"` + SecurityGroupId *string `mapstructure:"security_group_id" required:"false" cty:"security_group_id"` + SecurityGroupName *string `mapstructure:"security_group_name" required:"false" cty:"security_group_name"` + UserData *string `mapstructure:"user_data" required:"false" cty:"user_data"` + UserDataFile *string `mapstructure:"user_data_file" required:"false" cty:"user_data_file"` + VpcId *string `mapstructure:"vpc_id" required:"false" cty:"vpc_id"` + VpcName *string `mapstructure:"vpc_name" required:"false" cty:"vpc_name"` + CidrBlock *string `mapstructure:"vpc_cidr_block" required:"false" cty:"vpc_cidr_block"` + VSwitchId *string `mapstructure:"vswitch_id" required:"false" cty:"vswitch_id"` + VSwitchName *string `mapstructure:"vswitch_name" required:"false" cty:"vswitch_name"` + InstanceName *string `mapstructure:"instance_name" required:"false" cty:"instance_name"` + InternetChargeType *string `mapstructure:"internet_charge_type" required:"false" cty:"internet_charge_type"` + InternetMaxBandwidthOut *int `mapstructure:"internet_max_bandwidth_out" required:"false" cty:"internet_max_bandwidth_out"` + WaitSnapshotReadyTimeout *int `mapstructure:"wait_snapshot_ready_timeout" required:"false" cty:"wait_snapshot_ready_timeout"` + Type *string `mapstructure:"communicator" cty:"communicator"` + PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting"` + SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host"` + SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port"` + SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username"` + SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password"` + SSHKeyPairName *string `mapstructure:"ssh_keypair_name" cty:"ssh_keypair_name"` + SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" cty:"temporary_key_pair_name"` + SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys"` + SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" cty:"ssh_private_key_file"` + SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty"` + SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout"` + SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" cty:"ssh_agent_auth"` + SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding"` + SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts"` + SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host"` + SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port"` + SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth"` + SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username"` + SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password"` + SSHBastionInteractive *bool `mapstructure:"ssh_bastion_interactive" cty:"ssh_bastion_interactive"` + SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file"` + SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method"` + SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host"` + SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port"` + SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username"` + SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password"` + SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval"` + SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout"` + SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels"` + SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels"` + SSHPublicKey []byte `mapstructure:"ssh_public_key" cty:"ssh_public_key"` + SSHPrivateKey []byte `mapstructure:"ssh_private_key" cty:"ssh_private_key"` + WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username"` + WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password"` + WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host"` + WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port"` + WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout"` + WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl"` + WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure"` + WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm"` + SSHPrivateIp *bool `mapstructure:"ssh_private_ip" required:"false" cty:"ssh_private_ip"` } // FlatMapstructure returns a new FlatConfig. @@ -183,7 +183,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "image_force_delete_instances": &hcldec.AttrSpec{Name: "image_force_delete_instances", Type: cty.Bool, Required: false}, "image_ignore_data_disks": &hcldec.AttrSpec{Name: "image_ignore_data_disks", Type: cty.Bool, Required: false}, "tags": &hcldec.AttrSpec{Name: "tags", Type: cty.Map(cty.String), Required: false}, - "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "system_disk_mapping": &hcldec.BlockSpec{TypeName: "system_disk_mapping", Nested: hcldec.ObjectSpec((*FlatAlicloudDiskDevice)(nil).HCL2Spec())}, "image_disk_mappings": &hcldec.BlockListSpec{TypeName: "image_disk_mappings", Nested: hcldec.ObjectSpec((*FlatAlicloudDiskDevice)(nil).HCL2Spec())}, "associate_public_ip_address": &hcldec.AttrSpec{Name: "associate_public_ip_address", Type: cty.Bool, Required: false}, diff --git a/builder/alicloud/ecs/image_config.go b/builder/alicloud/ecs/image_config.go index e97efbed0..f1ba17246 100644 --- a/builder/alicloud/ecs/image_config.go +++ b/builder/alicloud/ecs/image_config.go @@ -190,13 +190,14 @@ type AlicloudImageConfig struct { // The region validation can be skipped // if this value is true, the default value is false. AlicloudImageSkipRegionValidation bool `mapstructure:"skip_region_validation" required:"false"` - // Tags applied to the destination image and relevant snapshots. + // Key/value pair 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 repeatable block - // containing a `name` and a `value` field. In HCL2 mode the + // containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. - AlicloudImageTag hcl2template.NameValues `mapstructure:"tag" required:"false"` + AlicloudImageTag hcl2template.KeyValues `mapstructure:"tag" required:"false"` AlicloudDiskDevices `mapstructure:",squash"` } diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go index 40ee04dfe..4053f77c8 100644 --- a/builder/amazon/chroot/builder.go +++ b/builder/amazon/chroot/builder.go @@ -160,15 +160,15 @@ type Config struct { //criteria provided in `source_ami_filter`; this pins the AMI returned by the //filter, but will cause Packer to fail if the `source_ami` does not exist. SourceAmiFilter awscommon.AmiFilterOptions `mapstructure:"source_ami_filter" required:"false"` - // Tags to apply to the volumes that are *launched*. This is a [template - // engine](/docs/templates/engine), see [Build template + // Key/value pair tags to apply to the volumes that are *launched*. This is + // a [template engine](/docs/templates/engine), see [Build template // data](#build-template-data) for more information. RootVolumeTags map[string]string `mapstructure:"root_volume_tags" required:"false"` // Same as [`root_volume_tags`](#root_volume_tags) but defined as a - // singular block containing a `name` and a `value` field. In HCL2 mode the + // singular block containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. - RootVolumeTag hcl2template.NameValues `mapstructure:"root_volume_tag" required:"false"` + RootVolumeTag hcl2template.KeyValues `mapstructure:"root_volume_tag" required:"false"` // what architecture to use when registering the final AMI; valid options // are "x86_64" or "arm64". Defaults to "x86_64". Architecture string `mapstructure:"ami_architecture" required:"false"` diff --git a/builder/amazon/chroot/builder.hcl2spec.go b/builder/amazon/chroot/builder.hcl2spec.go index cea9e9274..e06be3b57 100644 --- a/builder/amazon/chroot/builder.hcl2spec.go +++ b/builder/amazon/chroot/builder.hcl2spec.go @@ -27,7 +27,7 @@ type FlatConfig struct { AMIRegions []string `mapstructure:"ami_regions" required:"false" cty:"ami_regions"` AMISkipRegionValidation *bool `mapstructure:"skip_region_validation" required:"false" cty:"skip_region_validation"` AMITags map[string]string `mapstructure:"tags" required:"false" cty:"tags"` - AMITag []hcl2template.FlatNameValue `mapstructure:"tag" required:"false" cty:"tag"` + AMITag []hcl2template.FlatKeyValue `mapstructure:"tag" required:"false" cty:"tag"` AMIENASupport *bool `mapstructure:"ena_support" required:"false" cty:"ena_support"` AMISriovNetSupport *bool `mapstructure:"sriov_support" required:"false" cty:"sriov_support"` AMIForceDeregister *bool `mapstructure:"force_deregister" required:"false" cty:"force_deregister"` @@ -37,7 +37,7 @@ type FlatConfig struct { AMIRegionKMSKeyIDs map[string]string `mapstructure:"region_kms_key_ids" required:"false" cty:"region_kms_key_ids"` AMISkipBuildRegion *bool `mapstructure:"skip_save_build_region" cty:"skip_save_build_region"` SnapshotTags map[string]string `mapstructure:"snapshot_tags" required:"false" cty:"snapshot_tags"` - SnapshotTag []hcl2template.FlatNameValue `mapstructure:"snapshot_tag" required:"false" cty:"snapshot_tag"` + SnapshotTag []hcl2template.FlatKeyValue `mapstructure:"snapshot_tag" required:"false" cty:"snapshot_tag"` SnapshotUsers []string `mapstructure:"snapshot_users" required:"false" cty:"snapshot_users"` SnapshotGroups []string `mapstructure:"snapshot_groups" required:"false" cty:"snapshot_groups"` AccessKey *string `mapstructure:"access_key" required:"true" cty:"access_key"` @@ -70,7 +70,7 @@ type FlatConfig struct { SourceAmi *string `mapstructure:"source_ami" required:"true" cty:"source_ami"` SourceAmiFilter *common.FlatAmiFilterOptions `mapstructure:"source_ami_filter" required:"false" cty:"source_ami_filter"` RootVolumeTags map[string]string `mapstructure:"root_volume_tags" required:"false" cty:"root_volume_tags"` - RootVolumeTag []hcl2template.FlatNameValue `mapstructure:"root_volume_tag" required:"false" cty:"root_volume_tag"` + RootVolumeTag []hcl2template.FlatKeyValue `mapstructure:"root_volume_tag" required:"false" cty:"root_volume_tag"` Architecture *string `mapstructure:"ami_architecture" required:"false" cty:"ami_architecture"` } @@ -102,7 +102,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "ami_regions": &hcldec.AttrSpec{Name: "ami_regions", Type: cty.List(cty.String), Required: false}, "skip_region_validation": &hcldec.AttrSpec{Name: "skip_region_validation", Type: cty.Bool, Required: false}, "tags": &hcldec.AttrSpec{Name: "tags", Type: cty.Map(cty.String), Required: false}, - "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "ena_support": &hcldec.AttrSpec{Name: "ena_support", Type: cty.Bool, Required: false}, "sriov_support": &hcldec.AttrSpec{Name: "sriov_support", Type: cty.Bool, Required: false}, "force_deregister": &hcldec.AttrSpec{Name: "force_deregister", Type: cty.Bool, Required: false}, @@ -112,7 +112,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "region_kms_key_ids": &hcldec.AttrSpec{Name: "region_kms_key_ids", Type: cty.Map(cty.String), Required: false}, "skip_save_build_region": &hcldec.AttrSpec{Name: "skip_save_build_region", Type: cty.Bool, Required: false}, "snapshot_tags": &hcldec.AttrSpec{Name: "snapshot_tags", Type: cty.Map(cty.String), Required: false}, - "snapshot_tag": &hcldec.BlockListSpec{TypeName: "snapshot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "snapshot_tag": &hcldec.BlockListSpec{TypeName: "snapshot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "snapshot_users": &hcldec.AttrSpec{Name: "snapshot_users", Type: cty.List(cty.String), Required: false}, "snapshot_groups": &hcldec.AttrSpec{Name: "snapshot_groups", Type: cty.List(cty.String), Required: false}, "access_key": &hcldec.AttrSpec{Name: "access_key", Type: cty.String, Required: false}, @@ -145,7 +145,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "source_ami": &hcldec.AttrSpec{Name: "source_ami", Type: cty.String, Required: false}, "source_ami_filter": &hcldec.BlockSpec{TypeName: "source_ami_filter", Nested: hcldec.ObjectSpec((*common.FlatAmiFilterOptions)(nil).HCL2Spec())}, "root_volume_tags": &hcldec.AttrSpec{Name: "root_volume_tags", Type: cty.Map(cty.String), Required: false}, - "root_volume_tag": &hcldec.BlockListSpec{TypeName: "root_volume_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "root_volume_tag": &hcldec.BlockListSpec{TypeName: "root_volume_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "ami_architecture": &hcldec.AttrSpec{Name: "ami_architecture", Type: cty.String, Required: false}, } return s diff --git a/builder/amazon/common/ami_config.go b/builder/amazon/common/ami_config.go index 611692df7..8569753e3 100644 --- a/builder/amazon/common/ami_config.go +++ b/builder/amazon/common/ami_config.go @@ -47,15 +47,15 @@ type AMIConfig struct { // Set to true if you want to skip // validation of the ami_regions configuration option. Default false. AMISkipRegionValidation bool `mapstructure:"skip_region_validation" required:"false"` - // Tags applied to the AMI. This is a - // [template engine](/docs/templates/engine), see [Build template + // Key/value pair tags applied to the AMI. This is a [template + // engine](/docs/templates/engine), see [Build template // data](#build-template-data) for more information. AMITags map[string]string `mapstructure:"tags" required:"false"` // Same as [`tags`](#tags) but defined as a singular repeatable block - // containing a `name` and a `value` field. In HCL2 mode the + // containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. - AMITag hcl2template.NameValues `mapstructure:"tag" required:"false"` + AMITag hcl2template.KeyValues `mapstructure:"tag" required:"false"` // Enable enhanced networking (ENA but not SriovNetSupport) on // HVM-compatible AMIs. If set, add `ec2:ModifyInstanceAttribute` to your // AWS IAM policy. @@ -117,16 +117,16 @@ type AMIConfig struct { // the intermediary AMI into any regions provided in `ami_regions`, then // delete the intermediary AMI. Default `false`. AMISkipBuildRegion bool `mapstructure:"skip_save_build_region"` - // Tags to apply to snapshot. - // They will override AMI tags if already applied to snapshot. This is a - // [template engine](/docs/templates/engine), see [Build template + // Key/value pair tags to apply to snapshot. They will override AMI tags if + // already applied to snapshot. This is a [template + // engine](/docs/templates/engine), see [Build template // data](#build-template-data) for more information. SnapshotTags map[string]string `mapstructure:"snapshot_tags" required:"false"` // Same as [`snapshot_tags`](#snapshot_tags) but defined as a singular - // repeatable block containing a `name` and a `value` field. In HCL2 mode the + // repeatable block containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. - SnapshotTag hcl2template.NameValues `mapstructure:"snapshot_tag" required:"false"` + SnapshotTag hcl2template.KeyValues `mapstructure:"snapshot_tag" required:"false"` // A list of account IDs that have // access to create volumes from the snapshot(s). By default no additional // users other than the user creating the AMI has permissions to create diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go index 6270ec8bf..ed04a03ca 100644 --- a/builder/amazon/common/run_config.go +++ b/builder/amazon/common/run_config.go @@ -20,9 +20,9 @@ import ( var reShutdownBehavior = regexp.MustCompile("^(stop|terminate)$") type AmiFilterOptions struct { - hcl2template.KVFilter `mapstructure:",squash"` - Owners []string - MostRecent bool `mapstructure:"most_recent"` + hcl2template.KeyValueFilter `mapstructure:",squash"` + Owners []string + MostRecent bool `mapstructure:"most_recent"` } func (d *AmiFilterOptions) GetOwners() []*string { @@ -35,7 +35,7 @@ func (d *AmiFilterOptions) GetOwners() []*string { } func (d *AmiFilterOptions) Empty() bool { - return len(d.Owners) == 0 && d.KVFilter.Empty() + return len(d.Owners) == 0 && d.KeyValueFilter.Empty() } func (d *AmiFilterOptions) NoOwner() bool { @@ -43,13 +43,13 @@ func (d *AmiFilterOptions) NoOwner() bool { } type SubnetFilterOptions struct { - hcl2template.KVFilter `mapstructure:",squash"` - MostFree bool `mapstructure:"most_free"` - Random bool `mapstructure:"random"` + hcl2template.NameValueFilter `mapstructure:",squash"` + MostFree bool `mapstructure:"most_free"` + Random bool `mapstructure:"random"` } type VpcFilterOptions struct { - hcl2template.KVFilter `mapstructure:",squash"` + hcl2template.NameValueFilter `mapstructure:",squash"` } type Statement struct { @@ -64,7 +64,7 @@ type PolicyDocument struct { } type SecurityGroupFilterOptions struct { - hcl2template.KVFilter `mapstructure:",squash"` + hcl2template.NameValueFilter `mapstructure:",squash"` } // RunConfig contains configuration for running an instance from a source @@ -183,15 +183,16 @@ type RunConfig struct { // // `security_group_ids` take precedence over this. SecurityGroupFilter SecurityGroupFilterOptions `mapstructure:"security_group_filter" required:"false"` - // Tags to apply to the instance that is that is *launched* to create the - // EBS volumes. This is a [template engine](/docs/templates/engine), - // see [Build template data](#build-template-data) for more information. + // Key/value pair tags to apply to the instance that is that is *launched* + // to create the EBS volumes. This is a [template + // engine](/docs/templates/engine), 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 repeatable - // block containing a `name` and a `value` field. In HCL2 mode the + // block containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. - RunTag hcl2template.NameValues `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. @@ -281,14 +282,14 @@ type RunConfig struct { // Windows, Linux/UNIX (Amazon VPC), SUSE Linux (Amazon VPC), // Windows (Amazon VPC) SpotPriceAutoProduct string `mapstructure:"spot_price_auto_product" required:"false"` - // Requires spot_price to be set. This tells Packer to apply tags to the + // Requires spot_price to be set. Key/value pair tags 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 repeatable block - // containing a `name` and a `value` field. In HCL2 mode the + // containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. - SpotTag hcl2template.NameValues `mapstructure:"spot_tag" required:"false"` + SpotTag hcl2template.KeyValues `mapstructure:"spot_tag" required:"false"` // Filters used to populate the `subnet_id` field. // Example: // diff --git a/builder/amazon/common/run_config.hcl2spec.go b/builder/amazon/common/run_config.hcl2spec.go index 8fc0b6829..cbdcbad78 100644 --- a/builder/amazon/common/run_config.hcl2spec.go +++ b/builder/amazon/common/run_config.hcl2spec.go @@ -10,10 +10,10 @@ import ( // FlatAmiFilterOptions is an auto-generated flat version of AmiFilterOptions. // Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. type FlatAmiFilterOptions struct { - Filters map[string]string `cty:"filters"` - Filter []hcl2template.FlatNameValue `cty:"filter"` - Owners []string `cty:"owners"` - MostRecent *bool `mapstructure:"most_recent" cty:"most_recent"` + Filters map[string]string `cty:"filters"` + Filter []hcl2template.FlatKeyValue `cty:"filter"` + Owners []string `cty:"owners"` + MostRecent *bool `mapstructure:"most_recent" cty:"most_recent"` } // FlatMapstructure returns a new FlatAmiFilterOptions. @@ -29,7 +29,7 @@ func (*AmiFilterOptions) FlatMapstructure() interface{ HCL2Spec() map[string]hcl func (*FlatAmiFilterOptions) HCL2Spec() map[string]hcldec.Spec { s := map[string]hcldec.Spec{ "filters": &hcldec.AttrSpec{Name: "filters", Type: cty.Map(cty.String), Required: false}, - "filter": &hcldec.BlockListSpec{TypeName: "filter", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "filter": &hcldec.BlockListSpec{TypeName: "filter", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "owners": &hcldec.AttrSpec{Name: "owners", Type: cty.List(cty.String), Required: false}, "most_recent": &hcldec.AttrSpec{Name: "most_recent", Type: cty.Bool, Required: false}, } diff --git a/builder/amazon/common/run_config_test.go b/builder/amazon/common/run_config_test.go index ddd208db6..23e28adf4 100644 --- a/builder/amazon/common/run_config_test.go +++ b/builder/amazon/common/run_config_test.go @@ -87,7 +87,7 @@ func TestRunConfigPrepare_SourceAmiFilterGood(t *testing.T) { filter_value := "foo" goodFilter := AmiFilterOptions{ Owners: []string{owner}, - KVFilter: hcl2template.KVFilter{ + KeyValueFilter: hcl2template.KeyValueFilter{ Filters: map[string]string{filter_key: filter_value}, }, } diff --git a/builder/amazon/ebs/builder.hcl2spec.go b/builder/amazon/ebs/builder.hcl2spec.go index e0d08df32..e92dbdef1 100644 --- a/builder/amazon/ebs/builder.hcl2spec.go +++ b/builder/amazon/ebs/builder.hcl2spec.go @@ -39,7 +39,7 @@ type FlatConfig struct { AMIProductCodes []string `mapstructure:"ami_product_codes" required:"false" cty:"ami_product_codes"` AMIRegions []string `mapstructure:"ami_regions" required:"false" cty:"ami_regions"` AMITags map[string]string `mapstructure:"tags" required:"false" cty:"tags"` - AMITag []hcl2template.FlatNameValue `mapstructure:"tag" required:"false" cty:"tag"` + AMITag []hcl2template.FlatKeyValue `mapstructure:"tag" required:"false" cty:"tag"` AMIENASupport *bool `mapstructure:"ena_support" required:"false" cty:"ena_support"` AMISriovNetSupport *bool `mapstructure:"sriov_support" required:"false" cty:"sriov_support"` AMIForceDeregister *bool `mapstructure:"force_deregister" required:"false" cty:"force_deregister"` @@ -49,7 +49,7 @@ type FlatConfig struct { AMIRegionKMSKeyIDs map[string]string `mapstructure:"region_kms_key_ids" required:"false" cty:"region_kms_key_ids"` AMISkipBuildRegion *bool `mapstructure:"skip_save_build_region" cty:"skip_save_build_region"` SnapshotTags map[string]string `mapstructure:"snapshot_tags" required:"false" cty:"snapshot_tags"` - SnapshotTag []hcl2template.FlatNameValue `mapstructure:"snapshot_tag" required:"false" cty:"snapshot_tag"` + SnapshotTag []hcl2template.FlatKeyValue `mapstructure:"snapshot_tag" required:"false" cty:"snapshot_tag"` SnapshotUsers []string `mapstructure:"snapshot_users" required:"false" cty:"snapshot_users"` SnapshotGroups []string `mapstructure:"snapshot_groups" required:"false" cty:"snapshot_groups"` AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" required:"false" cty:"associate_public_ip_address"` @@ -65,7 +65,7 @@ type FlatConfig struct { InstanceType *string `mapstructure:"instance_type" required:"true" cty:"instance_type"` SecurityGroupFilter *common.FlatSecurityGroupFilterOptions `mapstructure:"security_group_filter" required:"false" cty:"security_group_filter"` RunTags map[string]string `mapstructure:"run_tags" required:"false" cty:"run_tags"` - RunTag []hcl2template.FlatNameValue `mapstructure:"run_tag" required:"false" cty:"run_tag"` + RunTag []hcl2template.FlatKeyValue `mapstructure:"run_tag" required:"false" cty:"run_tag"` SecurityGroupId *string `mapstructure:"security_group_id" required:"false" cty:"security_group_id"` SecurityGroupIds []string `mapstructure:"security_group_ids" required:"false" cty:"security_group_ids"` SourceAmi *string `mapstructure:"source_ami" required:"true" cty:"source_ami"` @@ -74,7 +74,7 @@ type FlatConfig struct { SpotPrice *string `mapstructure:"spot_price" required:"false" cty:"spot_price"` SpotPriceAutoProduct *string `mapstructure:"spot_price_auto_product" required:"false" cty:"spot_price_auto_product"` SpotTags map[string]string `mapstructure:"spot_tags" required:"false" cty:"spot_tags"` - SpotTag []hcl2template.FlatNameValue `mapstructure:"spot_tag" required:"false" cty:"spot_tag"` + SpotTag []hcl2template.FlatKeyValue `mapstructure:"spot_tag" required:"false" cty:"spot_tag"` SubnetFilter *common.FlatSubnetFilterOptions `mapstructure:"subnet_filter" required:"false" cty:"subnet_filter"` SubnetId *string `mapstructure:"subnet_id" required:"false" cty:"subnet_id"` TemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" required:"false" cty:"temporary_key_pair_name"` @@ -171,7 +171,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "ami_product_codes": &hcldec.AttrSpec{Name: "ami_product_codes", Type: cty.List(cty.String), Required: false}, "ami_regions": &hcldec.AttrSpec{Name: "ami_regions", Type: cty.List(cty.String), Required: false}, "tags": &hcldec.AttrSpec{Name: "tags", Type: cty.Map(cty.String), Required: false}, - "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "ena_support": &hcldec.AttrSpec{Name: "ena_support", Type: cty.Bool, Required: false}, "sriov_support": &hcldec.AttrSpec{Name: "sriov_support", Type: cty.Bool, Required: false}, "force_deregister": &hcldec.AttrSpec{Name: "force_deregister", Type: cty.Bool, Required: false}, @@ -181,7 +181,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "region_kms_key_ids": &hcldec.AttrSpec{Name: "region_kms_key_ids", Type: cty.Map(cty.String), Required: false}, "skip_save_build_region": &hcldec.AttrSpec{Name: "skip_save_build_region", Type: cty.Bool, Required: false}, "snapshot_tags": &hcldec.AttrSpec{Name: "snapshot_tags", Type: cty.Map(cty.String), Required: false}, - "snapshot_tag": &hcldec.BlockListSpec{TypeName: "snapshot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "snapshot_tag": &hcldec.BlockListSpec{TypeName: "snapshot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "snapshot_users": &hcldec.AttrSpec{Name: "snapshot_users", Type: cty.List(cty.String), Required: false}, "snapshot_groups": &hcldec.AttrSpec{Name: "snapshot_groups", Type: cty.List(cty.String), Required: false}, "associate_public_ip_address": &hcldec.AttrSpec{Name: "associate_public_ip_address", Type: cty.Bool, Required: false}, @@ -197,7 +197,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "instance_type": &hcldec.AttrSpec{Name: "instance_type", Type: cty.String, Required: false}, "security_group_filter": &hcldec.BlockSpec{TypeName: "security_group_filter", Nested: hcldec.ObjectSpec((*common.FlatSecurityGroupFilterOptions)(nil).HCL2Spec())}, "run_tags": &hcldec.AttrSpec{Name: "run_tags", Type: cty.Map(cty.String), Required: false}, - "run_tag": &hcldec.BlockListSpec{TypeName: "run_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "run_tag": &hcldec.BlockListSpec{TypeName: "run_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "security_group_id": &hcldec.AttrSpec{Name: "security_group_id", Type: cty.String, Required: false}, "security_group_ids": &hcldec.AttrSpec{Name: "security_group_ids", Type: cty.List(cty.String), Required: false}, "source_ami": &hcldec.AttrSpec{Name: "source_ami", Type: cty.String, Required: false}, @@ -206,7 +206,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "spot_price": &hcldec.AttrSpec{Name: "spot_price", Type: cty.String, Required: false}, "spot_price_auto_product": &hcldec.AttrSpec{Name: "spot_price_auto_product", Type: cty.String, Required: false}, "spot_tags": &hcldec.AttrSpec{Name: "spot_tags", Type: cty.Map(cty.String), Required: false}, - "spot_tag": &hcldec.BlockListSpec{TypeName: "spot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "spot_tag": &hcldec.BlockListSpec{TypeName: "spot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "subnet_filter": &hcldec.BlockSpec{TypeName: "subnet_filter", Nested: hcldec.ObjectSpec((*common.FlatSubnetFilterOptions)(nil).HCL2Spec())}, "subnet_id": &hcldec.AttrSpec{Name: "subnet_id", Type: cty.String, Required: false}, "temporary_key_pair_name": &hcldec.AttrSpec{Name: "temporary_key_pair_name", Type: cty.String, Required: false}, diff --git a/builder/amazon/ebssurrogate/builder.hcl2spec.go b/builder/amazon/ebssurrogate/builder.hcl2spec.go index 0e6ee4b72..b0ea766f6 100644 --- a/builder/amazon/ebssurrogate/builder.hcl2spec.go +++ b/builder/amazon/ebssurrogate/builder.hcl2spec.go @@ -87,7 +87,7 @@ type FlatConfig struct { InstanceType *string `mapstructure:"instance_type" required:"true" cty:"instance_type"` SecurityGroupFilter *common.FlatSecurityGroupFilterOptions `mapstructure:"security_group_filter" required:"false" cty:"security_group_filter"` RunTags map[string]string `mapstructure:"run_tags" required:"false" cty:"run_tags"` - RunTag []hcl2template.FlatNameValue `mapstructure:"run_tag" required:"false" cty:"run_tag"` + RunTag []hcl2template.FlatKeyValue `mapstructure:"run_tag" required:"false" cty:"run_tag"` SecurityGroupId *string `mapstructure:"security_group_id" required:"false" cty:"security_group_id"` SecurityGroupIds []string `mapstructure:"security_group_ids" required:"false" cty:"security_group_ids"` SourceAmi *string `mapstructure:"source_ami" required:"true" cty:"source_ami"` @@ -96,7 +96,7 @@ type FlatConfig struct { SpotPrice *string `mapstructure:"spot_price" required:"false" cty:"spot_price"` SpotPriceAutoProduct *string `mapstructure:"spot_price_auto_product" required:"false" cty:"spot_price_auto_product"` SpotTags map[string]string `mapstructure:"spot_tags" required:"false" cty:"spot_tags"` - SpotTag []hcl2template.FlatNameValue `mapstructure:"spot_tag" required:"false" cty:"spot_tag"` + SpotTag []hcl2template.FlatKeyValue `mapstructure:"spot_tag" required:"false" cty:"spot_tag"` SubnetFilter *common.FlatSubnetFilterOptions `mapstructure:"subnet_filter" required:"false" cty:"subnet_filter"` SubnetId *string `mapstructure:"subnet_id" required:"false" cty:"subnet_id"` TemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" required:"false" cty:"temporary_key_pair_name"` @@ -155,7 +155,7 @@ type FlatConfig struct { AMIProductCodes []string `mapstructure:"ami_product_codes" required:"false" cty:"ami_product_codes"` AMIRegions []string `mapstructure:"ami_regions" required:"false" cty:"ami_regions"` AMITags map[string]string `mapstructure:"tags" required:"false" cty:"tags"` - AMITag []hcl2template.FlatNameValue `mapstructure:"tag" required:"false" cty:"tag"` + AMITag []hcl2template.FlatKeyValue `mapstructure:"tag" required:"false" cty:"tag"` AMIENASupport *bool `mapstructure:"ena_support" required:"false" cty:"ena_support"` AMISriovNetSupport *bool `mapstructure:"sriov_support" required:"false" cty:"sriov_support"` AMIForceDeregister *bool `mapstructure:"force_deregister" required:"false" cty:"force_deregister"` @@ -165,7 +165,7 @@ type FlatConfig struct { AMIRegionKMSKeyIDs map[string]string `mapstructure:"region_kms_key_ids" required:"false" cty:"region_kms_key_ids"` AMISkipBuildRegion *bool `mapstructure:"skip_save_build_region" cty:"skip_save_build_region"` SnapshotTags map[string]string `mapstructure:"snapshot_tags" required:"false" cty:"snapshot_tags"` - SnapshotTag []hcl2template.FlatNameValue `mapstructure:"snapshot_tag" required:"false" cty:"snapshot_tag"` + SnapshotTag []hcl2template.FlatKeyValue `mapstructure:"snapshot_tag" required:"false" cty:"snapshot_tag"` SnapshotUsers []string `mapstructure:"snapshot_users" required:"false" cty:"snapshot_users"` SnapshotGroups []string `mapstructure:"snapshot_groups" required:"false" cty:"snapshot_groups"` AMIMappings []common.FlatBlockDevice `mapstructure:"ami_block_device_mappings" required:"false" cty:"ami_block_device_mappings"` @@ -220,7 +220,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "instance_type": &hcldec.AttrSpec{Name: "instance_type", Type: cty.String, Required: false}, "security_group_filter": &hcldec.BlockSpec{TypeName: "security_group_filter", Nested: hcldec.ObjectSpec((*common.FlatSecurityGroupFilterOptions)(nil).HCL2Spec())}, "run_tags": &hcldec.AttrSpec{Name: "run_tags", Type: cty.Map(cty.String), Required: false}, - "run_tag": &hcldec.BlockListSpec{TypeName: "run_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "run_tag": &hcldec.BlockListSpec{TypeName: "run_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "security_group_id": &hcldec.AttrSpec{Name: "security_group_id", Type: cty.String, Required: false}, "security_group_ids": &hcldec.AttrSpec{Name: "security_group_ids", Type: cty.List(cty.String), Required: false}, "source_ami": &hcldec.AttrSpec{Name: "source_ami", Type: cty.String, Required: false}, @@ -229,7 +229,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "spot_price": &hcldec.AttrSpec{Name: "spot_price", Type: cty.String, Required: false}, "spot_price_auto_product": &hcldec.AttrSpec{Name: "spot_price_auto_product", Type: cty.String, Required: false}, "spot_tags": &hcldec.AttrSpec{Name: "spot_tags", Type: cty.Map(cty.String), Required: false}, - "spot_tag": &hcldec.BlockListSpec{TypeName: "spot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "spot_tag": &hcldec.BlockListSpec{TypeName: "spot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "subnet_filter": &hcldec.BlockSpec{TypeName: "subnet_filter", Nested: hcldec.ObjectSpec((*common.FlatSubnetFilterOptions)(nil).HCL2Spec())}, "subnet_id": &hcldec.AttrSpec{Name: "subnet_id", Type: cty.String, Required: false}, "temporary_key_pair_name": &hcldec.AttrSpec{Name: "temporary_key_pair_name", Type: cty.String, Required: false}, @@ -288,7 +288,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "ami_product_codes": &hcldec.AttrSpec{Name: "ami_product_codes", Type: cty.List(cty.String), Required: false}, "ami_regions": &hcldec.AttrSpec{Name: "ami_regions", Type: cty.List(cty.String), Required: false}, "tags": &hcldec.AttrSpec{Name: "tags", Type: cty.Map(cty.String), Required: false}, - "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "ena_support": &hcldec.AttrSpec{Name: "ena_support", Type: cty.Bool, Required: false}, "sriov_support": &hcldec.AttrSpec{Name: "sriov_support", Type: cty.Bool, Required: false}, "force_deregister": &hcldec.AttrSpec{Name: "force_deregister", Type: cty.Bool, Required: false}, @@ -298,7 +298,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "region_kms_key_ids": &hcldec.AttrSpec{Name: "region_kms_key_ids", Type: cty.Map(cty.String), Required: false}, "skip_save_build_region": &hcldec.AttrSpec{Name: "skip_save_build_region", Type: cty.Bool, Required: false}, "snapshot_tags": &hcldec.AttrSpec{Name: "snapshot_tags", Type: cty.Map(cty.String), Required: false}, - "snapshot_tag": &hcldec.BlockListSpec{TypeName: "snapshot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "snapshot_tag": &hcldec.BlockListSpec{TypeName: "snapshot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "snapshot_users": &hcldec.AttrSpec{Name: "snapshot_users", Type: cty.List(cty.String), Required: false}, "snapshot_groups": &hcldec.AttrSpec{Name: "snapshot_groups", Type: cty.List(cty.String), Required: false}, "ami_block_device_mappings": &hcldec.BlockListSpec{TypeName: "ami_block_device_mappings", Nested: hcldec.ObjectSpec((*common.FlatBlockDevice)(nil).HCL2Spec())}, diff --git a/builder/amazon/ebsvolume/block_device.go b/builder/amazon/ebsvolume/block_device.go index 2a54151d9..2d7166373 100644 --- a/builder/amazon/ebsvolume/block_device.go +++ b/builder/amazon/ebsvolume/block_device.go @@ -11,15 +11,15 @@ import ( type BlockDevice struct { awscommon.BlockDevice `mapstructure:",squash"` - // Tags to apply to the volume. These are retained after the builder + // Key/value pair tags to apply to the volume. These are retained after the builder // completes. This is a [template engine](/docs/templates/engine), see // [Build template data](#build-template-data) for more information. Tags map[string]string `mapstructure:"tags" required:"false"` // Same as [`tags`](#tags) but defined as a singular repeatable block - // containing a `name` and a `value` field. In HCL2 mode the + // containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. - Tag hcl2template.NameValues `mapstructure:"tag" required:"false"` + Tag hcl2template.KeyValues `mapstructure:"tag" required:"false"` } type BlockDevices []BlockDevice diff --git a/builder/amazon/ebsvolume/builder.go b/builder/amazon/ebsvolume/builder.go index dd008c4e0..01e5c38e2 100644 --- a/builder/amazon/ebsvolume/builder.go +++ b/builder/amazon/ebsvolume/builder.go @@ -53,10 +53,10 @@ type Config struct { // source instance. See the [BlockDevices](#block-devices-configuration) // documentation for fields. VolumeMappings BlockDevices `mapstructure:"ebs_volumes" required:"false"` - // Tags to apply to the volumes of the instance that is *launched* to - // create EBS Volumes. These tags will *not* appear in the tags of the - // resulting EBS volumes unless they're duplicated under `tags` in the - // `ebs_volumes` setting. This is a [template + // Key/value pair tags to apply to the volumes of the instance that is + // *launched* to create EBS Volumes. These tags will *not* appear in the + // tags of the resulting EBS volumes unless they're duplicated under `tags` + // in the `ebs_volumes` setting. This is a [template // engine](/docs/templates/engine), see [Build template // data](#build-template-data) for more information. // @@ -67,11 +67,11 @@ type Config struct { // reported as 'ready'. VolumeRunTags map[string]string `mapstructure:"run_volume_tags"` // Same as [`run_volume_tags`](#run_volume_tags) but defined as a singular - // repeatable block containing a `name` and a `value` field. In HCL2 mode + // repeatable block containing a `key` and a `value` field. In HCL2 mode // the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. - VolumeRunTag hcl2template.NameValues `mapstructure:"run_volume_tag"` + VolumeRunTag hcl2template.KeyValues `mapstructure:"run_volume_tag"` launchBlockDevices BlockDevices diff --git a/builder/amazon/ebsvolume/builder.hcl2spec.go b/builder/amazon/ebsvolume/builder.hcl2spec.go index fb4c54360..b90d5268e 100644 --- a/builder/amazon/ebsvolume/builder.hcl2spec.go +++ b/builder/amazon/ebsvolume/builder.hcl2spec.go @@ -11,18 +11,18 @@ import ( // FlatBlockDevice is an auto-generated flat version of BlockDevice. // Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. type FlatBlockDevice struct { - DeleteOnTermination *bool `mapstructure:"delete_on_termination" required:"false" cty:"delete_on_termination"` - DeviceName *string `mapstructure:"device_name" required:"false" cty:"device_name"` - Encrypted *bool `mapstructure:"encrypted" required:"false" cty:"encrypted"` - IOPS *int64 `mapstructure:"iops" required:"false" cty:"iops"` - NoDevice *bool `mapstructure:"no_device" required:"false" cty:"no_device"` - SnapshotId *string `mapstructure:"snapshot_id" required:"false" cty:"snapshot_id"` - VirtualName *string `mapstructure:"virtual_name" required:"false" cty:"virtual_name"` - VolumeType *string `mapstructure:"volume_type" required:"false" cty:"volume_type"` - VolumeSize *int64 `mapstructure:"volume_size" required:"false" cty:"volume_size"` - KmsKeyId *string `mapstructure:"kms_key_id" required:"false" cty:"kms_key_id"` - Tags map[string]string `mapstructure:"tags" required:"false" cty:"tags"` - Tag []hcl2template.FlatNameValue `mapstructure:"tag" required:"false" cty:"tag"` + DeleteOnTermination *bool `mapstructure:"delete_on_termination" required:"false" cty:"delete_on_termination"` + DeviceName *string `mapstructure:"device_name" required:"false" cty:"device_name"` + Encrypted *bool `mapstructure:"encrypted" required:"false" cty:"encrypted"` + IOPS *int64 `mapstructure:"iops" required:"false" cty:"iops"` + NoDevice *bool `mapstructure:"no_device" required:"false" cty:"no_device"` + SnapshotId *string `mapstructure:"snapshot_id" required:"false" cty:"snapshot_id"` + VirtualName *string `mapstructure:"virtual_name" required:"false" cty:"virtual_name"` + VolumeType *string `mapstructure:"volume_type" required:"false" cty:"volume_type"` + VolumeSize *int64 `mapstructure:"volume_size" required:"false" cty:"volume_size"` + KmsKeyId *string `mapstructure:"kms_key_id" required:"false" cty:"kms_key_id"` + Tags map[string]string `mapstructure:"tags" required:"false" cty:"tags"` + Tag []hcl2template.FlatKeyValue `mapstructure:"tag" required:"false" cty:"tag"` } // FlatMapstructure returns a new FlatBlockDevice. @@ -48,7 +48,7 @@ func (*FlatBlockDevice) HCL2Spec() map[string]hcldec.Spec { "volume_size": &hcldec.AttrSpec{Name: "volume_size", Type: cty.Number, Required: false}, "kms_key_id": &hcldec.AttrSpec{Name: "kms_key_id", Type: cty.String, Required: false}, "tags": &hcldec.AttrSpec{Name: "tags", Type: cty.Map(cty.String), Required: false}, - "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, } return s } @@ -89,7 +89,7 @@ type FlatConfig struct { InstanceType *string `mapstructure:"instance_type" required:"true" cty:"instance_type"` SecurityGroupFilter *common.FlatSecurityGroupFilterOptions `mapstructure:"security_group_filter" required:"false" cty:"security_group_filter"` RunTags map[string]string `mapstructure:"run_tags" required:"false" cty:"run_tags"` - RunTag []hcl2template.FlatNameValue `mapstructure:"run_tag" required:"false" cty:"run_tag"` + RunTag []hcl2template.FlatKeyValue `mapstructure:"run_tag" required:"false" cty:"run_tag"` SecurityGroupId *string `mapstructure:"security_group_id" required:"false" cty:"security_group_id"` SecurityGroupIds []string `mapstructure:"security_group_ids" required:"false" cty:"security_group_ids"` SourceAmi *string `mapstructure:"source_ami" required:"true" cty:"source_ami"` @@ -98,7 +98,7 @@ type FlatConfig struct { SpotPrice *string `mapstructure:"spot_price" required:"false" cty:"spot_price"` SpotPriceAutoProduct *string `mapstructure:"spot_price_auto_product" required:"false" cty:"spot_price_auto_product"` SpotTags map[string]string `mapstructure:"spot_tags" required:"false" cty:"spot_tags"` - SpotTag []hcl2template.FlatNameValue `mapstructure:"spot_tag" required:"false" cty:"spot_tag"` + SpotTag []hcl2template.FlatKeyValue `mapstructure:"spot_tag" required:"false" cty:"spot_tag"` SubnetFilter *common.FlatSubnetFilterOptions `mapstructure:"subnet_filter" required:"false" cty:"subnet_filter"` SubnetId *string `mapstructure:"subnet_id" required:"false" cty:"subnet_id"` TemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" required:"false" cty:"temporary_key_pair_name"` @@ -153,7 +153,7 @@ type FlatConfig struct { AMISriovNetSupport *bool `mapstructure:"sriov_support" required:"false" cty:"sriov_support"` VolumeMappings []FlatBlockDevice `mapstructure:"ebs_volumes" required:"false" cty:"ebs_volumes"` VolumeRunTags map[string]string `mapstructure:"run_volume_tags" cty:"run_volume_tags"` - VolumeRunTag []hcl2template.FlatNameValue `mapstructure:"run_volume_tag" cty:"run_volume_tag"` + VolumeRunTag []hcl2template.FlatKeyValue `mapstructure:"run_volume_tag" cty:"run_volume_tag"` } // FlatMapstructure returns a new FlatConfig. @@ -201,7 +201,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "instance_type": &hcldec.AttrSpec{Name: "instance_type", Type: cty.String, Required: false}, "security_group_filter": &hcldec.BlockSpec{TypeName: "security_group_filter", Nested: hcldec.ObjectSpec((*common.FlatSecurityGroupFilterOptions)(nil).HCL2Spec())}, "run_tags": &hcldec.AttrSpec{Name: "run_tags", Type: cty.Map(cty.String), Required: false}, - "run_tag": &hcldec.BlockListSpec{TypeName: "run_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "run_tag": &hcldec.BlockListSpec{TypeName: "run_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "security_group_id": &hcldec.AttrSpec{Name: "security_group_id", Type: cty.String, Required: false}, "security_group_ids": &hcldec.AttrSpec{Name: "security_group_ids", Type: cty.List(cty.String), Required: false}, "source_ami": &hcldec.AttrSpec{Name: "source_ami", Type: cty.String, Required: false}, @@ -210,7 +210,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "spot_price": &hcldec.AttrSpec{Name: "spot_price", Type: cty.String, Required: false}, "spot_price_auto_product": &hcldec.AttrSpec{Name: "spot_price_auto_product", Type: cty.String, Required: false}, "spot_tags": &hcldec.AttrSpec{Name: "spot_tags", Type: cty.Map(cty.String), Required: false}, - "spot_tag": &hcldec.BlockListSpec{TypeName: "spot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "spot_tag": &hcldec.BlockListSpec{TypeName: "spot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "subnet_filter": &hcldec.BlockSpec{TypeName: "subnet_filter", Nested: hcldec.ObjectSpec((*common.FlatSubnetFilterOptions)(nil).HCL2Spec())}, "subnet_id": &hcldec.AttrSpec{Name: "subnet_id", Type: cty.String, Required: false}, "temporary_key_pair_name": &hcldec.AttrSpec{Name: "temporary_key_pair_name", Type: cty.String, Required: false}, @@ -265,7 +265,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "sriov_support": &hcldec.AttrSpec{Name: "sriov_support", Type: cty.Bool, Required: false}, "ebs_volumes": &hcldec.BlockListSpec{TypeName: "ebs_volumes", Nested: hcldec.ObjectSpec((*FlatBlockDevice)(nil).HCL2Spec())}, "run_volume_tags": &hcldec.AttrSpec{Name: "run_volume_tags", Type: cty.Map(cty.String), Required: false}, - "run_volume_tag": &hcldec.BlockListSpec{TypeName: "run_volume_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "run_volume_tag": &hcldec.BlockListSpec{TypeName: "run_volume_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, } return s } diff --git a/builder/amazon/instance/builder.hcl2spec.go b/builder/amazon/instance/builder.hcl2spec.go index 4fa0cbd7d..ece1c4f66 100644 --- a/builder/amazon/instance/builder.hcl2spec.go +++ b/builder/amazon/instance/builder.hcl2spec.go @@ -39,7 +39,7 @@ type FlatConfig struct { AMIProductCodes []string `mapstructure:"ami_product_codes" required:"false" cty:"ami_product_codes"` AMIRegions []string `mapstructure:"ami_regions" required:"false" cty:"ami_regions"` AMITags map[string]string `mapstructure:"tags" required:"false" cty:"tags"` - AMITag []hcl2template.FlatNameValue `mapstructure:"tag" required:"false" cty:"tag"` + AMITag []hcl2template.FlatKeyValue `mapstructure:"tag" required:"false" cty:"tag"` AMIENASupport *bool `mapstructure:"ena_support" required:"false" cty:"ena_support"` AMISriovNetSupport *bool `mapstructure:"sriov_support" required:"false" cty:"sriov_support"` AMIForceDeregister *bool `mapstructure:"force_deregister" required:"false" cty:"force_deregister"` @@ -49,7 +49,7 @@ type FlatConfig struct { AMIRegionKMSKeyIDs map[string]string `mapstructure:"region_kms_key_ids" required:"false" cty:"region_kms_key_ids"` AMISkipBuildRegion *bool `mapstructure:"skip_save_build_region" cty:"skip_save_build_region"` SnapshotTags map[string]string `mapstructure:"snapshot_tags" required:"false" cty:"snapshot_tags"` - SnapshotTag []hcl2template.FlatNameValue `mapstructure:"snapshot_tag" required:"false" cty:"snapshot_tag"` + SnapshotTag []hcl2template.FlatKeyValue `mapstructure:"snapshot_tag" required:"false" cty:"snapshot_tag"` SnapshotUsers []string `mapstructure:"snapshot_users" required:"false" cty:"snapshot_users"` SnapshotGroups []string `mapstructure:"snapshot_groups" required:"false" cty:"snapshot_groups"` AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" required:"false" cty:"associate_public_ip_address"` @@ -65,7 +65,7 @@ type FlatConfig struct { InstanceType *string `mapstructure:"instance_type" required:"true" cty:"instance_type"` SecurityGroupFilter *common.FlatSecurityGroupFilterOptions `mapstructure:"security_group_filter" required:"false" cty:"security_group_filter"` RunTags map[string]string `mapstructure:"run_tags" required:"false" cty:"run_tags"` - RunTag []hcl2template.FlatNameValue `mapstructure:"run_tag" required:"false" cty:"run_tag"` + RunTag []hcl2template.FlatKeyValue `mapstructure:"run_tag" required:"false" cty:"run_tag"` SecurityGroupId *string `mapstructure:"security_group_id" required:"false" cty:"security_group_id"` SecurityGroupIds []string `mapstructure:"security_group_ids" required:"false" cty:"security_group_ids"` SourceAmi *string `mapstructure:"source_ami" required:"true" cty:"source_ami"` @@ -74,7 +74,7 @@ type FlatConfig struct { SpotPrice *string `mapstructure:"spot_price" required:"false" cty:"spot_price"` SpotPriceAutoProduct *string `mapstructure:"spot_price_auto_product" required:"false" cty:"spot_price_auto_product"` SpotTags map[string]string `mapstructure:"spot_tags" required:"false" cty:"spot_tags"` - SpotTag []hcl2template.FlatNameValue `mapstructure:"spot_tag" required:"false" cty:"spot_tag"` + SpotTag []hcl2template.FlatKeyValue `mapstructure:"spot_tag" required:"false" cty:"spot_tag"` SubnetFilter *common.FlatSubnetFilterOptions `mapstructure:"subnet_filter" required:"false" cty:"subnet_filter"` SubnetId *string `mapstructure:"subnet_id" required:"false" cty:"subnet_id"` TemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" required:"false" cty:"temporary_key_pair_name"` @@ -178,7 +178,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "ami_product_codes": &hcldec.AttrSpec{Name: "ami_product_codes", Type: cty.List(cty.String), Required: false}, "ami_regions": &hcldec.AttrSpec{Name: "ami_regions", Type: cty.List(cty.String), Required: false}, "tags": &hcldec.AttrSpec{Name: "tags", Type: cty.Map(cty.String), Required: false}, - "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "ena_support": &hcldec.AttrSpec{Name: "ena_support", Type: cty.Bool, Required: false}, "sriov_support": &hcldec.AttrSpec{Name: "sriov_support", Type: cty.Bool, Required: false}, "force_deregister": &hcldec.AttrSpec{Name: "force_deregister", Type: cty.Bool, Required: false}, @@ -188,7 +188,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "region_kms_key_ids": &hcldec.AttrSpec{Name: "region_kms_key_ids", Type: cty.Map(cty.String), Required: false}, "skip_save_build_region": &hcldec.AttrSpec{Name: "skip_save_build_region", Type: cty.Bool, Required: false}, "snapshot_tags": &hcldec.AttrSpec{Name: "snapshot_tags", Type: cty.Map(cty.String), Required: false}, - "snapshot_tag": &hcldec.BlockListSpec{TypeName: "snapshot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "snapshot_tag": &hcldec.BlockListSpec{TypeName: "snapshot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "snapshot_users": &hcldec.AttrSpec{Name: "snapshot_users", Type: cty.List(cty.String), Required: false}, "snapshot_groups": &hcldec.AttrSpec{Name: "snapshot_groups", Type: cty.List(cty.String), Required: false}, "associate_public_ip_address": &hcldec.AttrSpec{Name: "associate_public_ip_address", Type: cty.Bool, Required: false}, @@ -204,7 +204,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "instance_type": &hcldec.AttrSpec{Name: "instance_type", Type: cty.String, Required: false}, "security_group_filter": &hcldec.BlockSpec{TypeName: "security_group_filter", Nested: hcldec.ObjectSpec((*common.FlatSecurityGroupFilterOptions)(nil).HCL2Spec())}, "run_tags": &hcldec.AttrSpec{Name: "run_tags", Type: cty.Map(cty.String), Required: false}, - "run_tag": &hcldec.BlockListSpec{TypeName: "run_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "run_tag": &hcldec.BlockListSpec{TypeName: "run_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "security_group_id": &hcldec.AttrSpec{Name: "security_group_id", Type: cty.String, Required: false}, "security_group_ids": &hcldec.AttrSpec{Name: "security_group_ids", Type: cty.List(cty.String), Required: false}, "source_ami": &hcldec.AttrSpec{Name: "source_ami", Type: cty.String, Required: false}, @@ -213,7 +213,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "spot_price": &hcldec.AttrSpec{Name: "spot_price", Type: cty.String, Required: false}, "spot_price_auto_product": &hcldec.AttrSpec{Name: "spot_price_auto_product", Type: cty.String, Required: false}, "spot_tags": &hcldec.AttrSpec{Name: "spot_tags", Type: cty.Map(cty.String), Required: false}, - "spot_tag": &hcldec.BlockListSpec{TypeName: "spot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "spot_tag": &hcldec.BlockListSpec{TypeName: "spot_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "subnet_filter": &hcldec.BlockSpec{TypeName: "subnet_filter", Nested: hcldec.ObjectSpec((*common.FlatSubnetFilterOptions)(nil).HCL2Spec())}, "subnet_id": &hcldec.AttrSpec{Name: "subnet_id", Type: cty.String, Required: false}, "temporary_key_pair_name": &hcldec.AttrSpec{Name: "temporary_key_pair_name", Type: cty.String, Required: false}, diff --git a/builder/azure/arm/config.go b/builder/azure/arm/config.go index 35b1ee55c..6f81716d9 100644 --- a/builder/azure/arm/config.go +++ b/builder/azure/arm/config.go @@ -238,10 +238,10 @@ type Config struct { // region that supports [availability // zones](https://docs.microsoft.com/en-us/azure/availability-zones/az-overview). ManagedImageZoneResilient bool `mapstructure:"managed_image_zone_resilient" required:"false"` - // the user can define up to 15 - // tags. Tag names cannot exceed 512 characters, and tag values cannot exceed - // 256 characters. Tags are applied to every resource deployed by a Packer - // build, i.e. Resource Group, VM, NIC, VNET, Public IP, KeyVault, etc. + // Name/value pair tags to apply to every resource deployed i.e. Resource + // Group, VM, NIC, VNET, Public IP, KeyVault, etc. The user can define up + // to 15 tags. Tag names cannot exceed 512 characters, and tag values + // cannot exceed 256 characters. AzureTags map[string]*string `mapstructure:"azure_tags" required:"false"` // Same as [`azure_tags`](#azure_tags) but defined as a singular repeatable block // containing a `name` and a `value` field. In HCL2 mode the diff --git a/builder/hyperone/config.go b/builder/hyperone/config.go index 7a17086ce..01f090cda 100644 --- a/builder/hyperone/config.go +++ b/builder/hyperone/config.go @@ -64,21 +64,20 @@ type Config struct { // 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 repeatable - // block containing a `name` and a `value` field. In HCL2 mode the + // block containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. - ImageTag hcl2template.NameValues `mapstructure:"image_tag" required:"false"` + ImageTag hcl2template.KeyValues `mapstructure:"image_tag" required:"false"` // The service of the resulting image. ImageService string `mapstructure:"image_service" required:"false"` // ID or name of the type this server should be created with. VmType string `mapstructure:"vm_type" required:"true"` // The name of the created server. VmName string `mapstructure:"vm_name" required:"false"` - // Key/value pair tags to - // add to the created server. + // 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 repeatable block - // containing a `name` and a `value` field. In HCL2 mode the + // containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. VmTag hcl2template.NameValues `mapstructure:"vm_tag" required:"false"` diff --git a/builder/hyperone/config.hcl2spec.go b/builder/hyperone/config.hcl2spec.go index 2625464f6..4752cdf70 100644 --- a/builder/hyperone/config.hcl2spec.go +++ b/builder/hyperone/config.hcl2spec.go @@ -67,7 +67,7 @@ type FlatConfig struct { ImageName *string `mapstructure:"image_name" required:"false" cty:"image_name"` ImageDescription *string `mapstructure:"image_description" required:"false" cty:"image_description"` ImageTags map[string]string `mapstructure:"image_tags" required:"false" cty:"image_tags"` - ImageTag []hcl2template.FlatNameValue `mapstructure:"image_tag" required:"false" cty:"image_tag"` + ImageTag []hcl2template.FlatKeyValue `mapstructure:"image_tag" required:"false" cty:"image_tag"` ImageService *string `mapstructure:"image_service" required:"false" cty:"image_service"` VmType *string `mapstructure:"vm_type" required:"true" cty:"vm_type"` VmName *string `mapstructure:"vm_name" required:"false" cty:"vm_name"` @@ -164,7 +164,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "image_name": &hcldec.AttrSpec{Name: "image_name", Type: cty.String, Required: false}, "image_description": &hcldec.AttrSpec{Name: "image_description", Type: cty.String, Required: false}, "image_tags": &hcldec.AttrSpec{Name: "image_tags", Type: cty.Map(cty.String), Required: false}, - "image_tag": &hcldec.BlockListSpec{TypeName: "image_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "image_tag": &hcldec.BlockListSpec{TypeName: "image_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "image_service": &hcldec.AttrSpec{Name: "image_service", Type: cty.String, Required: false}, "vm_type": &hcldec.AttrSpec{Name: "vm_type", Type: cty.String, Required: false}, "vm_name": &hcldec.AttrSpec{Name: "vm_name", Type: cty.String, Required: false}, diff --git a/builder/osc/common/run_config.go b/builder/osc/common/run_config.go index 112bcd069..ff79d6bc6 100644 --- a/builder/osc/common/run_config.go +++ b/builder/osc/common/run_config.go @@ -18,32 +18,39 @@ import ( var reShutdownBehavior = regexp.MustCompile("^(stop|terminate)$") +// docs at +// https://wiki.outscale.net/display/EN/Getting+Information+About+Your+OMIs type OmiFilterOptions struct { - hcl2template.KVFilter `mapstructure:",squash"` - Owners []string - MostRecent bool `mapstructure:"most_recent"` + hcl2template.NameValueFilter `mapstructure:",squash"` + Owners []string + MostRecent bool `mapstructure:"most_recent"` } func (d *OmiFilterOptions) Empty() bool { - return len(d.Owners) == 0 && d.KVFilter.Empty() + return len(d.Owners) == 0 && d.NameValueFilter.Empty() } func (d *OmiFilterOptions) NoOwner() bool { return len(d.Owners) == 0 } +// docs at +// https://wiki.outscale.net/display/EN/Getting+Information+About+Your+Subnets type SubnetFilterOptions struct { - hcl2template.KVFilter `mapstructure:",squash"` - MostFree bool `mapstructure:"most_free"` - Random bool `mapstructure:"random"` + hcl2template.NameValueFilter `mapstructure:",squash"` + MostFree bool `mapstructure:"most_free"` + Random bool `mapstructure:"random"` } +// docs at https://docs.outscale.com/api#tocsfiltersnet type NetFilterOptions struct { - hcl2template.KVFilter `mapstructure:",squash"` + hcl2template.NameValueFilter `mapstructure:",squash"` } +// docs at +// https://wiki.outscale.net/display/EN/Getting+Information+About+Your+Security+Groups type SecurityGroupFilterOptions struct { - hcl2template.KVFilter `mapstructure:",squash"` + hcl2template.NameValueFilter `mapstructure:",squash"` } // RunConfig contains configuration for running an vm from a source diff --git a/builder/osc/common/run_config_test.go b/builder/osc/common/run_config_test.go index d1faa7f81..93df79849 100644 --- a/builder/osc/common/run_config_test.go +++ b/builder/osc/common/run_config_test.go @@ -74,7 +74,7 @@ func TestRunConfigPrepare_SourceOmiFilterOwnersBlank(t *testing.T) { filter_key := "name" filter_value := "foo" c.SourceOmiFilter = OmiFilterOptions{ - KVFilter: hcl2template.KVFilter{ + NameValueFilter: hcl2template.NameValueFilter{ Filters: map[string]string{filter_key: filter_value}, }, } @@ -90,7 +90,7 @@ func TestRunConfigPrepare_SourceOmiFilterGood(t *testing.T) { filter_value := "foo" goodFilter := OmiFilterOptions{ Owners: []string{owner}, - KVFilter: hcl2template.KVFilter{ + NameValueFilter: hcl2template.NameValueFilter{ Filters: map[string]string{filter_key: filter_value}, }, } diff --git a/builder/tencentcloud/cvm/builder.hcl2spec.go b/builder/tencentcloud/cvm/builder.hcl2spec.go index f9e8ac7fc..1cfb55e39 100644 --- a/builder/tencentcloud/cvm/builder.hcl2spec.go +++ b/builder/tencentcloud/cvm/builder.hcl2spec.go @@ -10,91 +10,91 @@ import ( // FlatConfig is an auto-generated flat version of Config. // Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. type FlatConfig struct { - PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name"` - PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type"` - PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug"` - PackerForce *bool `mapstructure:"packer_force" cty:"packer_force"` - PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error"` - PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables"` - PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables"` - SecretId *string `mapstructure:"secret_id" required:"true" cty:"secret_id"` - SecretKey *string `mapstructure:"secret_key" required:"true" cty:"secret_key"` - Region *string `mapstructure:"region" required:"true" cty:"region"` - Zone *string `mapstructure:"zone" required:"true" cty:"zone"` - SkipValidation *bool `mapstructure:"skip_region_validation" required:"false" cty:"skip_region_validation"` - ImageName *string `mapstructure:"image_name" required:"true" cty:"image_name"` - ImageDescription *string `mapstructure:"image_description" required:"false" cty:"image_description"` - Reboot *bool `mapstructure:"reboot" required:"false" cty:"reboot"` - ForcePoweroff *bool `mapstructure:"force_poweroff" required:"false" cty:"force_poweroff"` - Sysprep *bool `mapstructure:"sysprep" required:"false" cty:"sysprep"` - ImageForceDelete *bool `mapstructure:"image_force_delete" cty:"image_force_delete"` - ImageCopyRegions []string `mapstructure:"image_copy_regions" required:"false" cty:"image_copy_regions"` - ImageShareAccounts []string `mapstructure:"image_share_accounts" required:"false" cty:"image_share_accounts"` - AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" required:"false" cty:"associate_public_ip_address"` - SourceImageId *string `mapstructure:"source_image_id" required:"true" cty:"source_image_id"` - InstanceType *string `mapstructure:"instance_type" required:"true" cty:"instance_type"` - InstanceName *string `mapstructure:"instance_name" required:"false" cty:"instance_name"` - DiskType *string `mapstructure:"disk_type" required:"false" cty:"disk_type"` - DiskSize *int64 `mapstructure:"disk_size" required:"false" cty:"disk_size"` - DataDisks []FlattencentCloudDataDisk `mapstructure:"data_disks" cty:"data_disks"` - VpcId *string `mapstructure:"vpc_id" required:"false" cty:"vpc_id"` - VpcName *string `mapstructure:"vpc_name" required:"false" cty:"vpc_name"` - VpcIp *string `mapstructure:"vpc_ip" cty:"vpc_ip"` - SubnetId *string `mapstructure:"subnet_id" required:"false" cty:"subnet_id"` - SubnetName *string `mapstructure:"subnet_name" required:"false" cty:"subnet_name"` - CidrBlock *string `mapstructure:"cidr_block" required:"false" cty:"cidr_block"` - SubnectCidrBlock *string `mapstructure:"subnect_cidr_block" required:"false" cty:"subnect_cidr_block"` - InternetChargeType *string `mapstructure:"internet_charge_type" cty:"internet_charge_type"` - InternetMaxBandwidthOut *int64 `mapstructure:"internet_max_bandwidth_out" required:"false" cty:"internet_max_bandwidth_out"` - SecurityGroupId *string `mapstructure:"security_group_id" required:"false" cty:"security_group_id"` - SecurityGroupName *string `mapstructure:"security_group_name" required:"false" cty:"security_group_name"` - UserData *string `mapstructure:"user_data" required:"false" cty:"user_data"` - UserDataFile *string `mapstructure:"user_data_file" required:"false" cty:"user_data_file"` - HostName *string `mapstructure:"host_name" required:"false" cty:"host_name"` - RunTags map[string]string `mapstructure:"run_tags" required:"false" cty:"run_tags"` - RunTag []hcl2template.FlatNameValue `mapstructure:"run_tag" required:"false" cty:"run_tag"` - Type *string `mapstructure:"communicator" cty:"communicator"` - PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting"` - SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host"` - SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port"` - SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username"` - SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password"` - SSHKeyPairName *string `mapstructure:"ssh_keypair_name" cty:"ssh_keypair_name"` - SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" cty:"temporary_key_pair_name"` - SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys"` - SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" cty:"ssh_private_key_file"` - SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty"` - SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout"` - SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" cty:"ssh_agent_auth"` - SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding"` - SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts"` - SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host"` - SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port"` - SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth"` - SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username"` - SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password"` - SSHBastionInteractive *bool `mapstructure:"ssh_bastion_interactive" cty:"ssh_bastion_interactive"` - SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file"` - SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method"` - SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host"` - SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port"` - SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username"` - SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password"` - SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval"` - SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout"` - SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels"` - SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels"` - SSHPublicKey []byte `mapstructure:"ssh_public_key" cty:"ssh_public_key"` - SSHPrivateKey []byte `mapstructure:"ssh_private_key" cty:"ssh_private_key"` - WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username"` - WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password"` - WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host"` - WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port"` - WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout"` - WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl"` - WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure"` - WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm"` - SSHPrivateIp *bool `mapstructure:"ssh_private_ip" cty:"ssh_private_ip"` + PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name"` + PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type"` + PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug"` + PackerForce *bool `mapstructure:"packer_force" cty:"packer_force"` + PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error"` + PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables"` + PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables"` + SecretId *string `mapstructure:"secret_id" required:"true" cty:"secret_id"` + SecretKey *string `mapstructure:"secret_key" required:"true" cty:"secret_key"` + Region *string `mapstructure:"region" required:"true" cty:"region"` + Zone *string `mapstructure:"zone" required:"true" cty:"zone"` + SkipValidation *bool `mapstructure:"skip_region_validation" required:"false" cty:"skip_region_validation"` + ImageName *string `mapstructure:"image_name" required:"true" cty:"image_name"` + ImageDescription *string `mapstructure:"image_description" required:"false" cty:"image_description"` + Reboot *bool `mapstructure:"reboot" required:"false" cty:"reboot"` + ForcePoweroff *bool `mapstructure:"force_poweroff" required:"false" cty:"force_poweroff"` + Sysprep *bool `mapstructure:"sysprep" required:"false" cty:"sysprep"` + ImageForceDelete *bool `mapstructure:"image_force_delete" cty:"image_force_delete"` + ImageCopyRegions []string `mapstructure:"image_copy_regions" required:"false" cty:"image_copy_regions"` + ImageShareAccounts []string `mapstructure:"image_share_accounts" required:"false" cty:"image_share_accounts"` + AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" required:"false" cty:"associate_public_ip_address"` + SourceImageId *string `mapstructure:"source_image_id" required:"true" cty:"source_image_id"` + InstanceType *string `mapstructure:"instance_type" required:"true" cty:"instance_type"` + InstanceName *string `mapstructure:"instance_name" required:"false" cty:"instance_name"` + DiskType *string `mapstructure:"disk_type" required:"false" cty:"disk_type"` + DiskSize *int64 `mapstructure:"disk_size" required:"false" cty:"disk_size"` + DataDisks []FlattencentCloudDataDisk `mapstructure:"data_disks" cty:"data_disks"` + VpcId *string `mapstructure:"vpc_id" required:"false" cty:"vpc_id"` + VpcName *string `mapstructure:"vpc_name" required:"false" cty:"vpc_name"` + VpcIp *string `mapstructure:"vpc_ip" cty:"vpc_ip"` + SubnetId *string `mapstructure:"subnet_id" required:"false" cty:"subnet_id"` + SubnetName *string `mapstructure:"subnet_name" required:"false" cty:"subnet_name"` + CidrBlock *string `mapstructure:"cidr_block" required:"false" cty:"cidr_block"` + SubnectCidrBlock *string `mapstructure:"subnect_cidr_block" required:"false" cty:"subnect_cidr_block"` + InternetChargeType *string `mapstructure:"internet_charge_type" cty:"internet_charge_type"` + InternetMaxBandwidthOut *int64 `mapstructure:"internet_max_bandwidth_out" required:"false" cty:"internet_max_bandwidth_out"` + SecurityGroupId *string `mapstructure:"security_group_id" required:"false" cty:"security_group_id"` + SecurityGroupName *string `mapstructure:"security_group_name" required:"false" cty:"security_group_name"` + UserData *string `mapstructure:"user_data" required:"false" cty:"user_data"` + UserDataFile *string `mapstructure:"user_data_file" required:"false" cty:"user_data_file"` + HostName *string `mapstructure:"host_name" required:"false" cty:"host_name"` + RunTags map[string]string `mapstructure:"run_tags" required:"false" cty:"run_tags"` + RunTag []hcl2template.FlatKeyValue `mapstructure:"run_tag" required:"false" cty:"run_tag"` + Type *string `mapstructure:"communicator" cty:"communicator"` + PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting"` + SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host"` + SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port"` + SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username"` + SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password"` + SSHKeyPairName *string `mapstructure:"ssh_keypair_name" cty:"ssh_keypair_name"` + SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" cty:"temporary_key_pair_name"` + SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys"` + SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" cty:"ssh_private_key_file"` + SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty"` + SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout"` + SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" cty:"ssh_agent_auth"` + SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding"` + SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts"` + SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host"` + SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port"` + SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth"` + SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username"` + SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password"` + SSHBastionInteractive *bool `mapstructure:"ssh_bastion_interactive" cty:"ssh_bastion_interactive"` + SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file"` + SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method"` + SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host"` + SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port"` + SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username"` + SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password"` + SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval"` + SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout"` + SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels"` + SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels"` + SSHPublicKey []byte `mapstructure:"ssh_public_key" cty:"ssh_public_key"` + SSHPrivateKey []byte `mapstructure:"ssh_private_key" cty:"ssh_private_key"` + WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username"` + WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password"` + WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host"` + WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port"` + WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout"` + WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl"` + WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure"` + WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm"` + SSHPrivateIp *bool `mapstructure:"ssh_private_ip" cty:"ssh_private_ip"` } // FlatMapstructure returns a new FlatConfig. @@ -151,7 +151,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "user_data_file": &hcldec.AttrSpec{Name: "user_data_file", Type: cty.String, Required: false}, "host_name": &hcldec.AttrSpec{Name: "host_name", Type: cty.String, Required: false}, "run_tags": &hcldec.AttrSpec{Name: "run_tags", Type: cty.Map(cty.String), Required: false}, - "run_tag": &hcldec.BlockListSpec{TypeName: "run_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "run_tag": &hcldec.BlockListSpec{TypeName: "run_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "communicator": &hcldec.AttrSpec{Name: "communicator", Type: cty.String, Required: false}, "pause_before_connecting": &hcldec.AttrSpec{Name: "pause_before_connecting", Type: cty.String, Required: false}, "ssh_host": &hcldec.AttrSpec{Name: "ssh_host", Type: cty.String, Required: false}, diff --git a/builder/tencentcloud/cvm/run_config.go b/builder/tencentcloud/cvm/run_config.go index b68a7a775..c92760650 100644 --- a/builder/tencentcloud/cvm/run_config.go +++ b/builder/tencentcloud/cvm/run_config.go @@ -81,14 +81,14 @@ type TencentCloudRunConfig struct { UserDataFile string `mapstructure:"user_data_file" required:"false"` // host name. HostName string `mapstructure:"host_name" required:"false"` - // Tags to apply to the instance that is *launched* to create the image. - // These tags are *not* applied to the resulting image. + // Key/value pair 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 repeatable - // block containing a `name` and a `value` field. In HCL2 mode the + // block containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. - RunTag hcl2template.NameValues `mapstructure:"run_tag" required:"false"` + RunTag hcl2template.KeyValues `mapstructure:"run_tag" required:"false"` // Communicator settings Comm communicator.Config `mapstructure:",squash"` diff --git a/builder/triton/config.hcl2spec.go b/builder/triton/config.hcl2spec.go index ec90781ee..f2dcfb726 100644 --- a/builder/triton/config.hcl2spec.go +++ b/builder/triton/config.hcl2spec.go @@ -29,7 +29,7 @@ type FlatConfig struct { MachineNetworks []string `mapstructure:"source_machine_networks" required:"false" cty:"source_machine_networks"` MachineMetadata map[string]string `mapstructure:"source_machine_metadata" required:"false" cty:"source_machine_metadata"` MachineTags map[string]string `mapstructure:"source_machine_tags" required:"false" cty:"source_machine_tags"` - MachineTag []hcl2template.FlatNameValue `mapstructure:"source_machine_tag" required:"false" cty:"source_machine_tag"` + MachineTag []hcl2template.FlatKeyValue `mapstructure:"source_machine_tag" required:"false" cty:"source_machine_tag"` MachineFirewallEnabled *bool `mapstructure:"source_machine_firewall_enabled" required:"false" cty:"source_machine_firewall_enabled"` MachineImageFilters *FlatMachineImageFilter `mapstructure:"source_machine_image_filter" required:"false" cty:"source_machine_image_filter"` ImageName *string `mapstructure:"image_name" required:"true" cty:"image_name"` @@ -114,7 +114,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "source_machine_networks": &hcldec.AttrSpec{Name: "source_machine_networks", Type: cty.List(cty.String), Required: false}, "source_machine_metadata": &hcldec.AttrSpec{Name: "source_machine_metadata", Type: cty.Map(cty.String), Required: false}, "source_machine_tags": &hcldec.AttrSpec{Name: "source_machine_tags", Type: cty.Map(cty.String), Required: false}, - "source_machine_tag": &hcldec.BlockListSpec{TypeName: "source_machine_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "source_machine_tag": &hcldec.BlockListSpec{TypeName: "source_machine_tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "source_machine_firewall_enabled": &hcldec.AttrSpec{Name: "source_machine_firewall_enabled", Type: cty.Bool, Required: false}, "source_machine_image_filter": &hcldec.BlockSpec{TypeName: "source_machine_image_filter", Nested: hcldec.ObjectSpec((*FlatMachineImageFilter)(nil).HCL2Spec())}, "image_name": &hcldec.AttrSpec{Name: "image_name", Type: cty.String, Required: false}, diff --git a/builder/triton/source_machine_config.go b/builder/triton/source_machine_config.go index 9b8b61006..8733a06b0 100644 --- a/builder/triton/source_machine_config.go +++ b/builder/triton/source_machine_config.go @@ -53,13 +53,13 @@ type SourceMachineConfig struct { // set the user-script metadata key to have Triton start a user supplied // script after the VM has booted. MachineMetadata map[string]string `mapstructure:"source_machine_metadata" required:"false"` - // Tags applied to the VM used to create the image. + // Key/value pair tags applied to the VM used to create the image. 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 `name` and a `value` field. In HCL2 mode the + // singular block containing a `key` and a `value` field. In HCL2 mode the // [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) // will allow you to create those programatically. - MachineTag hcl2template.NameValues `mapstructure:"source_machine_tag" required:"false"` + MachineTag hcl2template.KeyValues `mapstructure:"source_machine_tag" required:"false"` // Whether or not the firewall // 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. diff --git a/builder/triton/target_image_config.go b/builder/triton/target_image_config.go index 18e6f399c..a9ce24695 100644 --- a/builder/triton/target_image_config.go +++ b/builder/triton/target_image_config.go @@ -35,7 +35,7 @@ type TargetImageConfig struct { // access to this image. When omitted only the owner (the Triton user whose // credentials are used) will have access to the image. ImageACL []string `mapstructure:"image_acls" required:"false"` - // Tag applied to the image. + // Name/Value tags applied to the image. ImageTags map[string]string `mapstructure:"image_tags" required:"false"` // Same as [`image_tags`](#image_tags) but defined as a singular repeatable // block containing a `name` and a `value` field. In HCL2 mode the diff --git a/hcl2template/types.kv.go b/hcl2template/types.kv.go index cd1e63007..a743b5778 100644 --- a/hcl2template/types.kv.go +++ b/hcl2template/types.kv.go @@ -1,7 +1,41 @@ -//go:generate mapstructure-to-hcl2 -type NameValue,NameValues,KVFilter +//go:generate mapstructure-to-hcl2 -type KeyValue,KeyValues,KeyValueFilter,NameValue,NameValues,NameValueFilter package hcl2template +type KeyValue struct { + Key string + Value string +} + +type KeyValues []KeyValue + +func (kvs KeyValues) CopyOn(to *map[string]string) []error { + if len(kvs) == 0 { + return nil + } + if *to == nil { + *to = map[string]string{} + } + for _, kv := range kvs { + (*to)[kv.Key] = kv.Value + } + return nil +} + +type KeyValueFilter struct { + Filters map[string]string + Filter KeyValues +} + +func (kvf *KeyValueFilter) Prepare() []error { + kvf.Filter.CopyOn(&kvf.Filters) + return nil +} + +func (kvf *KeyValueFilter) Empty() bool { + return len(kvf.Filters) == 0 +} + type NameValue struct { Name string Value string @@ -9,29 +43,29 @@ type NameValue struct { type NameValues []NameValue -func (kvs NameValues) CopyOn(to *map[string]string) []error { - if len(kvs) == 0 { +func (nvs NameValues) CopyOn(to *map[string]string) []error { + if len(nvs) == 0 { return nil } if *to == nil { *to = map[string]string{} } - for _, kv := range kvs { + for _, kv := range nvs { (*to)[kv.Name] = kv.Value } return nil } -type KVFilter struct { +type NameValueFilter struct { Filters map[string]string Filter NameValues } -func (kvf *KVFilter) Prepare() []error { - kvf.Filter.CopyOn(&kvf.Filters) +func (nvf *NameValueFilter) Prepare() []error { + nvf.Filter.CopyOn(&nvf.Filters) return nil } -func (kvf *KVFilter) Empty() bool { - return len(kvf.Filters) == 0 +func (nvf *NameValueFilter) Empty() bool { + return len(nvf.Filters) == 0 } diff --git a/hcl2template/types.kv.hcl2spec.go b/hcl2template/types.kv.hcl2spec.go index 884747edf..b209b3b5b 100644 --- a/hcl2template/types.kv.hcl2spec.go +++ b/hcl2template/types.kv.hcl2spec.go @@ -1,4 +1,4 @@ -// Code generated by "mapstructure-to-hcl2 -type NameValue,NameValues,KVFilter"; DO NOT EDIT. +// Code generated by "mapstructure-to-hcl2 -type KeyValue,KeyValues,KeyValueFilter,NameValue,NameValues,NameValueFilter"; DO NOT EDIT. package hcl2template import ( @@ -6,27 +6,52 @@ import ( "github.com/zclconf/go-cty/cty" ) -// FlatKVFilter is an auto-generated flat version of KVFilter. +// FlatKeyValue is an auto-generated flat version of KeyValue. // Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. -type FlatKVFilter struct { - Filters map[string]string `cty:"filters"` - Filter []FlatNameValue `cty:"filter"` +type FlatKeyValue struct { + Key *string `cty:"key"` + Value *string `cty:"value"` } -// FlatMapstructure returns a new FlatKVFilter. -// FlatKVFilter is an auto-generated flat version of KVFilter. +// FlatMapstructure returns a new FlatKeyValue. +// FlatKeyValue is an auto-generated flat version of KeyValue. // Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. -func (*KVFilter) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { - return new(FlatKVFilter) +func (*KeyValue) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatKeyValue) } -// HCL2Spec returns the hcl spec of a KVFilter. -// This spec is used by HCL to read the fields of KVFilter. -// The decoded values from this spec will then be applied to a FlatKVFilter. -func (*FlatKVFilter) HCL2Spec() map[string]hcldec.Spec { +// HCL2Spec returns the hcl spec of a KeyValue. +// This spec is used by HCL to read the fields of KeyValue. +// The decoded values from this spec will then be applied to a FlatKeyValue. +func (*FlatKeyValue) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "key": &hcldec.AttrSpec{Name: "key", Type: cty.String, Required: false}, + "value": &hcldec.AttrSpec{Name: "value", Type: cty.String, Required: false}, + } + return s +} + +// FlatKeyValueFilter is an auto-generated flat version of KeyValueFilter. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatKeyValueFilter struct { + Filters map[string]string `cty:"filters"` + Filter []FlatKeyValue `cty:"filter"` +} + +// FlatMapstructure returns a new FlatKeyValueFilter. +// FlatKeyValueFilter is an auto-generated flat version of KeyValueFilter. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*KeyValueFilter) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatKeyValueFilter) +} + +// HCL2Spec returns the hcl spec of a KeyValueFilter. +// This spec is used by HCL to read the fields of KeyValueFilter. +// The decoded values from this spec will then be applied to a FlatKeyValueFilter. +func (*FlatKeyValueFilter) HCL2Spec() map[string]hcldec.Spec { s := map[string]hcldec.Spec{ "filters": &hcldec.AttrSpec{Name: "filters", Type: cty.Map(cty.String), Required: false}, - "filter": &hcldec.BlockListSpec{TypeName: "filter", Nested: hcldec.ObjectSpec((*FlatNameValue)(nil).HCL2Spec())}, + "filter": &hcldec.BlockListSpec{TypeName: "filter", Nested: hcldec.ObjectSpec((*FlatKeyValue)(nil).HCL2Spec())}, } return s } @@ -55,3 +80,28 @@ func (*FlatNameValue) HCL2Spec() map[string]hcldec.Spec { } return s } + +// FlatNameValueFilter is an auto-generated flat version of NameValueFilter. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatNameValueFilter struct { + Filters map[string]string `cty:"filters"` + Filter []FlatNameValue `cty:"filter"` +} + +// FlatMapstructure returns a new FlatNameValueFilter. +// FlatNameValueFilter is an auto-generated flat version of NameValueFilter. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*NameValueFilter) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatNameValueFilter) +} + +// HCL2Spec returns the hcl spec of a NameValueFilter. +// This spec is used by HCL to read the fields of NameValueFilter. +// The decoded values from this spec will then be applied to a FlatNameValueFilter. +func (*FlatNameValueFilter) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "filters": &hcldec.AttrSpec{Name: "filters", Type: cty.Map(cty.String), Required: false}, + "filter": &hcldec.BlockListSpec{TypeName: "filter", Nested: hcldec.ObjectSpec((*FlatNameValue)(nil).HCL2Spec())}, + } + return s +} diff --git a/post-processor/alicloud-import/post-processor.hcl2spec.go b/post-processor/alicloud-import/post-processor.hcl2spec.go index 6a4eb75a7..5a2c23185 100644 --- a/post-processor/alicloud-import/post-processor.hcl2spec.go +++ b/post-processor/alicloud-import/post-processor.hcl2spec.go @@ -39,7 +39,7 @@ type FlatConfig struct { AlicloudImageForceDeleteInstances *bool `mapstructure:"image_force_delete_instances" cty:"image_force_delete_instances"` AlicloudImageIgnoreDataDisks *bool `mapstructure:"image_ignore_data_disks" required:"false" cty:"image_ignore_data_disks"` AlicloudImageTags map[string]string `mapstructure:"tags" required:"false" cty:"tags"` - AlicloudImageTag []hcl2template.FlatNameValue `mapstructure:"tag" required:"false" cty:"tag"` + AlicloudImageTag []hcl2template.FlatKeyValue `mapstructure:"tag" required:"false" cty:"tag"` ECSSystemDiskMapping *ecs.FlatAlicloudDiskDevice `mapstructure:"system_disk_mapping" required:"false" cty:"system_disk_mapping"` ECSImagesDiskMappings []ecs.FlatAlicloudDiskDevice `mapstructure:"image_disk_mappings" required:"false" cty:"image_disk_mappings"` AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" cty:"associate_public_ip_address"` @@ -155,7 +155,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "image_force_delete_instances": &hcldec.AttrSpec{Name: "image_force_delete_instances", Type: cty.Bool, Required: false}, "image_ignore_data_disks": &hcldec.AttrSpec{Name: "image_ignore_data_disks", Type: cty.Bool, Required: false}, "tags": &hcldec.AttrSpec{Name: "tags", Type: cty.Map(cty.String), Required: false}, - "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatNameValue)(nil).HCL2Spec())}, + "tag": &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*hcl2template.FlatKeyValue)(nil).HCL2Spec())}, "system_disk_mapping": &hcldec.BlockSpec{TypeName: "system_disk_mapping", Nested: hcldec.ObjectSpec((*ecs.FlatAlicloudDiskDevice)(nil).HCL2Spec())}, "image_disk_mappings": &hcldec.BlockListSpec{TypeName: "image_disk_mappings", Nested: hcldec.ObjectSpec((*ecs.FlatAlicloudDiskDevice)(nil).HCL2Spec())}, "associate_public_ip_address": &hcldec.AttrSpec{Name: "associate_public_ip_address", Type: cty.Bool, Required: false}, diff --git a/website/pages/docs/from-1.5/expressions.mdx b/website/pages/docs/from-1.5/expressions.mdx index c670f1e69..7b5a753f2 100644 --- a/website/pages/docs/from-1.5/expressions.mdx +++ b/website/pages/docs/from-1.5/expressions.mdx @@ -257,9 +257,9 @@ set. ## `dynamic` blocks Within top-level block constructs like sources, expressions can usually be used -only when assigning a value to an argument using the `name = expression` form. -This covers many uses, but some source types include repeatable _nested -blocks_ in their arguments, which do not accept expressions: +only when assigning a value to an argument using the `name = expression`, `key += expression` form. This covers many uses, but some source types include +repeatable _nested blocks_ in their arguments, which do not accept expressions: ```hcl source "amazon-ebs" "example" { diff --git a/website/pages/partials/builder/alicloud/ecs/AlicloudImageConfig-not-required.mdx b/website/pages/partials/builder/alicloud/ecs/AlicloudImageConfig-not-required.mdx index 4e20d3a0a..9e37ca0a4 100644 --- a/website/pages/partials/builder/alicloud/ecs/AlicloudImageConfig-not-required.mdx +++ b/website/pages/partials/builder/alicloud/ecs/AlicloudImageConfig-not-required.mdx @@ -49,10 +49,11 @@ - `skip_region_validation` (bool) - The region validation can be skipped if this value is true, the default value is false. -- `tags` (map[string]string) - Tags applied to the destination image and relevant snapshots. +- `tags` (map[string]string) - Key/value pair tags applied to the destination image and relevant + snapshots. -- `tag` ([]{name string, value string}) - Same as [`tags`](#tags) but defined as a singular repeatable block - containing a `name` and a `value` field. In HCL2 mode the +- `tag` (hcl2template.KeyValues) - Same as [`tags`](#tags) but defined as a singular repeatable block + containing a `key` and a `value` field. In HCL2 mode the [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. \ No newline at end of file diff --git a/website/pages/partials/builder/amazon/chroot/Config-not-required.mdx b/website/pages/partials/builder/amazon/chroot/Config-not-required.mdx index 1fa5aa4f1..8700c918a 100644 --- a/website/pages/partials/builder/amazon/chroot/Config-not-required.mdx +++ b/website/pages/partials/builder/amazon/chroot/Config-not-required.mdx @@ -121,12 +121,12 @@ criteria provided in `source_ami_filter`; this pins the AMI returned by the filter, but will cause Packer to fail if the `source_ami` does not exist. -- `root_volume_tags` (map[string]string) - Tags to apply to the volumes that are *launched*. This is a [template - engine](/docs/templates/engine), see [Build template +- `root_volume_tags` (map[string]string) - Key/value pair tags to apply to the volumes that are *launched*. This is + a [template engine](/docs/templates/engine), see [Build template data](#build-template-data) for more information. -- `root_volume_tag` ([]{name string, value string}) - Same as [`root_volume_tags`](#root_volume_tags) but defined as a - singular block containing a `name` and a `value` field. In HCL2 mode the +- `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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/amazon/common/AMIConfig-not-required.mdx b/website/pages/partials/builder/amazon/common/AMIConfig-not-required.mdx index 7bd137500..093a01830 100644 --- a/website/pages/partials/builder/amazon/common/AMIConfig-not-required.mdx +++ b/website/pages/partials/builder/amazon/common/AMIConfig-not-required.mdx @@ -28,12 +28,12 @@ - `skip_region_validation` (bool) - Set to true if you want to skip validation of the ami_regions configuration option. Default false. -- `tags` (map[string]string) - Tags applied to the AMI. This is a - [template engine](/docs/templates/engine), see [Build template +- `tags` (map[string]string) - Key/value pair tags applied to the AMI. This is a [template + engine](/docs/templates/engine), see [Build template data](#build-template-data) for more information. -- `tag` ([]{name string, value string}) - Same as [`tags`](#tags) but defined as a singular repeatable block - containing a `name` and a `value` field. In HCL2 mode the +- `tag` (hcl2template.KeyValues) - Same as [`tags`](#tags) but defined as a singular repeatable block + containing a `key` and a `value` field. In HCL2 mode the [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. @@ -98,13 +98,13 @@ the intermediary AMI into any regions provided in `ami_regions`, then delete the intermediary AMI. Default `false`. -- `snapshot_tags` (map[string]string) - Tags to apply to snapshot. - They will override AMI tags if already applied to snapshot. This is a - [template engine](/docs/templates/engine), see [Build template +- `snapshot_tags` (map[string]string) - Key/value pair tags to apply to snapshot. They will override AMI tags if + already applied to snapshot. This is a [template + engine](/docs/templates/engine), see [Build template data](#build-template-data) for more information. -- `snapshot_tag` ([]{name string, value string}) - Same as [`snapshot_tags`](#snapshot_tags) but defined as a singular - repeatable block containing a `name` and a `value` field. In HCL2 mode the +- `snapshot_tag` (hcl2template.KeyValues) - Same as [`snapshot_tags`](#snapshot_tags) but defined as a singular + repeatable block containing a `key` and a `value` field. In HCL2 mode the [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. 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 91d8bb4ae..1e0713b95 100644 --- a/website/pages/partials/builder/amazon/common/RunConfig-not-required.mdx +++ b/website/pages/partials/builder/amazon/common/RunConfig-not-required.mdx @@ -109,12 +109,13 @@ `security_group_ids` take precedence over this. -- `run_tags` (map[string]string) - Tags to apply to the instance that is that is *launched* to create the - EBS volumes. This is a [template engine](/docs/templates/engine), - see [Build template data](#build-template-data) for more information. +- `run_tags` (map[string]string) - Key/value pair tags to apply to the instance that is that is *launched* + to create the EBS volumes. This is a [template + engine](/docs/templates/engine), see [Build template + data](#build-template-data) for more information. -- `run_tag` ([]{name string, value string}) - Same as [`run_tags`](#run_tags) but defined as a singular repeatable - block containing a `name` and a `value` field. In HCL2 mode the +- `run_tag` (hcl2template.KeyValues) - 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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. @@ -202,11 +203,11 @@ Windows, Linux/UNIX (Amazon VPC), SUSE Linux (Amazon VPC), Windows (Amazon VPC) -- `spot_tags` (map[string]string) - Requires spot_price to be set. This tells Packer to apply tags to the +- `spot_tags` (map[string]string) - Requires spot_price to be set. Key/value pair tags to apply tags to the spot request that is issued. -- `spot_tag` ([]{name string, value string}) - Same as [`spot_tags`](#spot_tags) but defined as a singular repeatable block - containing a `name` and a `value` field. In HCL2 mode the +- `spot_tag` (hcl2template.KeyValues) - 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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/amazon/ebsvolume/BlockDevice-not-required.mdx b/website/pages/partials/builder/amazon/ebsvolume/BlockDevice-not-required.mdx index 0f4bfd5bd..7778a4e10 100644 --- a/website/pages/partials/builder/amazon/ebsvolume/BlockDevice-not-required.mdx +++ b/website/pages/partials/builder/amazon/ebsvolume/BlockDevice-not-required.mdx @@ -1,11 +1,11 @@ -- `tags` (map[string]string) - Tags to apply to the volume. These are retained after the builder +- `tags` (map[string]string) - Key/value pair tags to apply to the volume. These are retained after the builder completes. This is a [template engine](/docs/templates/engine), see [Build template data](#build-template-data) for more information. -- `tag` ([]{name string, value string}) - Same as [`tags`](#tags) but defined as a singular repeatable block - containing a `name` and a `value` field. In HCL2 mode the +- `tag` (hcl2template.KeyValues) - Same as [`tags`](#tags) but defined as a singular repeatable block + containing a `key` and a `value` field. In HCL2 mode the [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. \ No newline at end of file diff --git a/website/pages/partials/builder/amazon/ebsvolume/Config-not-required.mdx b/website/pages/partials/builder/amazon/ebsvolume/Config-not-required.mdx index b0a717845..9ef2c8354 100644 --- a/website/pages/partials/builder/amazon/ebsvolume/Config-not-required.mdx +++ b/website/pages/partials/builder/amazon/ebsvolume/Config-not-required.mdx @@ -23,10 +23,10 @@ source instance. See the [BlockDevices](#block-devices-configuration) documentation for fields. -- `run_volume_tags` (map[string]string) - Tags to apply to the volumes of the instance that is *launched* to - create EBS Volumes. These tags will *not* appear in the tags of the - resulting EBS volumes unless they're duplicated under `tags` in the - `ebs_volumes` setting. This is a [template +- `run_volume_tags` (map[string]string) - Key/value pair tags to apply to the volumes of the instance that is + *launched* to create EBS Volumes. These tags will *not* appear in the + tags of the resulting EBS volumes unless they're duplicated under `tags` + in the `ebs_volumes` setting. This is a [template engine](/docs/templates/engine), see [Build template data](#build-template-data) for more information. @@ -36,8 +36,8 @@ configured in the `ebs_volumes` section as soon as the instance is reported as 'ready'. -- `run_volume_tag` ([]{name string, value string}) - Same as [`run_volume_tags`](#run_volume_tags) but defined as a singular - repeatable block containing a `name` and a `value` field. In HCL2 mode +- `run_volume_tag` (hcl2template.KeyValues) - Same as [`run_volume_tags`](#run_volume_tags) but defined as a singular + repeatable block containing a `key` and a `value` field. In HCL2 mode the [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/azure/arm/Config-not-required.mdx b/website/pages/partials/builder/azure/arm/Config-not-required.mdx index e57e51119..b8d4994ab 100644 --- a/website/pages/partials/builder/azure/arm/Config-not-required.mdx +++ b/website/pages/partials/builder/azure/arm/Config-not-required.mdx @@ -95,10 +95,10 @@ region that supports [availability zones](https://docs.microsoft.com/en-us/azure/availability-zones/az-overview). -- `azure_tags` (map[string]\*string) - the user can define up to 15 - tags. Tag names cannot exceed 512 characters, and tag values cannot exceed - 256 characters. Tags are applied to every resource deployed by a Packer - build, i.e. Resource Group, VM, NIC, VNET, Public IP, KeyVault, etc. +- `azure_tags` (map[string]\*string) - Name/value pair tags to apply to every resource deployed i.e. Resource + Group, VM, NIC, VNET, Public IP, KeyVault, etc. The user can define up + to 15 tags. Tag names cannot exceed 512 characters, and tag values + cannot exceed 256 characters. - `azure_tag` ([]{name string, value string}) - Same as [`azure_tags`](#azure_tags) but defined as a singular repeatable block containing a `name` and a `value` field. In HCL2 mode the diff --git a/website/pages/partials/builder/hyperone/Config-not-required.mdx b/website/pages/partials/builder/hyperone/Config-not-required.mdx index 68f3208ee..5db1f52f8 100644 --- a/website/pages/partials/builder/hyperone/Config-not-required.mdx +++ b/website/pages/partials/builder/hyperone/Config-not-required.mdx @@ -17,8 +17,8 @@ - `image_tags` (map[string]string) - Key/value pair tags to add to the created image. -- `image_tag` ([]{name string, value string}) - Same as [`image_tags`](#image_tags) but defined as a singular repeatable - block containing a `name` and a `value` field. In HCL2 mode the +- `image_tag` (hcl2template.KeyValues) - 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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. @@ -26,11 +26,10 @@ - `vm_name` (string) - The name of the created server. -- `vm_tags` (map[string]string) - Key/value pair tags to - add to the created server. +- `vm_tags` (map[string]string) - Key/value pair tags to add to the created server. - `vm_tag` ([]{name string, value string}) - Same as [`vm_tags`](#vm_tags) but defined as a singular repeatable block - containing a `name` and a `value` field. In HCL2 mode the + containing a `key` and a `value` field. In HCL2 mode the [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx b/website/pages/partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx index 378e9336c..c4cb48b21 100644 --- a/website/pages/partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx +++ b/website/pages/partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx @@ -52,11 +52,11 @@ - `host_name` (string) - host name. -- `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. +- `run_tags` (map[string]string) - Key/value pair tags to apply to the instance that is *launched* to + create the image. These tags are *not* applied to the resulting image. -- `run_tag` ([]{name string, value string}) - Same as [`run_tags`](#run_tags) but defined as a singular repeatable - block containing a `name` and a `value` field. In HCL2 mode the +- `run_tag` (hcl2template.KeyValues) - 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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/triton/SourceMachineConfig-not-required.mdx b/website/pages/partials/builder/triton/SourceMachineConfig-not-required.mdx index 7eaf7a322..385f09e3a 100644 --- a/website/pages/partials/builder/triton/SourceMachineConfig-not-required.mdx +++ b/website/pages/partials/builder/triton/SourceMachineConfig-not-required.mdx @@ -23,10 +23,10 @@ set the user-script metadata key to have Triton start a user supplied script after the VM has booted. -- `source_machine_tags` (map[string]string) - Tags applied to the VM used to create the image. +- `source_machine_tags` (map[string]string) - Key/value pair tags applied to the VM used to create the image. -- `source_machine_tag` ([]{name string, value string}) - Same as [`source_machine_tags`](#source_machine_tags) but defined as a - singular block containing a `name` and a `value` field. In HCL2 mode the +- `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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/triton/TargetImageConfig-not-required.mdx b/website/pages/partials/builder/triton/TargetImageConfig-not-required.mdx index 27fd7cddd..94f92c44e 100644 --- a/website/pages/partials/builder/triton/TargetImageConfig-not-required.mdx +++ b/website/pages/partials/builder/triton/TargetImageConfig-not-required.mdx @@ -13,7 +13,7 @@ access to this image. When omitted only the owner (the Triton user whose credentials are used) will have access to the image. -- `image_tags` (map[string]string) - Tag applied to the image. +- `image_tags` (map[string]string) - Name/Value tags applied to the image. - `image_tag` ([]{name string, value string}) - Same as [`image_tags`](#image_tags) but defined as a singular repeatable block containing a `name` and a `value` field. In HCL2 mode the From c5c3585df1dae7b41669ae8e088ef79345ec035d Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Tue, 21 Apr 2020 12:22:37 +0200 Subject: [PATCH 2/3] make docs a bit more readable for KeyValues too --- cmd/struct-markdown/main.go | 2 ++ .../builder/alicloud/ecs/AlicloudImageConfig-not-required.mdx | 2 +- .../partials/builder/amazon/chroot/Config-not-required.mdx | 2 +- .../partials/builder/amazon/common/AMIConfig-not-required.mdx | 4 ++-- .../partials/builder/amazon/common/RunConfig-not-required.mdx | 4 ++-- .../builder/amazon/ebsvolume/BlockDevice-not-required.mdx | 2 +- .../partials/builder/amazon/ebsvolume/Config-not-required.mdx | 2 +- .../pages/partials/builder/hyperone/Config-not-required.mdx | 2 +- .../tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx | 2 +- .../builder/triton/SourceMachineConfig-not-required.mdx | 2 +- 10 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmd/struct-markdown/main.go b/cmd/struct-markdown/main.go index a9d26870f..c0b547f1c 100644 --- a/cmd/struct-markdown/main.go +++ b/cmd/struct-markdown/main.go @@ -119,6 +119,8 @@ func main() { fieldType = `boolean` case "hcl2template.NameValues": fieldType = `[]{name string, value string}` + case "hcl2template.KeyValues": + fieldType = `[]{key string, value string}` } field := Field{ diff --git a/website/pages/partials/builder/alicloud/ecs/AlicloudImageConfig-not-required.mdx b/website/pages/partials/builder/alicloud/ecs/AlicloudImageConfig-not-required.mdx index 9e37ca0a4..88dfdf41a 100644 --- a/website/pages/partials/builder/alicloud/ecs/AlicloudImageConfig-not-required.mdx +++ b/website/pages/partials/builder/alicloud/ecs/AlicloudImageConfig-not-required.mdx @@ -52,7 +52,7 @@ - `tags` (map[string]string) - Key/value pair tags applied to the destination image and relevant snapshots. -- `tag` (hcl2template.KeyValues) - Same as [`tags`](#tags) but defined as a singular repeatable block +- `tag` ([]{key string, value string}) - Same as [`tags`](#tags) but defined as a singular repeatable block containing a `key` and a `value` field. In HCL2 mode the [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/amazon/chroot/Config-not-required.mdx b/website/pages/partials/builder/amazon/chroot/Config-not-required.mdx index 8700c918a..668721f1a 100644 --- a/website/pages/partials/builder/amazon/chroot/Config-not-required.mdx +++ b/website/pages/partials/builder/amazon/chroot/Config-not-required.mdx @@ -125,7 +125,7 @@ a [template engine](/docs/templates/engine), see [Build template data](#build-template-data) for more information. -- `root_volume_tag` (hcl2template.KeyValues) - Same as [`root_volume_tags`](#root_volume_tags) but defined as a +- `root_volume_tag` ([]{key string, value string}) - 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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/amazon/common/AMIConfig-not-required.mdx b/website/pages/partials/builder/amazon/common/AMIConfig-not-required.mdx index 093a01830..2c1ea36cb 100644 --- a/website/pages/partials/builder/amazon/common/AMIConfig-not-required.mdx +++ b/website/pages/partials/builder/amazon/common/AMIConfig-not-required.mdx @@ -32,7 +32,7 @@ engine](/docs/templates/engine), see [Build template data](#build-template-data) for more information. -- `tag` (hcl2template.KeyValues) - Same as [`tags`](#tags) but defined as a singular repeatable block +- `tag` ([]{key string, value string}) - Same as [`tags`](#tags) but defined as a singular repeatable block containing a `key` and a `value` field. In HCL2 mode the [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. @@ -103,7 +103,7 @@ engine](/docs/templates/engine), see [Build template data](#build-template-data) for more information. -- `snapshot_tag` (hcl2template.KeyValues) - Same as [`snapshot_tags`](#snapshot_tags) but defined as a singular +- `snapshot_tag` ([]{key string, value string}) - Same as [`snapshot_tags`](#snapshot_tags) but defined as a singular repeatable block containing a `key` and a `value` field. In HCL2 mode the [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. 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 1e0713b95..e1495a900 100644 --- a/website/pages/partials/builder/amazon/common/RunConfig-not-required.mdx +++ b/website/pages/partials/builder/amazon/common/RunConfig-not-required.mdx @@ -114,7 +114,7 @@ engine](/docs/templates/engine), 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 repeatable +- `run_tag` ([]{key string, value string}) - 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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. @@ -206,7 +206,7 @@ - `spot_tags` (map[string]string) - Requires spot_price to be set. Key/value pair tags to apply tags to the spot request that is issued. -- `spot_tag` (hcl2template.KeyValues) - Same as [`spot_tags`](#spot_tags) but defined as a singular repeatable block +- `spot_tag` ([]{key string, value string}) - 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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/amazon/ebsvolume/BlockDevice-not-required.mdx b/website/pages/partials/builder/amazon/ebsvolume/BlockDevice-not-required.mdx index 7778a4e10..3899a8c18 100644 --- a/website/pages/partials/builder/amazon/ebsvolume/BlockDevice-not-required.mdx +++ b/website/pages/partials/builder/amazon/ebsvolume/BlockDevice-not-required.mdx @@ -4,7 +4,7 @@ completes. This is a [template engine](/docs/templates/engine), see [Build template data](#build-template-data) for more information. -- `tag` (hcl2template.KeyValues) - Same as [`tags`](#tags) but defined as a singular repeatable block +- `tag` ([]{key string, value string}) - Same as [`tags`](#tags) but defined as a singular repeatable block containing a `key` and a `value` field. In HCL2 mode the [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/amazon/ebsvolume/Config-not-required.mdx b/website/pages/partials/builder/amazon/ebsvolume/Config-not-required.mdx index 9ef2c8354..59bcb99cf 100644 --- a/website/pages/partials/builder/amazon/ebsvolume/Config-not-required.mdx +++ b/website/pages/partials/builder/amazon/ebsvolume/Config-not-required.mdx @@ -36,7 +36,7 @@ configured in the `ebs_volumes` section as soon as the instance is reported as 'ready'. -- `run_volume_tag` (hcl2template.KeyValues) - Same as [`run_volume_tags`](#run_volume_tags) but defined as a singular +- `run_volume_tag` ([]{key string, value string}) - Same as [`run_volume_tags`](#run_volume_tags) but defined as a singular repeatable block containing a `key` and a `value` field. In HCL2 mode the [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks) diff --git a/website/pages/partials/builder/hyperone/Config-not-required.mdx b/website/pages/partials/builder/hyperone/Config-not-required.mdx index 5db1f52f8..691221571 100644 --- a/website/pages/partials/builder/hyperone/Config-not-required.mdx +++ b/website/pages/partials/builder/hyperone/Config-not-required.mdx @@ -17,7 +17,7 @@ - `image_tags` (map[string]string) - Key/value pair tags to add to the created image. -- `image_tag` (hcl2template.KeyValues) - Same as [`image_tags`](#image_tags) but defined as a singular repeatable +- `image_tag` ([]{key string, value string}) - 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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx b/website/pages/partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx index c4cb48b21..8b354a99d 100644 --- a/website/pages/partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx +++ b/website/pages/partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx @@ -55,7 +55,7 @@ - `run_tags` (map[string]string) - Key/value pair tags to apply to the instance that is *launched* to create the 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 repeatable +- `run_tag` ([]{key string, value string}) - 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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. diff --git a/website/pages/partials/builder/triton/SourceMachineConfig-not-required.mdx b/website/pages/partials/builder/triton/SourceMachineConfig-not-required.mdx index 385f09e3a..069f5d8cb 100644 --- a/website/pages/partials/builder/triton/SourceMachineConfig-not-required.mdx +++ b/website/pages/partials/builder/triton/SourceMachineConfig-not-required.mdx @@ -25,7 +25,7 @@ - `source_machine_tags` (map[string]string) - Key/value pair tags applied to the VM used to create the image. -- `source_machine_tag` (hcl2template.KeyValues) - Same as [`source_machine_tags`](#source_machine_tags) but defined as a +- `source_machine_tag` ([]{key string, value string}) - 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`](/docs/configuration/from-1.5/expressions#dynamic-blocks) will allow you to create those programatically. From 304f615bc3bb40bfcbbb38c665343dabdefbc4df Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Thu, 23 Apr 2020 10:46:19 +0200 Subject: [PATCH 3/3] Update website/pages/docs/from-1.5/expressions.mdx Co-Authored-By: Megan Marsh --- website/pages/docs/from-1.5/expressions.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/pages/docs/from-1.5/expressions.mdx b/website/pages/docs/from-1.5/expressions.mdx index 7b5a753f2..38040709c 100644 --- a/website/pages/docs/from-1.5/expressions.mdx +++ b/website/pages/docs/from-1.5/expressions.mdx @@ -257,7 +257,7 @@ set. ## `dynamic` blocks Within top-level block constructs like sources, expressions can usually be used -only when assigning a value to an argument using the `name = expression`, `key +only when assigning a value to an argument using the `name = expression` or `key = expression` form. This covers many uses, but some source types include repeatable _nested blocks_ in their arguments, which do not accept expressions: