@@ -36,6 +36,15 @@ func TestAccTencentCloudClbServerAttachment_tcp(t *testing.T) {
36
36
resource .TestCheckResourceAttr ("tencentcloud_clb_attachment.foo" , "protocol_type" , "TCP" ),
37
37
resource .TestCheckResourceAttr ("tencentcloud_clb_attachment.foo" , "targets.#" , "1" ),
38
38
),
39
+ }, {
40
+ Config : testAccClbServerAttachment_tcp_update_ssl ,
41
+ Check : resource .ComposeTestCheckFunc (
42
+ testAccCheckClbServerAttachmentExists ("tencentcloud_clb_attachment.foo" ),
43
+ resource .TestCheckResourceAttrSet ("tencentcloud_clb_attachment.foo" , "clb_id" ),
44
+ resource .TestCheckResourceAttrSet ("tencentcloud_clb_attachment.foo" , "listener_id" ),
45
+ resource .TestCheckResourceAttr ("tencentcloud_clb_attachment.foo" , "protocol_type" , "TCP_SSL" ),
46
+ resource .TestCheckResourceAttr ("tencentcloud_clb_attachment.foo" , "targets.#" , "1" ),
47
+ ),
39
48
},
40
49
},
41
50
})
@@ -154,6 +163,10 @@ func testAccCheckClbServerAttachmentExists(n string) resource.TestCheckFunc {
154
163
}
155
164
156
165
const testAccClbServerAttachment_tcp = instanceCommonTestCase + `
166
+ data "tencentcloud_ssl_certificates" "foo" {
167
+ name = "keep"
168
+ }
169
+
157
170
resource "tencentcloud_clb_instance" "foo" {
158
171
network_type = "OPEN"
159
172
clb_name = "tf-clb-attach-tcp-test"
@@ -187,6 +200,10 @@ resource "tencentcloud_clb_attachment" "foo" {
187
200
`
188
201
189
202
const testAccClbServerAttachment_tcp_update = instanceCommonTestCase + `
203
+ data "tencentcloud_ssl_certificates" "foo" {
204
+ name = "keep"
205
+ }
206
+
190
207
resource "tencentcloud_clb_instance" "foo" {
191
208
network_type = "OPEN"
192
209
clb_name = "tf-clb-attach-tcp-test"
@@ -219,6 +236,41 @@ resource "tencentcloud_clb_attachment" "foo" {
219
236
}
220
237
`
221
238
239
+ const testAccClbServerAttachment_tcp_update_ssl = instanceCommonTestCase + `
240
+ data "tencentcloud_ssl_certificates" "foo" {
241
+ name = "keep"
242
+ }
243
+
244
+ resource "tencentcloud_clb_instance" "foo" {
245
+ network_type = "OPEN"
246
+ clb_name = "tf-clb-attach-tcp-ssl"
247
+ vpc_id = var.cvm_vpc_id
248
+ }
249
+
250
+ # This is will force new as expected
251
+ resource "tencentcloud_clb_listener" "foo" {
252
+ clb_id = tencentcloud_clb_instance.foo.id
253
+ listener_name = "tf-clb-attach-tcp-ssl"
254
+ port = 44
255
+ protocol = "TCP_SSL"
256
+ health_check_switch = true
257
+ scheduler = "WRR"
258
+ certificate_ssl_mode = "UNIDIRECTIONAL"
259
+ certificate_id = data.tencentcloud_ssl_certificates.foo.certificates.0.id
260
+ }
261
+
262
+ resource "tencentcloud_clb_attachment" "foo" {
263
+ clb_id = tencentcloud_clb_instance.foo.id
264
+ listener_id = tencentcloud_clb_listener.foo.listener_id
265
+
266
+ targets {
267
+ instance_id = tencentcloud_instance.default.id
268
+ port = 23
269
+ weight = 50
270
+ }
271
+ }
272
+ `
273
+
222
274
const testAccClbServerAttachment_http = instanceCommonTestCase + `
223
275
resource "tencentcloud_clb_instance" "foo" {
224
276
network_type = "OPEN"
0 commit comments