@@ -36,6 +36,15 @@ func TestAccTencentCloudClbServerAttachment_tcp(t *testing.T) {
3636 resource .TestCheckResourceAttr ("tencentcloud_clb_attachment.foo" , "protocol_type" , "TCP" ),
3737 resource .TestCheckResourceAttr ("tencentcloud_clb_attachment.foo" , "targets.#" , "1" ),
3838 ),
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+ ),
3948 },
4049 },
4150 })
@@ -154,6 +163,10 @@ func testAccCheckClbServerAttachmentExists(n string) resource.TestCheckFunc {
154163}
155164
156165const testAccClbServerAttachment_tcp = instanceCommonTestCase + `
166+ data "tencentcloud_ssl_certificates" "foo" {
167+ name = "keep"
168+ }
169+
157170resource "tencentcloud_clb_instance" "foo" {
158171 network_type = "OPEN"
159172 clb_name = "tf-clb-attach-tcp-test"
@@ -187,6 +200,10 @@ resource "tencentcloud_clb_attachment" "foo" {
187200`
188201
189202const testAccClbServerAttachment_tcp_update = instanceCommonTestCase + `
203+ data "tencentcloud_ssl_certificates" "foo" {
204+ name = "keep"
205+ }
206+
190207resource "tencentcloud_clb_instance" "foo" {
191208 network_type = "OPEN"
192209 clb_name = "tf-clb-attach-tcp-test"
@@ -219,6 +236,41 @@ resource "tencentcloud_clb_attachment" "foo" {
219236}
220237`
221238
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+
222274const testAccClbServerAttachment_http = instanceCommonTestCase + `
223275resource "tencentcloud_clb_instance" "foo" {
224276 network_type = "OPEN"
0 commit comments