Skip to content
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

slb: set health_check_connect_port as ForceNew since there is no way to change it to backend port #8

Merged
merged 1 commit into from
Jan 16, 2024
Merged
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
10 changes: 5 additions & 5 deletions alicloud/resource_alicloud_slb_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,10 @@ func resourceAliyunSlbListener() *schema.Resource {
DiffSuppressFunc: httpHttpsTcpDiffSuppressFunc,
},
"health_check_connect_port": {
Type: schema.TypeInt,
ValidateFunc: validation.Any(
validation.IntBetween(0, 65535),
validation.IntInSlice([]int{-520})),
Type: schema.TypeInt,
ValidateFunc: validation.IntBetween(1, 65535),
Optional: true,
Computed: true,
ForceNew: true,
DiffSuppressFunc: healthCheckDiffSuppressFunc,
},
"healthy_threshold": {
Expand Down Expand Up @@ -654,6 +652,8 @@ func resourceAliyunSlbListenerUpdate(d *schema.ResourceData, meta interface{}) e
commonRequest.QueryParams["HealthCheckInterval"] = string(requests.NewInteger(d.Get("health_check_interval").(int)))
update = true
}
// SetXXXListenerAttribute can't change health_check_connect_port to backend port, so it's configured as ForceNew
// but we rely on Update to change it from backend port to specified port during Create
if d.HasChange("health_check_connect_port") {
if port, ok := d.GetOk("health_check_connect_port"); ok {
httpArgs.QueryParams["HealthCheckConnectPort"] = string(requests.NewInteger(port.(int)))
Expand Down
Loading