Skip to content

Commit 2b7a096

Browse files
gitmknlbajolet-hashicorp
authored andcommitted
feat: Enhanced authentication options for TencentCloud
* Add support temporary tokens * Add support RoleArn * Add support for profile configuration * Add support for STS permissions
1 parent ab62c87 commit 2b7a096

20 files changed

+830
-335
lines changed

.web-docs/components/builder/cvm/README.md

Lines changed: 100 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ a [communicator](/packer/docs/templates/legacy_json_templates/communicator) can
1212

1313
### Required:
1414

15+
<!-- Code generated from the comments of the TencentCloudAccessConfig struct in builder/tencentcloud/cvm/access_config.go; DO NOT EDIT MANUALLY -->
16+
1517
- `secret_id` (string) - Tencentcloud secret id. You should set it directly,
1618
or set the `TENCENTCLOUD_SECRET_ID` environment variable.
1719

@@ -26,100 +28,162 @@ a [communicator](/packer/docs/templates/legacy_json_templates/communicator) can
2628
reference [Region and Zone](https://intl.cloud.tencent.com/document/product/213/6091)
2729
for parameter taking.
2830

31+
<!-- End of code generated from the comments of the TencentCloudAccessConfig struct in builder/tencentcloud/cvm/access_config.go; -->
32+
33+
34+
<!-- Code generated from the comments of the TencentCloudRunConfig struct in builder/tencentcloud/cvm/run_config.go; DO NOT EDIT MANUALLY -->
35+
2936
- `instance_type` (string) - The instance type your cvm will be launched by.
3037
You should reference [Instance Type](https://intl.cloud.tencent.com/document/product/213/11518)
3138
for parameter taking.
3239

33-
- `source_image_id` (string) - The base image id of Image you want to create
34-
your customized image from.
40+
<!-- End of code generated from the comments of the TencentCloudRunConfig struct in builder/tencentcloud/cvm/run_config.go; -->
41+
42+
43+
<!-- Code generated from the comments of the TencentCloudImageConfig struct in builder/tencentcloud/cvm/image_config.go; DO NOT EDIT MANUALLY -->
3544

3645
- `image_name` (string) - The name you want to create your customize image,
3746
it should be composed of no more than 60 characters, of letters, numbers
3847
or minus sign.
3948

49+
<!-- End of code generated from the comments of the TencentCloudImageConfig struct in builder/tencentcloud/cvm/image_config.go; -->
50+
51+
4052
### Optional:
4153

42-
- `force_poweroff` (boolean) - Indicates whether to perform a forced shutdown to
43-
create an image when soft shutdown fails. Default value is `false`.
54+
<!-- Code generated from the comments of the TencentCloudAccessConfig struct in builder/tencentcloud/cvm/access_config.go; DO NOT EDIT MANUALLY -->
55+
56+
- `cvm_endpoint` (string) - The endpoint you want to reach the cloud endpoint,
57+
if tce cloud you should set a tce cvm endpoint.
58+
59+
- `vpc_endpoint` (string) - The endpoint you want to reach the cloud endpoint,
60+
if tce cloud you should set a tce vpc endpoint.
61+
62+
- `security_token` (string) - STS access token, can be set through template or by exporting
63+
as environment variable such as `export TENCENTCLOUD_SECURITY_TOKEN=value`.
64+
65+
- `assume_role` (TencentCloudAccessRole) - The `assume_role` block.
66+
If provided, packer will attempt to assume this role using the supplied credentials.
67+
- `role_arn` (string) - The ARN of the role to assume.
68+
It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_ARN`.
69+
- `session_name` (string) - The session name to use when making the AssumeRole call.
70+
It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SESSION_NAME`.
71+
- `session_duration` (int) - The duration of the session when making the AssumeRole call.
72+
Its value ranges from 0 to 43200(seconds), and default is 7200 seconds.
73+
It can be sourced from the `TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION`.
74+
75+
- `profile` (string) - The profile name as set in the shared credentials.
76+
It can also be sourced from the `TENCENTCLOUD_PROFILE` environment variable.
77+
If not set, the default profile created with `tccli configure` will be used.
78+
If not set this defaults to `default`.
79+
80+
- `shared_credentials_dir` (string) - The directory of the shared credentials.
81+
It can also be sourced from the `TENCENTCLOUD_SHARED_CREDENTIALS_DIR` environment variable.
82+
If not set this defaults to `~/.tccli`.
83+
84+
<!-- End of code generated from the comments of the TencentCloudAccessConfig struct in builder/tencentcloud/cvm/access_config.go; -->
85+
86+
87+
<!-- Code generated from the comments of the TencentCloudImageConfig struct in builder/tencentcloud/cvm/image_config.go; DO NOT EDIT MANUALLY -->
4488

4589
- `image_description` (string) - Image description. It should no more than 60 characters.
4690

47-
- `reboot` (boolean, **deprecated**) - Whether shutdown cvm to create Image.
48-
Please refer to parameter `force_poweroff`.
91+
- `force_poweroff` (bool) - Indicates whether to perform a forced shutdown to
92+
create an image when soft shutdown fails. Default value is `false`.
4993

50-
- `sysprep` (boolean) - Whether enable Sysprep during creating windows image.
94+
- `sysprep` (bool) - Whether enable Sysprep during creating windows image.
5195

52-
- `image_copy_regions` (array of strings) - Regions that will be copied to after
96+
- `image_copy_regions` ([]string) - regions that will be copied to after
5397
your image created.
5498

55-
- `image_share_accounts` (array of strings) - Accounts that will be shared to
99+
- `image_share_accounts` ([]string) - accounts that will be shared to
56100
after your image created.
57101

58-
- `skip_region_validation` (boolean) - Do not check region and zone when validate.
102+
- `image_tags` (map[string]string) - Key/value pair tags that will be applied to the resulting image.
103+
104+
<!-- End of code generated from the comments of the TencentCloudImageConfig struct in builder/tencentcloud/cvm/image_config.go; -->
105+
59106

60-
- `associate_public_ip_address` (boolean) - Whether allocate public ip to your cvm.
107+
<!-- Code generated from the comments of the TencentCloudRunConfig struct in builder/tencentcloud/cvm/run_config.go; DO NOT EDIT MANUALLY -->
108+
109+
- `associate_public_ip_address` (bool) - Whether allocate public ip to your cvm.
61110
Default value is `false`.
62111

63-
If not set, you could access your cvm from the same vpc.
112+
- `source_image_id` (string) - The base image id of Image you want to create
113+
your customized image from.
114+
115+
- `source_image_name` (string) - The base image name of Image you want to create your
116+
customized image from.Conflict with SourceImageId.
64117

65-
- `internet_max_bandwidth_out` (number) - Max bandwidth out your cvm will be launched by(in MB).
66-
values can be set between 1 ~ 100.
118+
- `instance_charge_type` (string) - Charge type of cvm, values can be `POSTPAID_BY_HOUR` (default) `SPOTPAID`
67119

68120
- `instance_name` (string) - Instance name.
69121

70122
- `disk_type` (string) - Root disk type your cvm will be launched by, default is `CLOUD_PREMIUM`. you could
71123
reference [Disk Type](https://intl.cloud.tencent.com/document/product/213/15753#SystemDisk)
72124
for parameter taking.
73125

74-
- `disk_size` (number) - Root disk size your cvm will be launched by. values range(in GB):
75-
126+
- `disk_size` (int64) - Root disk size your cvm will be launched by. values range(in GB):
76127
- LOCAL_BASIC: 50
77128
- Other: 50 ~ 1000 (need whitelist if > 50)
78129

79-
- `data_disks` (array of data disks) - Add one or more data disks to the instance before creating the
80-
image. Note that if the source image has data disk snapshots, this argument will be ignored, and
81-
the running instance will use source image data disk settings, in such case, `disk_type`
82-
argument will be used as disk type for all data disks, and each data disk size will use the
83-
origin value in source image.
130+
- `data_disks` ([]tencentCloudDataDisk) - Add one or more data disks to the instance before creating the image.
131+
Note that if the source image has data disk snapshots, this argument
132+
will be ignored, and the running instance will use source image data
133+
disk settings, in such case, `disk_type` argument will be used as disk
134+
type for all data disks, and each data disk size will use the origin
135+
value in source image.
84136
The data disks allow for the following argument:
85-
86-
- `disk_type` - Type of the data disk. Valid choices: `CLOUD_BASIC`, `CLOUD_PREMIUM` and `CLOUD_SSD`.
87-
- `disk_size` - Size of the data disk.
88-
- `disk_snapshot_id` - Id of the snapshot for a data disk.
137+
- `disk_type` - Type of the data disk. Valid choices: `CLOUD_BASIC`, `CLOUD_PREMIUM` and `CLOUD_SSD`.
138+
- `disk_size` - Size of the data disk.
139+
- `disk_snapshot_id` - Id of the snapshot for a data disk.
89140

90141
- `vpc_id` (string) - Specify vpc your cvm will be launched by.
91142

92143
- `vpc_name` (string) - Specify vpc name you will create. if `vpc_id` is not set, Packer will
93144
create a vpc for you named this parameter.
94145

95-
- `cidr_block` (boolean) - Specify cider block of the vpc you will create if `vpc_id` is not set.
96-
97146
- `subnet_id` (string) - Specify subnet your cvm will be launched by.
98147

99148
- `subnet_name` (string) - Specify subnet name you will create. if `subnet_id` is not set, Packer will
100149
create a subnet for you named this parameter.
101150

102-
- `subnect_cidr_block` (boolean) - Specify cider block of the subnet you will create if
103-
`subnet_id` is not set.
151+
- `cidr_block` (string) - Specify cider block of the vpc you will create if vpc_id not set
104152

105-
- `security_group_id` (string) - Specify security group your cvm will be launched by.
153+
- `subnect_cidr_block` (string) - Specify cider block of the subnet you will create if
154+
subnet_id not set
106155

107-
- `security_group_name` (string) - Specify security name you will create if `security_group_id` is not set.
156+
- `internet_charge_type` (string) - Internet charge type of cvm, values can be TRAFFIC_POSTPAID_BY_HOUR, BANDWIDTH_POSTPAID_BY_HOUR, BANDWIDTH_PACKAGE
157+
158+
- `internet_max_bandwidth_out` (int64) - Max bandwidth out your cvm will be launched by(in MB).
159+
values can be set between 1 ~ 100.
160+
161+
- `bandwidth_package_id` (string) - When internet_charge_type is BANDWIDTH_PACKAGE, bandwidth_package_id is required
162+
163+
- `security_group_id` (string) - Specify securitygroup your cvm will be launched by.
164+
165+
- `security_group_name` (string) - Specify security name you will create if security_group_id not set.
108166

109167
- `user_data` (string) - userdata.
110168

111169
- `user_data_file` (string) - userdata file.
112170

113171
- `host_name` (string) - host name.
114172

115-
- `run_tags` (map of strings) - Tags to apply to the instance that is _launched_ to create the image.
173+
- `cam_role_name` (string) - CAM role name.
174+
175+
- `run_tags` (map[string]string) - Tags to apply to the instance that is _launched_ to create the image.
116176
These tags are _not_ applied to the resulting image.
117177

118-
- `cvm_endpoint` (string) - The endpoint you want to reach the cloud endpoint,
119-
if tce cloud you should set a tce cvm endpoint.
178+
- `run_tag` ([]{key string, value string}) - Same as [`run_tags`](#run_tags) but defined as a singular repeatable
179+
block containing a `key` and a `value` field. In HCL2 mode the
180+
[`dynamic_block`](/packer/docs/templates/hcl_templates/expressions#dynamic-blocks)
181+
will allow you to create those programatically.
182+
183+
- `ssh_private_ip` (bool) - SSH Private Ip
184+
185+
<!-- End of code generated from the comments of the TencentCloudRunConfig struct in builder/tencentcloud/cvm/run_config.go; -->
120186

121-
- `vpc_endpoint` (string) - The endpoint you want to reach the cloud endpoint,
122-
if tce cloud you should set a tce vpc endpoint.
123187

124188
### Communicator Configuration
125189

0 commit comments

Comments
 (0)