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

PLT-1391: use tenant scope for PCG IP pools #515

Merged
merged 6 commits into from
Sep 21, 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
4 changes: 2 additions & 2 deletions docs/resources/privatecloudgateway_ippool.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ An example of creating an IP Pool for a Private Cloud Gateway using a range of I
private_cloud_gateway_id = data.spectrocloud_private_cloud_gateway.pcg.id
ip_start_range = "192.168.1.10"
ip_end_range = "192.168.1.100"
nameserver_addresses = "192.168.1.8"
nameserver_addresses = ["192.168.1.8"]
restrict_to_single_cluster = true
}
```
Expand All @@ -48,7 +48,7 @@ An example of creating an IP Pool for a Private Cloud Gateway using a subnet of
prefix = "24"
subnet_cidr = "10.10.100.0/24"
private_cloud_gateway_id = data.spectrocloud_private_cloud_gateway.pcg.id
nameserver_addresses = "192.168.1.8"
nameserver_addresses = ["192.168.1.8"]
}
```

Expand Down
9 changes: 5 additions & 4 deletions spectrocloud/resource_pcg_ippool.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

"github.com/spectrocloud/palette-sdk-go/api/models"
)

Expand Down Expand Up @@ -100,7 +101,7 @@ func resourcePrivateCloudGatewayIpPool() *schema.Resource {
}

func resourceIpPoolCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
c := getV1ClientWithResourceContext(m, "")
c := getV1ClientWithResourceContext(m, "tenant")
var diags diag.Diagnostics
pcgUID := d.Get("private_cloud_gateway_id").(string)

Expand All @@ -116,7 +117,7 @@ func resourceIpPoolCreate(ctx context.Context, d *schema.ResourceData, m interfa
}

func resourceIpPoolRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
c := getV1ClientWithResourceContext(m, "")
c := getV1ClientWithResourceContext(m, "tenant")
var diags diag.Diagnostics

pcgUID := d.Get("private_cloud_gateway_id").(string)
Expand Down Expand Up @@ -170,7 +171,7 @@ func resourceIpPoolRead(ctx context.Context, d *schema.ResourceData, m interface
}

func resourceIpPoolUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
c := getV1ClientWithResourceContext(m, "")
c := getV1ClientWithResourceContext(m, "tenant")
var diags diag.Diagnostics

pcgUID := d.Get("private_cloud_gateway_id").(string)
Expand All @@ -186,7 +187,7 @@ func resourceIpPoolUpdate(ctx context.Context, d *schema.ResourceData, m interfa
}

func resourceIpPoolDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
c := getV1ClientWithResourceContext(m, "")
c := getV1ClientWithResourceContext(m, "tenant")
var diags diag.Diagnostics

pcgUID := d.Get("private_cloud_gateway_id").(string)
Expand Down
4 changes: 2 additions & 2 deletions templates/resources/privatecloudgateway_ippool.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ An example of creating an IP Pool for a Private Cloud Gateway using a range of I
private_cloud_gateway_id = data.spectrocloud_private_cloud_gateway.pcg.id
ip_start_range = "192.168.1.10"
ip_end_range = "192.168.1.100"
nameserver_addresses = "192.168.1.8"
nameserver_addresses = ["192.168.1.8"]
restrict_to_single_cluster = true
}
```
Expand All @@ -48,7 +48,7 @@ An example of creating an IP Pool for a Private Cloud Gateway using a subnet of
prefix = "24"
subnet_cidr = "10.10.100.0/24"
private_cloud_gateway_id = data.spectrocloud_private_cloud_gateway.pcg.id
nameserver_addresses = "192.168.1.8"
nameserver_addresses = ["192.168.1.8"]
}
```

Expand Down
Loading