Skip to content

Commit 6b236e4

Browse files
tongyimingmikatong
andauthored
fix: support resource paiallel (#975)
Co-authored-by: mikatong <mikatong@tencent.com>
1 parent 94cdcef commit 6b236e4

9 files changed

+401
-336
lines changed

tencentcloud/basic_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,17 @@ const (
6565
defaultDayuBgpIp = "bgpip-00000294"
6666
defaultDayuNet = "net-0000007e"
6767

68-
defaultGaapProxyId = "link-4yb9g6tb"
68+
defaultGaapProxyId = "link-ljb08m2l"
69+
defaultGaapProxyId2 = "link-8lpyo88p"
70+
defaultGaapSecurityPolicyId = "sp-05t5q92x"
71+
defaultGaapRealserverDomainId1 = "rs-qs0h6wxp"
72+
defaultGaapRealserverDomain1 = "github.com"
73+
defaultGaapRealserverDomainId2 = "rs-qcygnwpd"
74+
defaultGaapRealserverDomain2 = "www.github.com"
75+
defaultGaapRealserverIpId1 = "rs-24e1ol23"
76+
defaultGaapRealserverIp1 = "119.29.29.35"
77+
defaultGaapRealserverIpId2 = "rs-70qzt26p"
78+
defaultGaapRealserverIp2 = "1.1.1.5"
6979

7080
defaultSecurityGroup = "sg-ijato2x1"
7181
defaultSecurityGroup2 = "sg-51rgzop1"

tencentcloud/resource_tc_gaap_domain_error_page_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const testAccGaapDomainErrorPageListenerAndDomain = `
222222
resource tencentcloud_gaap_layer7_listener "foo" {
223223
protocol = "HTTP"
224224
name = "ci-test-gaap-l7-listener"
225-
port = 80
225+
port = "%s"
226226
proxy_id = "%s"
227227
}
228228
@@ -238,7 +238,7 @@ resource tencentcloud_gaap_domain_error_page "foo" {
238238
error_codes = [404, 503]
239239
body = "bad request"
240240
}
241-
`, defaultGaapProxyId)
241+
`, "81", defaultGaapProxyId)
242242

243243
var testAccGaapDomainErrorPageSingleErrorCode = fmt.Sprintf(testAccGaapDomainErrorPageListenerAndDomain+`
244244
resource tencentcloud_gaap_domain_error_page "foo" {
@@ -247,7 +247,7 @@ resource tencentcloud_gaap_domain_error_page "foo" {
247247
error_codes = [400]
248248
body = "bad request"
249249
}
250-
`, defaultGaapProxyId)
250+
`, "82", defaultGaapProxyId)
251251

252252
var testAccGaapDomainErrorPageNewErrorCode = fmt.Sprintf(testAccGaapDomainErrorPageListenerAndDomain+`
253253
resource tencentcloud_gaap_domain_error_page "foo" {
@@ -257,7 +257,7 @@ resource tencentcloud_gaap_domain_error_page "foo" {
257257
body = "bad request"
258258
new_error_code = 501
259259
}
260-
`, defaultGaapProxyId)
260+
`, "83", defaultGaapProxyId)
261261

262262
var testAccGaapDomainErrorPageClearHeaders = fmt.Sprintf(testAccGaapDomainErrorPageListenerAndDomain+`
263263
resource tencentcloud_gaap_domain_error_page "foo" {
@@ -267,7 +267,7 @@ resource tencentcloud_gaap_domain_error_page "foo" {
267267
body = "bad request"
268268
clear_headers = ["Content-Length", "X-TEST"]
269269
}
270-
`, defaultGaapProxyId)
270+
`, "84", defaultGaapProxyId)
271271

272272
var testAccGaapDomainErrorPageSetHeaders = fmt.Sprintf(testAccGaapDomainErrorPageListenerAndDomain+`
273273
resource tencentcloud_gaap_domain_error_page "foo" {
@@ -280,7 +280,7 @@ resource tencentcloud_gaap_domain_error_page "foo" {
280280
"X-TEST" = "test"
281281
}
282282
}
283-
`, defaultGaapProxyId)
283+
`, "85", defaultGaapProxyId)
284284

285285
var testAccGaapDomainErrorPageFull = fmt.Sprintf(testAccGaapDomainErrorPageListenerAndDomain+`
286286
resource tencentcloud_gaap_domain_error_page "foo" {
@@ -295,4 +295,4 @@ resource tencentcloud_gaap_domain_error_page "foo" {
295295
"X-TEST" = "test"
296296
}
297297
}
298-
`, defaultGaapProxyId)
298+
`, "86", defaultGaapProxyId)

tencentcloud/resource_tc_gaap_http_domain_test.go

Lines changed: 56 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func TestAccTencentCloudGaapHttpDomain_httpsRealserverCertificateIds(t *testing.
242242
CheckDestroy: testAccCheckGaapHttpDomainDestroy(id),
243243
Steps: []resource.TestStep{
244244
{
245-
Config: testAccGaapHttpDomainHttpsRsIds,
245+
Config: testAccGaapHttpDomainHttpsRsIds2,
246246
Check: resource.ComposeTestCheckFunc(
247247
testAccCheckGaapHttpDomainExists("tencentcloud_gaap_http_domain.foo", id),
248248
resource.TestCheckResourceAttrSet("tencentcloud_gaap_http_domain.foo", "listener_id"),
@@ -335,7 +335,7 @@ var testAccGaapHttpDomainBasic = fmt.Sprintf(`
335335
resource tencentcloud_gaap_layer7_listener "foo" {
336336
protocol = "HTTP"
337337
name = "ci-test-gaap-l7-listener"
338-
port = 80
338+
port = 7170
339339
proxy_id = "%s"
340340
}
341341
@@ -355,7 +355,7 @@ resource tencentcloud_gaap_certificate "foo" {
355355
resource tencentcloud_gaap_layer7_listener "foo" {
356356
protocol = "HTTPS"
357357
name = "ci-test-gaap-l7-listener"
358-
port = 80
358+
port = 7171
359359
proxy_id = "%s"
360360
certificate_id = tencentcloud_gaap_certificate.foo.id
361361
forward_protocol = "HTTP"
@@ -385,7 +385,7 @@ resource tencentcloud_gaap_certificate "bar" {
385385
resource tencentcloud_gaap_layer7_listener "foo" {
386386
protocol = "HTTPS"
387387
name = "ci-test-gaap-l7-listener"
388-
port = 80
388+
port = 7172
389389
proxy_id = "%s"
390390
certificate_id = tencentcloud_gaap_certificate.foo.id
391391
client_certificate_id = tencentcloud_gaap_certificate.bar.id
@@ -446,7 +446,7 @@ resource tencentcloud_gaap_certificate "gaap" {
446446
resource tencentcloud_gaap_layer7_listener "foo" {
447447
protocol = "HTTPS"
448448
name = "ci-test-gaap-l7-listener"
449-
port = 80
449+
port = 7172
450450
proxy_id = "%s"
451451
certificate_id = tencentcloud_gaap_certificate.foo.id
452452
client_certificate_id = tencentcloud_gaap_certificate.bar.id
@@ -503,7 +503,7 @@ resource tencentcloud_gaap_certificate "client1" {
503503
resource tencentcloud_gaap_layer7_listener "foo" {
504504
protocol = "HTTPS"
505505
name = "ci-test-gaap-l7-listener"
506-
port = 80
506+
port = 7173
507507
proxy_id = "%s"
508508
certificate_id = tencentcloud_gaap_certificate.foo.id
509509
client_certificate_ids = [tencentcloud_gaap_certificate.bar.id]
@@ -550,7 +550,7 @@ resource tencentcloud_gaap_certificate "client3" {
550550
resource tencentcloud_gaap_layer7_listener "foo" {
551551
protocol = "HTTPS"
552552
name = "ci-test-gaap-l7-listener"
553-
port = 80
553+
port = 7173
554554
proxy_id = "%s"
555555
certificate_id = tencentcloud_gaap_certificate.foo.id
556556
client_certificate_ids = [tencentcloud_gaap_certificate.bar.id]
@@ -592,7 +592,7 @@ resource tencentcloud_gaap_certificate "client1" {
592592
resource tencentcloud_gaap_layer7_listener "foo" {
593593
protocol = "HTTPS"
594594
name = "ci-test-gaap-l7-listener"
595-
port = 80
595+
port = 7174
596596
proxy_id = "%s"
597597
certificate_id = tencentcloud_gaap_certificate.foo.id
598598
client_certificate_ids = [tencentcloud_gaap_certificate.bar.id]
@@ -633,7 +633,7 @@ resource tencentcloud_gaap_certificate "client1" {
633633
resource tencentcloud_gaap_layer7_listener "foo" {
634634
protocol = "HTTPS"
635635
name = "ci-test-gaap-l7-listener"
636-
port = 80
636+
port = 7174
637637
proxy_id = "%s"
638638
certificate_id = tencentcloud_gaap_certificate.foo.id
639639
client_certificate_ids = [tencentcloud_gaap_certificate.bar.id]
@@ -674,7 +674,7 @@ resource tencentcloud_gaap_certificate "realserver1" {
674674
resource tencentcloud_gaap_layer7_listener "foo" {
675675
protocol = "HTTPS"
676676
name = "ci-test-gaap-l7-listener"
677-
port = 80
677+
port = 7176
678678
proxy_id = "%s"
679679
certificate_id = tencentcloud_gaap_certificate.foo.id
680680
client_certificate_id = tencentcloud_gaap_certificate.bar.id
@@ -696,6 +696,50 @@ resource tencentcloud_gaap_http_domain "foo" {
696696
defaultGaapProxyId,
697697
)
698698

699+
var testAccGaapHttpDomainHttpsRsIds2 = fmt.Sprintf(`
700+
resource tencentcloud_gaap_certificate "foo" {
701+
type = "SERVER"
702+
content = %s
703+
key = %s
704+
}
705+
706+
resource tencentcloud_gaap_certificate "bar" {
707+
type = "CLIENT"
708+
content = %s
709+
key = %s
710+
}
711+
712+
resource tencentcloud_gaap_certificate "realserver1" {
713+
type = "REALSERVER"
714+
content = %s
715+
key = %s
716+
}
717+
718+
resource tencentcloud_gaap_layer7_listener "foo" {
719+
protocol = "HTTPS"
720+
name = "ci-test-gaap-l7-listener"
721+
port = 7177
722+
proxy_id = "%s"
723+
certificate_id = tencentcloud_gaap_certificate.foo.id
724+
client_certificate_id = tencentcloud_gaap_certificate.bar.id
725+
forward_protocol = "HTTPS"
726+
auth_type = 1
727+
}
728+
729+
resource tencentcloud_gaap_http_domain "foo" {
730+
listener_id = tencentcloud_gaap_layer7_listener.foo.id
731+
domain = "www.qq.com"
732+
733+
realserver_auth = true
734+
realserver_certificate_ids = [tencentcloud_gaap_certificate.realserver1.id]
735+
realserver_certificate_domain = "qq.com"
736+
}
737+
`, "<<EOF"+testAccGaapCertificateServerCert+"EOF", "<<EOF"+testAccGaapCertificateServerKey+"EOF",
738+
"<<EOF"+testAccGaapCertificateClientCA+"EOF", "<<EOF"+testAccGaapCertificateClientCAKey+"EOF",
739+
"<<EOF"+testAccGaapCertificateClientCA+"EOF", "<<EOF"+testAccGaapCertificateClientCAKey+"EOF",
740+
defaultGaapProxyId,
741+
)
742+
699743
var testAccGaapHttpDomainHttpsRsIds = fmt.Sprintf(`
700744
resource tencentcloud_gaap_certificate "foo" {
701745
type = "SERVER"
@@ -718,7 +762,7 @@ resource tencentcloud_gaap_certificate "realserver1" {
718762
resource tencentcloud_gaap_layer7_listener "foo" {
719763
protocol = "HTTPS"
720764
name = "ci-test-gaap-l7-listener"
721-
port = 80
765+
port = 7176
722766
proxy_id = "%s"
723767
certificate_id = tencentcloud_gaap_certificate.foo.id
724768
client_certificate_id = tencentcloud_gaap_certificate.bar.id
@@ -768,7 +812,7 @@ resource tencentcloud_gaap_certificate "realserver2" {
768812
resource tencentcloud_gaap_layer7_listener "foo" {
769813
protocol = "HTTPS"
770814
name = "ci-test-gaap-l7-listener"
771-
port = 80
815+
port = 7177
772816
proxy_id = "%s"
773817
certificate_id = tencentcloud_gaap_certificate.foo.id
774818
client_certificate_id = tencentcloud_gaap_certificate.bar.id

0 commit comments

Comments
 (0)