Skip to content

fix(teo): [118016440] support ipv6 #2685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/2685.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_teo_acceleration_domain: Add `origin_protocol`, `http_origin_port`, `https_origin_port` and `ipv6_status` fields
```
118 changes: 93 additions & 25 deletions tencentcloud/services/teo/resource_tc_teo_acceleration_domain.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,31 @@ func TestAccTencentCloudTeoAccelerationDomainResource_basic(t *testing.T) {
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_info.0.origin", "150.109.8.1"),
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_info.0.origin_type", "IP_DOMAIN"),
resource.TestCheckResourceAttrSet("tencentcloud_teo_acceleration_domain.acceleration_domain", "cname"),
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_protocol", "FOLLOW"),
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "http_origin_port", "80"),
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "https_origin_port", "443"),
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "ipv6_status", "follow"),
),
},
{
ResourceName: "tencentcloud_teo_acceleration_domain.acceleration_domain",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccTeoAccelerationDomainUp,
Check: resource.ComposeTestCheckFunc(
testAccCheckTeoAccelerationDomainExists("tencentcloud_teo_acceleration_domain.acceleration_domain"),
resource.TestCheckResourceAttrSet("tencentcloud_teo_acceleration_domain.acceleration_domain", "id"),
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "domain_name", "test.tf-teo.xyz"),
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_info.#", "1"),
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_info.0.origin", "150.109.8.1"),
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_info.0.origin_type", "IP_DOMAIN"),
resource.TestCheckResourceAttrSet("tencentcloud_teo_acceleration_domain.acceleration_domain", "cname"),
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "origin_protocol", "HTTP"),
resource.TestCheckResourceAttr("tencentcloud_teo_acceleration_domain.acceleration_domain", "http_origin_port", "81"),
),
},
},
})
}
Expand Down Expand Up @@ -120,3 +138,19 @@ resource "tencentcloud_teo_acceleration_domain" "acceleration_domain" {
}

`

const testAccTeoAccelerationDomainUp = testAccTeoZone + `

resource "tencentcloud_teo_acceleration_domain" "acceleration_domain" {
zone_id = tencentcloud_teo_zone.basic.id
domain_name = "test.tf-teo.xyz"

origin_info {
origin = "150.109.8.1"
origin_type = "IP_DOMAIN"
}
origin_protocol = "HTTP"
http_origin_port = 81
}

`
5 changes: 3 additions & 2 deletions tencentcloud/services/teo/service_tencentcloud_teo.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,10 +688,10 @@ func (me *TeoService) DescribeTeoAccelerationDomainById(ctx context.Context, zon
logId := tccommon.GetLogId(ctx)

request := teo.NewDescribeAccelerationDomainsRequest()
request.ZoneId = &zoneId
request.ZoneId = helper.String(zoneId)
advancedFilter := &teo.AdvancedFilter{
Name: helper.String("domain-name"),
Values: []*string{&domainName},
Values: []*string{helper.String(domainName)},
}
request.Filters = append(request.Filters, advancedFilter)

Expand Down Expand Up @@ -732,6 +732,7 @@ func (me *TeoService) DescribeTeoAccelerationDomainById(ctx context.Context, zon
if len(instances) < 1 {
return
}

ret = instances[0]
return
}
Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/teo_acceleration_domain.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ The following arguments are supported:
* `domain_name` - (Required, String, ForceNew) Accelerated domain name.
* `origin_info` - (Required, List) Details of the origin.
* `zone_id` - (Required, String, ForceNew) ID of the site related with the accelerated domain name.
* `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.
* `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.
* `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`.
* `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`.
* `status` - (Optional, String) Accelerated domain name status, the values are: `online`: enabled; `offline`: disabled.

The `origin_info` object supports the following:
Expand Down
Loading