@@ -13,6 +13,7 @@ import (
1313
1414 "github.com/hashicorp/packer-plugin-sdk/template/interpolate"
1515 cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
16+ tag "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag/v20180813"
1617 vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312"
1718)
1819
@@ -81,6 +82,9 @@ type TencentCloudAccessConfig struct {
8182 // The endpoint you want to reach the cloud endpoint,
8283 // if tce cloud you should set a tce vpc endpoint.
8384 VpcEndpoint string `mapstructure:"vpc_endpoint" required:"false"`
85+ // The endpoint you want to reach the cloud endpoint,
86+ // if tce cloud you should set a tce tag endpoint.
87+ TagEndpoint string `mapstructure:"tag_endpoint" required:"false"`
8488 // The region validation can be skipped if this value is true, the default
8589 // value is false.
8690 skipValidation bool
@@ -121,26 +125,31 @@ type TencentCloudAccessRole struct {
121125 SessionDuration int `mapstructure:"session_duration" required:"false"`
122126}
123127
124- func (cf * TencentCloudAccessConfig ) Client () (* cvm.Client , * vpc.Client , error ) {
128+ func (cf * TencentCloudAccessConfig ) Client () (* cvm.Client , * vpc.Client , * tag. Client , error ) {
125129 var (
126130 err error
127131 cvm_client * cvm.Client
128132 vpc_client * vpc.Client
133+ tag_client * tag.Client
129134 )
130135
131136 if err = cf .validateRegion (); err != nil {
132- return nil , nil , err
137+ return nil , nil , nil , err
133138 }
134139
135140 if cvm_client , err = NewCvmClient (cf ); err != nil {
136- return nil , nil , err
141+ return nil , nil , nil , err
137142 }
138143
139144 if vpc_client , err = NewVpcClient (cf ); err != nil {
140- return nil , nil , err
145+ return nil , nil , nil , err
146+ }
147+
148+ if tag_client , err = NewTagClient (cf ); err != nil {
149+ return nil , nil , nil , err
141150 }
142151
143- return cvm_client , vpc_client , nil
152+ return cvm_client , vpc_client , tag_client , nil
144153}
145154
146155func (cf * TencentCloudAccessConfig ) Prepare (ctx * interpolate.Context ) []error {
@@ -150,9 +159,8 @@ func (cf *TencentCloudAccessConfig) Prepare(ctx *interpolate.Context) []error {
150159 errs = append (errs , err )
151160 }
152161
153- if (cf .CvmEndpoint != "" && cf .VpcEndpoint == "" ) ||
154- (cf .CvmEndpoint == "" && cf .VpcEndpoint != "" ) {
155- errs = append (errs , fmt .Errorf ("parameter cvm_endpoint and vpc_endpoint must be set simultaneously" ))
162+ if cf .CvmEndpoint == "" || cf .VpcEndpoint == "" || cf .TagEndpoint == "" {
163+ errs = append (errs , fmt .Errorf ("parameter cvm_endpoint, vpc_endpoint and tag_endpoint must be set simultaneously" ))
156164 }
157165
158166 if cf .Region == "" {
0 commit comments