diff --git a/.web-docs/components/builder/cvm/README.md b/.web-docs/components/builder/cvm/README.md index 227bbb61..e78ba338 100644 --- a/.web-docs/components/builder/cvm/README.md +++ b/.web-docs/components/builder/cvm/README.md @@ -127,7 +127,7 @@ a [communicator](/packer/docs/templates/legacy_json_templates/communicator) can - LOCAL_BASIC: 50 - Other: 50 ~ 1000 (need whitelist if > 50) -- `data_disks` ([]tencentCloudDataDisk) - Add one or more data disks to the instance before creating the image. +- `data_disks` ([]TencentCloudDataDisk) - Add one or more data disks to the instance before creating the image. Note that if the source image has data disk snapshots, this argument will be ignored, and the running instance will use source image data disk settings, in such case, `disk_type` argument will be used as disk @@ -172,6 +172,10 @@ a [communicator](/packer/docs/templates/legacy_json_templates/communicator) can - `cam_role_name` (string) - CAM role name. +- `enhanced_service` (\*TencentCloudEnhancedService) - Configure enhanced security for the instance. Enables you to disable automatic installation + of certain system services during initial provisioning. If omitted, default values are used + (see https://www.tencentcloud.com/document/api/213/15753#enhancedservice). + - `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. diff --git a/builder/tencentcloud/cvm/builder.go b/builder/tencentcloud/cvm/builder.go index cda74a0c..f84c9cc1 100644 --- a/builder/tencentcloud/cvm/builder.go +++ b/builder/tencentcloud/cvm/builder.go @@ -131,6 +131,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) BandwidthPackageId: b.config.BandwidthPackageId, AssociatePublicIpAddress: b.config.AssociatePublicIpAddress, CamRoleName: b.config.CamRoleName, + EnhancedService: b.config.EnhancedService, Tags: b.config.RunTags, }, &communicator.StepConnect{ diff --git a/builder/tencentcloud/cvm/builder.hcl2spec.go b/builder/tencentcloud/cvm/builder.hcl2spec.go index 51eadf70..cfaa6d85 100644 --- a/builder/tencentcloud/cvm/builder.hcl2spec.go +++ b/builder/tencentcloud/cvm/builder.hcl2spec.go @@ -11,108 +11,109 @@ 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" hcl:"packer_build_name"` - PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"` - PackerCoreVersion *string `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"` - PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"` - PackerForce *bool `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"` - PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"` - PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"` - PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"` - SecretId *string `mapstructure:"secret_id" required:"true" cty:"secret_id" hcl:"secret_id"` - SecretKey *string `mapstructure:"secret_key" required:"true" cty:"secret_key" hcl:"secret_key"` - Region *string `mapstructure:"region" required:"true" cty:"region" hcl:"region"` - Zone *string `mapstructure:"zone" required:"true" cty:"zone" hcl:"zone"` - CvmEndpoint *string `mapstructure:"cvm_endpoint" required:"false" cty:"cvm_endpoint" hcl:"cvm_endpoint"` - VpcEndpoint *string `mapstructure:"vpc_endpoint" required:"false" cty:"vpc_endpoint" hcl:"vpc_endpoint"` - SecurityToken *string `mapstructure:"security_token" required:"false" cty:"security_token" hcl:"security_token"` - AssumeRole *FlatTencentCloudAccessRole `mapstructure:"assume_role" required:"false" cty:"assume_role" hcl:"assume_role"` - Profile *string `mapstructure:"profile" required:"false" cty:"profile" hcl:"profile"` - SharedCredentialsDir *string `mapstructure:"shared_credentials_dir" required:"false" cty:"shared_credentials_dir" hcl:"shared_credentials_dir"` - ImageName *string `mapstructure:"image_name" required:"true" cty:"image_name" hcl:"image_name"` - ImageDescription *string `mapstructure:"image_description" required:"false" cty:"image_description" hcl:"image_description"` - ForcePoweroff *bool `mapstructure:"force_poweroff" required:"false" cty:"force_poweroff" hcl:"force_poweroff"` - Sysprep *bool `mapstructure:"sysprep" required:"false" cty:"sysprep" hcl:"sysprep"` - ImageCopyRegions []string `mapstructure:"image_copy_regions" required:"false" cty:"image_copy_regions" hcl:"image_copy_regions"` - ImageShareAccounts []string `mapstructure:"image_share_accounts" required:"false" cty:"image_share_accounts" hcl:"image_share_accounts"` - ImageTags map[string]string `mapstructure:"image_tags" required:"false" cty:"image_tags" hcl:"image_tags"` - AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" required:"false" cty:"associate_public_ip_address" hcl:"associate_public_ip_address"` - SourceImageId *string `mapstructure:"source_image_id" required:"false" cty:"source_image_id" hcl:"source_image_id"` - SourceImageName *string `mapstructure:"source_image_name" required:"false" cty:"source_image_name" hcl:"source_image_name"` - InstanceChargeType *string `mapstructure:"instance_charge_type" required:"false" cty:"instance_charge_type" hcl:"instance_charge_type"` - InstanceType *string `mapstructure:"instance_type" required:"true" cty:"instance_type" hcl:"instance_type"` - InstanceName *string `mapstructure:"instance_name" required:"false" cty:"instance_name" hcl:"instance_name"` - DiskType *string `mapstructure:"disk_type" required:"false" cty:"disk_type" hcl:"disk_type"` - DiskSize *int64 `mapstructure:"disk_size" required:"false" cty:"disk_size" hcl:"disk_size"` - DataDisks []FlattencentCloudDataDisk `mapstructure:"data_disks" cty:"data_disks" hcl:"data_disks"` - VpcId *string `mapstructure:"vpc_id" required:"false" cty:"vpc_id" hcl:"vpc_id"` - VpcName *string `mapstructure:"vpc_name" required:"false" cty:"vpc_name" hcl:"vpc_name"` - SubnetId *string `mapstructure:"subnet_id" required:"false" cty:"subnet_id" hcl:"subnet_id"` - SubnetName *string `mapstructure:"subnet_name" required:"false" cty:"subnet_name" hcl:"subnet_name"` - CidrBlock *string `mapstructure:"cidr_block" required:"false" cty:"cidr_block" hcl:"cidr_block"` - SubnectCidrBlock *string `mapstructure:"subnect_cidr_block" required:"false" cty:"subnect_cidr_block" hcl:"subnect_cidr_block"` - InternetChargeType *string `mapstructure:"internet_charge_type" required:"false" cty:"internet_charge_type" hcl:"internet_charge_type"` - InternetMaxBandwidthOut *int64 `mapstructure:"internet_max_bandwidth_out" required:"false" cty:"internet_max_bandwidth_out" hcl:"internet_max_bandwidth_out"` - BandwidthPackageId *string `mapstructure:"bandwidth_package_id" required:"false" cty:"bandwidth_package_id" hcl:"bandwidth_package_id"` - SecurityGroupId *string `mapstructure:"security_group_id" required:"false" cty:"security_group_id" hcl:"security_group_id"` - SecurityGroupName *string `mapstructure:"security_group_name" required:"false" cty:"security_group_name" hcl:"security_group_name"` - UserData *string `mapstructure:"user_data" required:"false" cty:"user_data" hcl:"user_data"` - UserDataFile *string `mapstructure:"user_data_file" required:"false" cty:"user_data_file" hcl:"user_data_file"` - HostName *string `mapstructure:"host_name" required:"false" cty:"host_name" hcl:"host_name"` - CamRoleName *string `mapstructure:"cam_role_name" required:"false" cty:"cam_role_name" hcl:"cam_role_name"` - RunTags map[string]string `mapstructure:"run_tags" required:"false" cty:"run_tags" hcl:"run_tags"` - RunTag []config.FlatKeyValue `mapstructure:"run_tag" required:"false" cty:"run_tag" hcl:"run_tag"` - Type *string `mapstructure:"communicator" cty:"communicator" hcl:"communicator"` - PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting" hcl:"pause_before_connecting"` - SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host" hcl:"ssh_host"` - SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port" hcl:"ssh_port"` - SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username" hcl:"ssh_username"` - SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password" hcl:"ssh_password"` - SSHKeyPairName *string `mapstructure:"ssh_keypair_name" undocumented:"true" cty:"ssh_keypair_name" hcl:"ssh_keypair_name"` - SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" undocumented:"true" cty:"temporary_key_pair_name" hcl:"temporary_key_pair_name"` - SSHTemporaryKeyPairType *string `mapstructure:"temporary_key_pair_type" cty:"temporary_key_pair_type" hcl:"temporary_key_pair_type"` - SSHTemporaryKeyPairBits *int `mapstructure:"temporary_key_pair_bits" cty:"temporary_key_pair_bits" hcl:"temporary_key_pair_bits"` - SSHCiphers []string `mapstructure:"ssh_ciphers" cty:"ssh_ciphers" hcl:"ssh_ciphers"` - SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys" hcl:"ssh_clear_authorized_keys"` - SSHKEXAlgos []string `mapstructure:"ssh_key_exchange_algorithms" cty:"ssh_key_exchange_algorithms" hcl:"ssh_key_exchange_algorithms"` - SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" undocumented:"true" cty:"ssh_private_key_file" hcl:"ssh_private_key_file"` - SSHCertificateFile *string `mapstructure:"ssh_certificate_file" cty:"ssh_certificate_file" hcl:"ssh_certificate_file"` - SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty" hcl:"ssh_pty"` - SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout" hcl:"ssh_timeout"` - SSHWaitTimeout *string `mapstructure:"ssh_wait_timeout" undocumented:"true" cty:"ssh_wait_timeout" hcl:"ssh_wait_timeout"` - SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" undocumented:"true" cty:"ssh_agent_auth" hcl:"ssh_agent_auth"` - SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding" hcl:"ssh_disable_agent_forwarding"` - SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts" hcl:"ssh_handshake_attempts"` - SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host" hcl:"ssh_bastion_host"` - SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port" hcl:"ssh_bastion_port"` - SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth" hcl:"ssh_bastion_agent_auth"` - SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username" hcl:"ssh_bastion_username"` - SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password" hcl:"ssh_bastion_password"` - SSHBastionInteractive *bool `mapstructure:"ssh_bastion_interactive" cty:"ssh_bastion_interactive" hcl:"ssh_bastion_interactive"` - SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file" hcl:"ssh_bastion_private_key_file"` - SSHBastionCertificateFile *string `mapstructure:"ssh_bastion_certificate_file" cty:"ssh_bastion_certificate_file" hcl:"ssh_bastion_certificate_file"` - SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method" hcl:"ssh_file_transfer_method"` - SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host" hcl:"ssh_proxy_host"` - SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port" hcl:"ssh_proxy_port"` - SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username" hcl:"ssh_proxy_username"` - SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password" hcl:"ssh_proxy_password"` - SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval" hcl:"ssh_keep_alive_interval"` - SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout" hcl:"ssh_read_write_timeout"` - SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels" hcl:"ssh_remote_tunnels"` - SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels" hcl:"ssh_local_tunnels"` - SSHPublicKey []byte `mapstructure:"ssh_public_key" undocumented:"true" cty:"ssh_public_key" hcl:"ssh_public_key"` - SSHPrivateKey []byte `mapstructure:"ssh_private_key" undocumented:"true" cty:"ssh_private_key" hcl:"ssh_private_key"` - WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username" hcl:"winrm_username"` - WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password" hcl:"winrm_password"` - WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host" hcl:"winrm_host"` - WinRMNoProxy *bool `mapstructure:"winrm_no_proxy" cty:"winrm_no_proxy" hcl:"winrm_no_proxy"` - WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port" hcl:"winrm_port"` - WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout" hcl:"winrm_timeout"` - WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl" hcl:"winrm_use_ssl"` - WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure" hcl:"winrm_insecure"` - WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm" hcl:"winrm_use_ntlm"` - SSHPrivateIp *bool `mapstructure:"ssh_private_ip" cty:"ssh_private_ip" hcl:"ssh_private_ip"` - SkipRegionValidation *bool `mapstructure:"skip_region_validation" required:"false" cty:"skip_region_validation" hcl:"skip_region_validation"` + PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"` + PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"` + PackerCoreVersion *string `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"` + PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"` + PackerForce *bool `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"` + PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"` + PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"` + PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"` + SecretId *string `mapstructure:"secret_id" required:"true" cty:"secret_id" hcl:"secret_id"` + SecretKey *string `mapstructure:"secret_key" required:"true" cty:"secret_key" hcl:"secret_key"` + Region *string `mapstructure:"region" required:"true" cty:"region" hcl:"region"` + Zone *string `mapstructure:"zone" required:"true" cty:"zone" hcl:"zone"` + CvmEndpoint *string `mapstructure:"cvm_endpoint" required:"false" cty:"cvm_endpoint" hcl:"cvm_endpoint"` + VpcEndpoint *string `mapstructure:"vpc_endpoint" required:"false" cty:"vpc_endpoint" hcl:"vpc_endpoint"` + SecurityToken *string `mapstructure:"security_token" required:"false" cty:"security_token" hcl:"security_token"` + AssumeRole *FlatTencentCloudAccessRole `mapstructure:"assume_role" required:"false" cty:"assume_role" hcl:"assume_role"` + Profile *string `mapstructure:"profile" required:"false" cty:"profile" hcl:"profile"` + SharedCredentialsDir *string `mapstructure:"shared_credentials_dir" required:"false" cty:"shared_credentials_dir" hcl:"shared_credentials_dir"` + ImageName *string `mapstructure:"image_name" required:"true" cty:"image_name" hcl:"image_name"` + ImageDescription *string `mapstructure:"image_description" required:"false" cty:"image_description" hcl:"image_description"` + ForcePoweroff *bool `mapstructure:"force_poweroff" required:"false" cty:"force_poweroff" hcl:"force_poweroff"` + Sysprep *bool `mapstructure:"sysprep" required:"false" cty:"sysprep" hcl:"sysprep"` + ImageCopyRegions []string `mapstructure:"image_copy_regions" required:"false" cty:"image_copy_regions" hcl:"image_copy_regions"` + ImageShareAccounts []string `mapstructure:"image_share_accounts" required:"false" cty:"image_share_accounts" hcl:"image_share_accounts"` + ImageTags map[string]string `mapstructure:"image_tags" required:"false" cty:"image_tags" hcl:"image_tags"` + AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" required:"false" cty:"associate_public_ip_address" hcl:"associate_public_ip_address"` + SourceImageId *string `mapstructure:"source_image_id" required:"false" cty:"source_image_id" hcl:"source_image_id"` + SourceImageName *string `mapstructure:"source_image_name" required:"false" cty:"source_image_name" hcl:"source_image_name"` + InstanceChargeType *string `mapstructure:"instance_charge_type" required:"false" cty:"instance_charge_type" hcl:"instance_charge_type"` + InstanceType *string `mapstructure:"instance_type" required:"true" cty:"instance_type" hcl:"instance_type"` + InstanceName *string `mapstructure:"instance_name" required:"false" cty:"instance_name" hcl:"instance_name"` + DiskType *string `mapstructure:"disk_type" required:"false" cty:"disk_type" hcl:"disk_type"` + DiskSize *int64 `mapstructure:"disk_size" required:"false" cty:"disk_size" hcl:"disk_size"` + DataDisks []FlatTencentCloudDataDisk `mapstructure:"data_disks" cty:"data_disks" hcl:"data_disks"` + VpcId *string `mapstructure:"vpc_id" required:"false" cty:"vpc_id" hcl:"vpc_id"` + VpcName *string `mapstructure:"vpc_name" required:"false" cty:"vpc_name" hcl:"vpc_name"` + SubnetId *string `mapstructure:"subnet_id" required:"false" cty:"subnet_id" hcl:"subnet_id"` + SubnetName *string `mapstructure:"subnet_name" required:"false" cty:"subnet_name" hcl:"subnet_name"` + CidrBlock *string `mapstructure:"cidr_block" required:"false" cty:"cidr_block" hcl:"cidr_block"` + SubnectCidrBlock *string `mapstructure:"subnect_cidr_block" required:"false" cty:"subnect_cidr_block" hcl:"subnect_cidr_block"` + InternetChargeType *string `mapstructure:"internet_charge_type" required:"false" cty:"internet_charge_type" hcl:"internet_charge_type"` + InternetMaxBandwidthOut *int64 `mapstructure:"internet_max_bandwidth_out" required:"false" cty:"internet_max_bandwidth_out" hcl:"internet_max_bandwidth_out"` + BandwidthPackageId *string `mapstructure:"bandwidth_package_id" required:"false" cty:"bandwidth_package_id" hcl:"bandwidth_package_id"` + SecurityGroupId *string `mapstructure:"security_group_id" required:"false" cty:"security_group_id" hcl:"security_group_id"` + SecurityGroupName *string `mapstructure:"security_group_name" required:"false" cty:"security_group_name" hcl:"security_group_name"` + UserData *string `mapstructure:"user_data" required:"false" cty:"user_data" hcl:"user_data"` + UserDataFile *string `mapstructure:"user_data_file" required:"false" cty:"user_data_file" hcl:"user_data_file"` + HostName *string `mapstructure:"host_name" required:"false" cty:"host_name" hcl:"host_name"` + CamRoleName *string `mapstructure:"cam_role_name" required:"false" cty:"cam_role_name" hcl:"cam_role_name"` + EnhancedService *FlatTencentCloudEnhancedService `mapstructure:"enhanced_service,omitempty" required:"false" cty:"enhanced_service" hcl:"enhanced_service"` + RunTags map[string]string `mapstructure:"run_tags" required:"false" cty:"run_tags" hcl:"run_tags"` + RunTag []config.FlatKeyValue `mapstructure:"run_tag" required:"false" cty:"run_tag" hcl:"run_tag"` + Type *string `mapstructure:"communicator" cty:"communicator" hcl:"communicator"` + PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting" hcl:"pause_before_connecting"` + SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host" hcl:"ssh_host"` + SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port" hcl:"ssh_port"` + SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username" hcl:"ssh_username"` + SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password" hcl:"ssh_password"` + SSHKeyPairName *string `mapstructure:"ssh_keypair_name" undocumented:"true" cty:"ssh_keypair_name" hcl:"ssh_keypair_name"` + SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" undocumented:"true" cty:"temporary_key_pair_name" hcl:"temporary_key_pair_name"` + SSHTemporaryKeyPairType *string `mapstructure:"temporary_key_pair_type" cty:"temporary_key_pair_type" hcl:"temporary_key_pair_type"` + SSHTemporaryKeyPairBits *int `mapstructure:"temporary_key_pair_bits" cty:"temporary_key_pair_bits" hcl:"temporary_key_pair_bits"` + SSHCiphers []string `mapstructure:"ssh_ciphers" cty:"ssh_ciphers" hcl:"ssh_ciphers"` + SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys" hcl:"ssh_clear_authorized_keys"` + SSHKEXAlgos []string `mapstructure:"ssh_key_exchange_algorithms" cty:"ssh_key_exchange_algorithms" hcl:"ssh_key_exchange_algorithms"` + SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" undocumented:"true" cty:"ssh_private_key_file" hcl:"ssh_private_key_file"` + SSHCertificateFile *string `mapstructure:"ssh_certificate_file" cty:"ssh_certificate_file" hcl:"ssh_certificate_file"` + SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty" hcl:"ssh_pty"` + SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout" hcl:"ssh_timeout"` + SSHWaitTimeout *string `mapstructure:"ssh_wait_timeout" undocumented:"true" cty:"ssh_wait_timeout" hcl:"ssh_wait_timeout"` + SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" undocumented:"true" cty:"ssh_agent_auth" hcl:"ssh_agent_auth"` + SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding" hcl:"ssh_disable_agent_forwarding"` + SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts" hcl:"ssh_handshake_attempts"` + SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host" hcl:"ssh_bastion_host"` + SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port" hcl:"ssh_bastion_port"` + SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth" hcl:"ssh_bastion_agent_auth"` + SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username" hcl:"ssh_bastion_username"` + SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password" hcl:"ssh_bastion_password"` + SSHBastionInteractive *bool `mapstructure:"ssh_bastion_interactive" cty:"ssh_bastion_interactive" hcl:"ssh_bastion_interactive"` + SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file" hcl:"ssh_bastion_private_key_file"` + SSHBastionCertificateFile *string `mapstructure:"ssh_bastion_certificate_file" cty:"ssh_bastion_certificate_file" hcl:"ssh_bastion_certificate_file"` + SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method" hcl:"ssh_file_transfer_method"` + SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host" hcl:"ssh_proxy_host"` + SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port" hcl:"ssh_proxy_port"` + SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username" hcl:"ssh_proxy_username"` + SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password" hcl:"ssh_proxy_password"` + SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval" hcl:"ssh_keep_alive_interval"` + SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout" hcl:"ssh_read_write_timeout"` + SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels" hcl:"ssh_remote_tunnels"` + SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels" hcl:"ssh_local_tunnels"` + SSHPublicKey []byte `mapstructure:"ssh_public_key" undocumented:"true" cty:"ssh_public_key" hcl:"ssh_public_key"` + SSHPrivateKey []byte `mapstructure:"ssh_private_key" undocumented:"true" cty:"ssh_private_key" hcl:"ssh_private_key"` + WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username" hcl:"winrm_username"` + WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password" hcl:"winrm_password"` + WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host" hcl:"winrm_host"` + WinRMNoProxy *bool `mapstructure:"winrm_no_proxy" cty:"winrm_no_proxy" hcl:"winrm_no_proxy"` + WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port" hcl:"winrm_port"` + WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout" hcl:"winrm_timeout"` + WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl" hcl:"winrm_use_ssl"` + WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure" hcl:"winrm_insecure"` + WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm" hcl:"winrm_use_ntlm"` + SSHPrivateIp *bool `mapstructure:"ssh_private_ip" cty:"ssh_private_ip" hcl:"ssh_private_ip"` + SkipRegionValidation *bool `mapstructure:"skip_region_validation" required:"false" cty:"skip_region_validation" hcl:"skip_region_validation"` } // FlatMapstructure returns a new FlatConfig. @@ -160,7 +161,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "instance_name": &hcldec.AttrSpec{Name: "instance_name", Type: cty.String, Required: false}, "disk_type": &hcldec.AttrSpec{Name: "disk_type", Type: cty.String, Required: false}, "disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false}, - "data_disks": &hcldec.BlockListSpec{TypeName: "data_disks", Nested: hcldec.ObjectSpec((*FlattencentCloudDataDisk)(nil).HCL2Spec())}, + "data_disks": &hcldec.BlockListSpec{TypeName: "data_disks", Nested: hcldec.ObjectSpec((*FlatTencentCloudDataDisk)(nil).HCL2Spec())}, "vpc_id": &hcldec.AttrSpec{Name: "vpc_id", Type: cty.String, Required: false}, "vpc_name": &hcldec.AttrSpec{Name: "vpc_name", Type: cty.String, Required: false}, "subnet_id": &hcldec.AttrSpec{Name: "subnet_id", Type: cty.String, Required: false}, @@ -176,6 +177,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}, "cam_role_name": &hcldec.AttrSpec{Name: "cam_role_name", Type: cty.String, Required: false}, + "enhanced_service": &hcldec.BlockSpec{TypeName: "enhanced_service", Nested: hcldec.ObjectSpec((*FlatTencentCloudEnhancedService)(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((*config.FlatKeyValue)(nil).HCL2Spec())}, "communicator": &hcldec.AttrSpec{Name: "communicator", Type: cty.String, Required: false}, diff --git a/builder/tencentcloud/cvm/run_config.go b/builder/tencentcloud/cvm/run_config.go index e4a45e11..9cdaca71 100644 --- a/builder/tencentcloud/cvm/run_config.go +++ b/builder/tencentcloud/cvm/run_config.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MPL-2.0 //go:generate packer-sdc struct-markdown -//go:generate packer-sdc mapstructure-to-hcl2 -type tencentCloudDataDisk +//go:generate packer-sdc mapstructure-to-hcl2 -type TencentCloudDataDisk,TencentCloudEnhancedService package cvm @@ -18,12 +18,24 @@ import ( "github.com/pkg/errors" ) -type tencentCloudDataDisk struct { +type TencentCloudDataDisk struct { DiskType string `mapstructure:"disk_type"` DiskSize int64 `mapstructure:"disk_size"` SnapshotId string `mapstructure:"disk_snapshot_id"` } +type TencentCloudEnhancedService struct { + // Enables cloud security service. If this parameter is not specified, + // the cloud security service will be enabled by default. + SecurityService bool `mapstructure:"security_service" required:"false"` + // Enables cloud monitor service. If this parameter is not specified, // + // the cloud monitor service will be enabled by default. + MonitorService bool `mapstructure:"monitor_service" required:"false"` + // Whether to enable the TAT service. If this parameter is not specified, + // the TAT service is enabled for public images and disabled for other images by default. + AutomationService bool `mapstructure:"automation_service" required:"false"` +} + type TencentCloudRunConfig struct { // Whether allocate public ip to your cvm. // Default value is `false`. @@ -60,7 +72,7 @@ type TencentCloudRunConfig struct { // - `disk_type` - Type of the data disk. Valid choices: `CLOUD_BASIC`, `CLOUD_PREMIUM` and `CLOUD_SSD`. // - `disk_size` - Size of the data disk. // - `disk_snapshot_id` - Id of the snapshot for a data disk. - DataDisks []tencentCloudDataDisk `mapstructure:"data_disks"` + DataDisks []TencentCloudDataDisk `mapstructure:"data_disks"` // Specify vpc your cvm will be launched by. VpcId string `mapstructure:"vpc_id" required:"false"` // Specify vpc name you will create. if `vpc_id` is not set, Packer will @@ -95,6 +107,10 @@ type TencentCloudRunConfig struct { HostName string `mapstructure:"host_name" required:"false"` // CAM role name. CamRoleName string `mapstructure:"cam_role_name" required:"false"` + // Configure enhanced security for the instance. Enables you to disable automatic installation + // of certain system services during initial provisioning. If omitted, default values are used + // (see https://www.tencentcloud.com/document/api/213/15753#enhancedservice). + EnhancedService *TencentCloudEnhancedService `mapstructure:"enhanced_service,omitempty" required:"false"` // 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"` diff --git a/builder/tencentcloud/cvm/run_config.hcl2spec.go b/builder/tencentcloud/cvm/run_config.hcl2spec.go index 0d0dfe9f..5b06e35a 100644 --- a/builder/tencentcloud/cvm/run_config.hcl2spec.go +++ b/builder/tencentcloud/cvm/run_config.hcl2spec.go @@ -7,25 +7,25 @@ import ( "github.com/zclconf/go-cty/cty" ) -// FlattencentCloudDataDisk is an auto-generated flat version of tencentCloudDataDisk. +// FlatTencentCloudDataDisk is an auto-generated flat version of TencentCloudDataDisk. // Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. -type FlattencentCloudDataDisk struct { +type FlatTencentCloudDataDisk struct { DiskType *string `mapstructure:"disk_type" cty:"disk_type" hcl:"disk_type"` DiskSize *int64 `mapstructure:"disk_size" cty:"disk_size" hcl:"disk_size"` SnapshotId *string `mapstructure:"disk_snapshot_id" cty:"disk_snapshot_id" hcl:"disk_snapshot_id"` } -// FlatMapstructure returns a new FlattencentCloudDataDisk. -// FlattencentCloudDataDisk is an auto-generated flat version of tencentCloudDataDisk. +// FlatMapstructure returns a new FlatTencentCloudDataDisk. +// FlatTencentCloudDataDisk is an auto-generated flat version of TencentCloudDataDisk. // Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. -func (*tencentCloudDataDisk) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { - return new(FlattencentCloudDataDisk) +func (*TencentCloudDataDisk) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatTencentCloudDataDisk) } -// HCL2Spec returns the hcl spec of a tencentCloudDataDisk. -// This spec is used by HCL to read the fields of tencentCloudDataDisk. -// The decoded values from this spec will then be applied to a FlattencentCloudDataDisk. -func (*FlattencentCloudDataDisk) HCL2Spec() map[string]hcldec.Spec { +// HCL2Spec returns the hcl spec of a TencentCloudDataDisk. +// This spec is used by HCL to read the fields of TencentCloudDataDisk. +// The decoded values from this spec will then be applied to a FlatTencentCloudDataDisk. +func (*FlatTencentCloudDataDisk) HCL2Spec() map[string]hcldec.Spec { s := map[string]hcldec.Spec{ "disk_type": &hcldec.AttrSpec{Name: "disk_type", Type: cty.String, Required: false}, "disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false}, @@ -33,3 +33,30 @@ func (*FlattencentCloudDataDisk) HCL2Spec() map[string]hcldec.Spec { } return s } + +// FlatTencentCloudEnhancedService is an auto-generated flat version of TencentCloudEnhancedService. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatTencentCloudEnhancedService struct { + SecurityService *bool `mapstructure:"security_service" required:"false" cty:"security_service" hcl:"security_service"` + MonitorService *bool `mapstructure:"monitor_service" required:"false" cty:"monitor_service" hcl:"monitor_service"` + AutomationService *bool `mapstructure:"automation_service" required:"false" cty:"automation_service" hcl:"automation_service"` +} + +// FlatMapstructure returns a new FlatTencentCloudEnhancedService. +// FlatTencentCloudEnhancedService is an auto-generated flat version of TencentCloudEnhancedService. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*TencentCloudEnhancedService) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatTencentCloudEnhancedService) +} + +// HCL2Spec returns the hcl spec of a TencentCloudEnhancedService. +// This spec is used by HCL to read the fields of TencentCloudEnhancedService. +// The decoded values from this spec will then be applied to a FlatTencentCloudEnhancedService. +func (*FlatTencentCloudEnhancedService) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "security_service": &hcldec.AttrSpec{Name: "security_service", Type: cty.Bool, Required: false}, + "monitor_service": &hcldec.AttrSpec{Name: "monitor_service", Type: cty.Bool, Required: false}, + "automation_service": &hcldec.AttrSpec{Name: "automation_service", Type: cty.Bool, Required: false}, + } + return s +} diff --git a/builder/tencentcloud/cvm/step_run_instance.go b/builder/tencentcloud/cvm/step_run_instance.go index 943eabf6..6cb058a7 100644 --- a/builder/tencentcloud/cvm/step_run_instance.go +++ b/builder/tencentcloud/cvm/step_run_instance.go @@ -29,9 +29,10 @@ type stepRunInstance struct { InternetMaxBandwidthOut int64 BandwidthPackageId string CamRoleName string + EnhancedService *TencentCloudEnhancedService AssociatePublicIpAddress bool Tags map[string]string - DataDisks []tencentCloudDataDisk + DataDisks []TencentCloudDataDisk } func (s *stepRunInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { @@ -139,6 +140,20 @@ func (s *stepRunInstance) Run(ctx context.Context, state multistep.StateBag) mul req.HostName = &s.HostName req.UserData = &userData req.CamRoleName = &s.CamRoleName + + if s.EnhancedService != nil { + req.EnhancedService = &cvm.EnhancedService{ + AutomationService: &cvm.RunAutomationServiceEnabled{ + Enabled: &s.EnhancedService.AutomationService, + }, + MonitorService: &cvm.RunMonitorServiceEnabled{ + Enabled: &s.EnhancedService.MonitorService, + }, + SecurityService: &cvm.RunSecurityServiceEnabled{ + Enabled: &s.EnhancedService.SecurityService, + }, + } + } var tags []*cvm.Tag for k, v := range s.Tags { k := k diff --git a/docs-partials/builder/tencentcloud/cvm/TencentCloudEnhancedService-not-required.mdx b/docs-partials/builder/tencentcloud/cvm/TencentCloudEnhancedService-not-required.mdx new file mode 100644 index 00000000..b2fe35e4 --- /dev/null +++ b/docs-partials/builder/tencentcloud/cvm/TencentCloudEnhancedService-not-required.mdx @@ -0,0 +1,12 @@ + + +- `security_service` (bool) - Enables cloud security service. If this parameter is not specified, + the cloud security service will be enabled by default. + +- `monitor_service` (bool) - Enables cloud monitor service. If this parameter is not specified, // + the cloud monitor service will be enabled by default. + +- `automation_service` (bool) - Whether to enable the TAT service. If this parameter is not specified, + the TAT service is enabled for public images and disabled for other images by default. + + diff --git a/docs-partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx b/docs-partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx index 7d1fabb9..31fc1215 100644 --- a/docs-partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx +++ b/docs-partials/builder/tencentcloud/cvm/TencentCloudRunConfig-not-required.mdx @@ -21,7 +21,7 @@ - LOCAL_BASIC: 50 - Other: 50 ~ 1000 (need whitelist if > 50) -- `data_disks` ([]tencentCloudDataDisk) - Add one or more data disks to the instance before creating the image. +- `data_disks` ([]TencentCloudDataDisk) - Add one or more data disks to the instance before creating the image. Note that if the source image has data disk snapshots, this argument will be ignored, and the running instance will use source image data disk settings, in such case, `disk_type` argument will be used as disk @@ -66,6 +66,10 @@ - `cam_role_name` (string) - CAM role name. +- `enhanced_service` (\*TencentCloudEnhancedService) - Configure enhanced security for the instance. Enables you to disable automatic installation + of certain system services during initial provisioning. If omitted, default values are used + (see https://www.tencentcloud.com/document/api/213/15753#enhancedservice). + - `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. diff --git a/docs-partials/builder/tencentcloud/cvm/tencentCloudDataDisk-not-required.mdx b/docs-partials/builder/tencentcloud/cvm/tencentCloudDataDisk-not-required.mdx index 8cdd0545..216bb64c 100644 --- a/docs-partials/builder/tencentcloud/cvm/tencentCloudDataDisk-not-required.mdx +++ b/docs-partials/builder/tencentcloud/cvm/tencentCloudDataDisk-not-required.mdx @@ -1,4 +1,4 @@ - + - `disk_type` (string) - Disk Type @@ -6,4 +6,4 @@ - `disk_snapshot_id` (string) - Snapshot Id - +