Skip to content

Commit 4c03d82

Browse files
author
mikatong
committed
update doc
1 parent 23f5b18 commit 4c03d82

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ a [communicator](/packer/docs/templates/legacy_json_templates/communicator) can
104104

105105
- `image_tags` (map[string]string) - Key/value pair tags that will be applied to the resulting image.
106106

107-
- `snapshot_tags` (map[string]string) - Snapshot Tags
107+
- `snapshot_tags` (map[string]string) - Key/value pair tags that will be applied to snapshot.
108108

109109
- `skip_create_image` (bool) - Skip creating an image. When set to true, you don't need to enter target image information, share, copy, etc. The default value is false.
110110

builder/tencentcloud/cvm/image_config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ type TencentCloudImageConfig struct {
3131
// after your image created.
3232
ImageShareAccounts []string `mapstructure:"image_share_accounts" required:"false"`
3333
// Key/value pair tags that will be applied to the resulting image.
34-
ImageTags map[string]string `mapstructure:"image_tags" required:"false"`
34+
ImageTags map[string]string `mapstructure:"image_tags" required:"false"`
35+
// Key/value pair tags that will be applied to snapshot.
3536
SnapshotTags map[string]string `mapstructure:"snapshot_tags" required:"false"`
3637
skipValidation bool
3738
// Skip creating an image. When set to true, you don't need to enter target image information, share, copy, etc. The default value is false.

builder/tencentcloud/cvm/step_create_image.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,14 @@ func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) mul
111111
snapshotTags := config.SnapshotTags
112112
if len(snapshotTags) > 0 {
113113
for _, snapshot := range image.SnapshotSet {
114+
if snapshot == nil || snapshot.SnapshotId == nil {
115+
return Halt(state, err, "snapshot or snapshotId is nil")
116+
}
114117
resourceName := BuildTagResourceName("cvm", "snapshot", config.Region, *snapshot.SnapshotId)
115118
err := AddResourceTag(ctx, tagClient, resourceName, snapshotTags)
116-
return Halt(state, err, "Failed to set tag for snapshot")
119+
if err != nil {
120+
return Halt(state, err, fmt.Sprintf("Failed to set tag for snapshot(%s)", *snapshot.SnapshotId))
121+
}
117122
}
118123
}
119124

docs-partials/builder/tencentcloud/cvm/TencentCloudImageConfig-not-required.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
- `image_tags` (map[string]string) - Key/value pair tags that will be applied to the resulting image.
1717

18-
- `snapshot_tags` (map[string]string) - Snapshot Tags
18+
- `snapshot_tags` (map[string]string) - Key/value pair tags that will be applied to snapshot.
1919

2020
- `skip_create_image` (bool) - Skip creating an image. When set to true, you don't need to enter target image information, share, copy, etc. The default value is false.
2121

0 commit comments

Comments
 (0)