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

resource/cloudflare_load_balancer_monitor: Fix incorrect type cast for port #213

Merged
merged 3 commits into from
Feb 24, 2019
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
9 changes: 5 additions & 4 deletions cloudflare/resource_cloudflare_load_balancer_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ func resourceCloudflareLoadBalancerMonitor() *schema.Resource {
},

"port": {
Type: schema.TypeInt,
Optional: true,
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(0, 65535),
},

"created_on": {
Expand Down Expand Up @@ -143,7 +144,7 @@ func resourceCloudflareLoadBalancerPoolMonitorCreate(d *schema.ResourceData, met
}

if port, ok := d.GetOk("port"); ok {
loadBalancerMonitor.Port = port.(uint16)
loadBalancerMonitor.Port = uint16(port.(int))
}

log.Printf("[DEBUG] Creating Cloudflare Load Balancer Monitor from struct: %+v", loadBalancerMonitor)
Expand Down Expand Up @@ -188,7 +189,7 @@ func resourceCloudflareLoadBalancerPoolMonitorUpdate(d *schema.ResourceData, met
}

if port, ok := d.GetOk("port"); ok {
loadBalancerMonitor.Port = port.(uint16)
loadBalancerMonitor.Port = uint16(port.(int))
}

log.Printf("[DEBUG] Update Cloudflare Load Balancer Monitor from struct: %+v", loadBalancerMonitor)
Expand Down
4 changes: 1 addition & 3 deletions cloudflare/resource_cloudflare_record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ package cloudflare
import (
"fmt"
"os"
"regexp"
"testing"

"time"

"regexp"

"github.com/cloudflare/cloudflare-go"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down