diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fdb2f97..906595e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 1.12.1 (Dec 14, 2023) + +IMPROVEMENTS: + +- `ksyun_healthcheck` 新增`health_check_connect_port`健康检查端口 +- `ksyun_alb_listener` 新增`config_content` 个性化配置 + ## 1.12.0 (Dec 7, 2023) FEATURES: diff --git a/ksyun/resource_ksyun_alb_listener.go b/ksyun/resource_ksyun_alb_listener.go index 06704320..c45d379d 100644 --- a/ksyun/resource_ksyun_alb_listener.go +++ b/ksyun/resource_ksyun_alb_listener.go @@ -288,7 +288,14 @@ func resourceKsyunAlbListener() *schema.Resource { }, }, - // TODO: 个性化配置 + "config_content": { + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "The custom configure for listener. [The details](https://docs.ksyun.com/documents/42615?type=3).", + }, "alb_listener_id": { Type: schema.TypeString, diff --git a/ksyun/resource_ksyun_healthcheck.go b/ksyun/resource_ksyun_healthcheck.go index 4f0f7776..80174c8f 100644 --- a/ksyun/resource_ksyun_healthcheck.go +++ b/ksyun/resource_ksyun_healthcheck.go @@ -62,6 +62,13 @@ func resourceKsyunHealthCheck() *schema.Resource { Default: "start", Description: "Status maintained by health examination.Valid Values:'start', 'stop'.", }, + + "health_check_connect_port": { + Type: schema.TypeInt, + Optional: true, + Description: "The port of connecting for health check.", + }, + "healthy_threshold": { Type: schema.TypeInt, Optional: true, diff --git a/ksyun/service_ksyun_alb_listener.go b/ksyun/service_ksyun_alb_listener.go index ddd62dd0..6a5e841b 100644 --- a/ksyun/service_ksyun_alb_listener.go +++ b/ksyun/service_ksyun_alb_listener.go @@ -29,6 +29,9 @@ func (s *AlbListenerService) createListenerCall(d *schema.ResourceData, r *schem "default_forward_rule": { Type: TransformListUnique, }, + "config_content": { + Ignore: true, + }, } req, err := SdkRequestAutoMapping(d, r, false, transform, nil, SdkReqParameter{ onlyTransform: false, @@ -54,6 +57,18 @@ func (s *AlbListenerService) createListenerCall(d *schema.ResourceData, r *schem req["SessionState"] = "stop" } + // deal with custom configure + if v, ok := d.GetOk("config_content"); ok { + vals := v.(map[string]interface{}) + var content string + for key, property := range vals { + kv := strings.Join([]string{key, property.(string)}, " ") + + content += kv + ";" + } + req["ConfigContent"] = content + } + callback = ApiCall{ param: &req, action: "CreateAlbListener", @@ -145,6 +160,27 @@ func (s *AlbListenerService) ReadAndSetListener(d *schema.ResourceData, r *schem if err != nil { return err } + + // extract out of config content + if vs, ok := data["ConfigContent"]; ok { + content := vs.(string) + kvs := strings.Split(content, ";") + + m := make(map[string]interface{}) + + for _, kv := range kvs { + kv = strings.TrimSpace(kv) + kvSlice := strings.Split(kv, " ") + if len(kvSlice) < 2 { + continue + } + m[kvSlice[0]] = kvSlice[1] + } + _ = d.Set("config_content", m) + + delete(data, "ConfigContent") + } + extra := map[string]SdkResponseMapping{ "Session": { Field: "session", @@ -210,6 +246,9 @@ func (s *AlbListenerService) modifyListenerCall(d *schema.ResourceData, r *schem "session": { Type: TransformListUnique, }, + "config_content": { + Ignore: true, + }, } req, err := SdkRequestAutoMapping(d, r, true, transform, nil, SdkReqParameter{ onlyTransform: false, @@ -240,6 +279,19 @@ func (s *AlbListenerService) modifyListenerCall(d *schema.ResourceData, r *schem } } + // deal with custom configure + if d.HasChange("config_content") { + v := d.Get("config_content") + vals := v.(map[string]interface{}) + var content string + for key, property := range vals { + kv := strings.Join([]string{key, property.(string)}, " ") + + content += kv + ";" + } + req["ConfigContent"] = content + } + if len(req) > 0 { req["AlbListenerId"] = d.Id() callback = ApiCall{ diff --git a/website/docs/r/alb_backend_server_group.html.markdown b/website/docs/r/alb_backend_server_group.html.markdown index 1e2a8559..9497526b 100644 --- a/website/docs/r/alb_backend_server_group.html.markdown +++ b/website/docs/r/alb_backend_server_group.html.markdown @@ -41,6 +41,7 @@ The following arguments are supported: The `health_check` object supports the following: +* `health_check_connect_port` - (Optional) The port of connecting for health check. * `health_check_state` - (Optional) Status maintained by health examination.Valid Values:'start', 'stop'. * `healthy_threshold` - (Optional) Health threshold.Valid Values:1-10. Default is 5. * `host_name` - (Optional) hostname of the health check. diff --git a/website/docs/r/alb_listener.html.markdown b/website/docs/r/alb_listener.html.markdown index 4ed32aad..314c6f23 100644 --- a/website/docs/r/alb_listener.html.markdown +++ b/website/docs/r/alb_listener.html.markdown @@ -102,6 +102,7 @@ The following arguments are supported: * `alb_listener_name` - (Optional) The name of the listener. * `alb_listener_state` - (Optional) The state of listener.Valid Values:'start', 'stop'. * `certificate_id` - (Optional) The ID of certificate. +* `config_content` - (Optional) The custom configure for listener. [The details](https://docs.ksyun.com/documents/42615?type=3). * `default_forward_rule` - (Optional) The default forward rule group. * `enable_http2` - (Optional) whether enable to HTTP2. * `http_protocol` - (Optional) Backend Protocol, valid values:'HTTP1.0','HTTP1.1'. diff --git a/website/docs/r/healthcheck.html.markdown b/website/docs/r/healthcheck.html.markdown index b0646b3b..c321232f 100644 --- a/website/docs/r/healthcheck.html.markdown +++ b/website/docs/r/healthcheck.html.markdown @@ -34,6 +34,7 @@ resource "ksyun_healthcheck" "default" { The following arguments are supported: * `listener_id` - (Required, ForceNew) The id of the listener. +* `health_check_connect_port` - (Optional) The port of connecting for health check. * `health_check_state` - (Optional) Status maintained by health examination.Valid Values:'start', 'stop'. * `healthy_threshold` - (Optional) Health threshold.Valid Values:1-10. Default is 5. * `host_name` - (Optional) The service host name of the health check, which is available only for the HTTP or HTTPS health check. diff --git a/website/docs/r/lb_backend_server_group.html.markdown b/website/docs/r/lb_backend_server_group.html.markdown index be58f280..7724dafd 100644 --- a/website/docs/r/lb_backend_server_group.html.markdown +++ b/website/docs/r/lb_backend_server_group.html.markdown @@ -34,6 +34,7 @@ The following arguments are supported: The `health_check` object supports the following: +* `health_check_connect_port` - (Optional) The port of connecting for health check. * `health_check_state` - (Optional) Status maintained by health examination.Valid Values:'start', 'stop'. * `healthy_threshold` - (Optional) Health threshold.Valid Values:1-10. Default is 5. * `host_name` - (Optional) hostname of the health check. diff --git a/website/docs/r/lb_listener.html.markdown b/website/docs/r/lb_listener.html.markdown index 0ba399b4..76e1d3ff 100644 --- a/website/docs/r/lb_listener.html.markdown +++ b/website/docs/r/lb_listener.html.markdown @@ -60,6 +60,7 @@ The following arguments are supported: The `health_check` object supports the following: +* `health_check_connect_port` - (Optional) The port of connecting for health check. * `health_check_state` - (Optional) Status maintained by health examination.Valid Values:'start', 'stop'. * `healthy_threshold` - (Optional) Health threshold.Valid Values:1-10. Default is 5. * `host_name` - (Optional) The service host name of the health check, which is available only for the HTTP or HTTPS health check. diff --git a/website/docs/r/lb_rule.html.markdown b/website/docs/r/lb_rule.html.markdown index 228faf5d..1db11631 100644 --- a/website/docs/r/lb_rule.html.markdown +++ b/website/docs/r/lb_rule.html.markdown @@ -54,6 +54,7 @@ The following arguments are supported: The `health_check` object supports the following: +* `health_check_connect_port` - (Optional) The port of connecting for health check. * `health_check_state` - (Optional) Status maintained by health examination.Valid Values:'start', 'stop'. * `healthy_threshold` - (Optional) Health threshold.Valid Values:1-10. Default is 5. * `host_name` - (Optional) The service host name of the health check, which is available only for the HTTP or HTTPS health check.