Skip to content

Commit 71847d2

Browse files
authored
fix(teo): [118016440] support ipv6 (#2685)
* fix(teo): [118016440] support ipv6 * feat: add changelog * fix: support ipv6
1 parent 4ae3b2d commit 71847d2

File tree

5 files changed

+137
-27
lines changed

5 files changed

+137
-27
lines changed

.changelog/2685.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_teo_acceleration_domain: Add `origin_protocol`, `http_origin_port`, `https_origin_port` and `ipv6_status` fields
3+
```

tencentcloud/services/teo/resource_tc_teo_acceleration_domain.go

Lines changed: 93 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tencentcloud/services/teo/resource_tc_teo_acceleration_domain_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,31 @@ func TestAccTencentCloudTeoAccelerationDomainResource_basic(t *testing.T) {
3131
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_info.0.origin", "150.109.8.1"),
3232
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_info.0.origin_type", "IP_DOMAIN"),
3333
resource.TestCheckResourceAttrSet("tencentcloud_teo_acceleration_domain.acceleration_domain", "cname"),
34+
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_protocol", "FOLLOW"),
35+
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "http_origin_port", "80"),
36+
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "https_origin_port", "443"),
37+
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "ipv6_status", "follow"),
3438
),
3539
},
3640
{
3741
ResourceName: "tencentcloud_teo_acceleration_domain.acceleration_domain",
3842
ImportState: true,
3943
ImportStateVerify: true,
4044
},
45+
{
46+
Config: testAccTeoAccelerationDomainUp,
47+
Check: resource.ComposeTestCheckFunc(
48+
testAccCheckTeoAccelerationDomainExists("tencentcloud_teo_acceleration_domain.acceleration_domain"),
49+
resource.TestCheckResourceAttrSet("tencentcloud_teo_acceleration_domain.acceleration_domain", "id"),
50+
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "domain_name", "test.tf-teo.xyz"),
51+
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_info.#", "1"),
52+
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_info.0.origin", "150.109.8.1"),
53+
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_info.0.origin_type", "IP_DOMAIN"),
54+
resource.TestCheckResourceAttrSet("tencentcloud_teo_acceleration_domain.acceleration_domain", "cname"),
55+
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_protocol", "HTTP"),
56+
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "http_origin_port", "81"),
57+
),
58+
},
4159
},
4260
})
4361
}
@@ -120,3 +138,19 @@ resource "tencentcloud_teo_acceleration_domain" "acceleration_domain" {
120138
}
121139
122140
`
141+
142+
const testAccTeoAccelerationDomainUp = testAccTeoZone + `
143+
144+
resource "tencentcloud_teo_acceleration_domain" "acceleration_domain" {
145+
zone_id = tencentcloud_teo_zone.basic.id
146+
domain_name = "test.tf-teo.xyz"
147+
148+
origin_info {
149+
origin = "150.109.8.1"
150+
origin_type = "IP_DOMAIN"
151+
}
152+
origin_protocol = "HTTP"
153+
http_origin_port = 81
154+
}
155+
156+
`

tencentcloud/services/teo/service_tencentcloud_teo.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,10 +688,10 @@ func (me *TeoService) DescribeTeoAccelerationDomainById(ctx context.Context, zon
688688
logId := tccommon.GetLogId(ctx)
689689

690690
request := teo.NewDescribeAccelerationDomainsRequest()
691-
request.ZoneId = &zoneId
691+
request.ZoneId = helper.String(zoneId)
692692
advancedFilter := &teo.AdvancedFilter{
693693
Name: helper.String("domain-name"),
694-
Values: []*string{&domainName},
694+
Values: []*string{helper.String(domainName)},
695695
}
696696
request.Filters = append(request.Filters, advancedFilter)
697697

@@ -732,6 +732,7 @@ func (me *TeoService) DescribeTeoAccelerationDomainById(ctx context.Context, zon
732732
if len(instances) < 1 {
733733
return
734734
}
735+
735736
ret = instances[0]
736737
return
737738
}

website/docs/r/teo_acceleration_domain.html.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ The following arguments are supported:
3232
* `domain_name` - (Required, String, ForceNew) Accelerated domain name.
3333
* `origin_info` - (Required, List) Details of the origin.
3434
* `zone_id` - (Required, String, ForceNew) ID of the site related with the accelerated domain name.
35+
* `http_origin_port` - (Optional, Int) HTTP back-to-origin port, the value is 1-65535, effective when OriginProtocol=FOLLOW/HTTP, if not filled in, the default value is 80.
36+
* `https_origin_port` - (Optional, Int) HTTPS back-to-origin port. The value range is 1-65535. It takes effect when OriginProtocol=FOLLOW/HTTPS. If it is not filled in, the default value is 443.
37+
* `ipv6_status` - (Optional, String) IPv6 status, the value is: `follow`: follow the site IPv6 configuration; `on`: on; `off`: off. If not filled in, the default is: `follow`.
38+
* `origin_protocol` - (Optional, String) Origin return protocol, possible values are: `FOLLOW`: protocol follow; `HTTP`: HTTP protocol back to source; `HTTPS`: HTTPS protocol back to source. If not filled in, the default is: `FOLLOW`.
3539
* `status` - (Optional, String) Accelerated domain name status, the values are: `online`: enabled; `offline`: disabled.
3640

3741
The `origin_info` object supports the following:

0 commit comments

Comments
 (0)