@@ -13,6 +13,7 @@ import (
13
13
14
14
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
15
15
cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
16
+ tag "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag/v20180813"
16
17
vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312"
17
18
)
18
19
@@ -81,6 +82,9 @@ type TencentCloudAccessConfig struct {
81
82
// The endpoint you want to reach the cloud endpoint,
82
83
// if tce cloud you should set a tce vpc endpoint.
83
84
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"`
84
88
// The region validation can be skipped if this value is true, the default
85
89
// value is false.
86
90
skipValidation bool
@@ -121,26 +125,31 @@ type TencentCloudAccessRole struct {
121
125
SessionDuration int `mapstructure:"session_duration" required:"false"`
122
126
}
123
127
124
- func (cf * TencentCloudAccessConfig ) Client () (* cvm.Client , * vpc.Client , error ) {
128
+ func (cf * TencentCloudAccessConfig ) Client () (* cvm.Client , * vpc.Client , * tag. Client , error ) {
125
129
var (
126
130
err error
127
131
cvm_client * cvm.Client
128
132
vpc_client * vpc.Client
133
+ tag_client * tag.Client
129
134
)
130
135
131
136
if err = cf .validateRegion (); err != nil {
132
- return nil , nil , err
137
+ return nil , nil , nil , err
133
138
}
134
139
135
140
if cvm_client , err = NewCvmClient (cf ); err != nil {
136
- return nil , nil , err
141
+ return nil , nil , nil , err
137
142
}
138
143
139
144
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
141
150
}
142
151
143
- return cvm_client , vpc_client , nil
152
+ return cvm_client , vpc_client , tag_client , nil
144
153
}
145
154
146
155
func (cf * TencentCloudAccessConfig ) Prepare (ctx * interpolate.Context ) []error {
@@ -150,9 +159,8 @@ func (cf *TencentCloudAccessConfig) Prepare(ctx *interpolate.Context) []error {
150
159
errs = append (errs , err )
151
160
}
152
161
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" ))
156
164
}
157
165
158
166
if cf .Region == "" {
0 commit comments