From 13541e6141881a4114f1d9ff5571b5dde02ef796 Mon Sep 17 00:00:00 2001 From: Tyler Gillson Date: Fri, 13 Sep 2024 06:54:46 -0600 Subject: [PATCH] fix: hard code tenant scope for PCG IP pools Signed-off-by: Tyler Gillson --- docs/resources/privatecloudgateway_ippool.md | 1 - spectrocloud/resource_pcg_ippool.go | 21 ++++---------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/docs/resources/privatecloudgateway_ippool.md b/docs/resources/privatecloudgateway_ippool.md index f77fad81..0c1cdd1e 100644 --- a/docs/resources/privatecloudgateway_ippool.md +++ b/docs/resources/privatecloudgateway_ippool.md @@ -88,7 +88,6 @@ The following example is for creating an IP pool that belongs to a Private Cloud ### Optional -- `context` (String) Specifies cluster context where IP Pool is created. Allowed values are `project` or `tenant`. Defaults to `project`. If the `project` context is specified, the project name will sourced from the provider configuration parameter [`project_name`](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs#schema). - `ip_end_range` (String) The end IP address of the IP pool. Required if `network_type` is `range`. - `ip_start_range` (String) The start IP address of the IP pool. Required if `network_type` is `range`. - `nameserver_addresses` (Set of String) The list of nameserver IP addresses for the IP pool. diff --git a/spectrocloud/resource_pcg_ippool.go b/spectrocloud/resource_pcg_ippool.go index 02d53937..98ffdc77 100644 --- a/spectrocloud/resource_pcg_ippool.go +++ b/spectrocloud/resource_pcg_ippool.go @@ -9,7 +9,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/spectrocloud/palette-sdk-go/api/models" ) @@ -30,14 +29,6 @@ func resourcePrivateCloudGatewayIpPool() *schema.Resource { SchemaVersion: 2, Schema: map[string]*schema.Schema{ - "context": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{"project", "tenant"}, false), - Default: "project", - Description: "Specifies cluster context where IP Pool is created. " + - "Allowed values are `project` or `tenant`. Defaults to `project`. " + PROJECT_NAME_NUANCE, - }, "name": { Type: schema.TypeString, Required: true, @@ -110,8 +101,7 @@ func resourcePrivateCloudGatewayIpPool() *schema.Resource { } func resourceIpPoolCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - resourceContext := d.Get("context").(string) - c := getV1ClientWithResourceContext(m, resourceContext) + c := getV1ClientWithResourceContext(m, "tenant") var diags diag.Diagnostics pcgUID := d.Get("private_cloud_gateway_id").(string) @@ -127,8 +117,7 @@ func resourceIpPoolCreate(ctx context.Context, d *schema.ResourceData, m interfa } func resourceIpPoolRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - resourceContext := d.Get("context").(string) - c := getV1ClientWithResourceContext(m, resourceContext) + c := getV1ClientWithResourceContext(m, "tenant") var diags diag.Diagnostics pcgUID := d.Get("private_cloud_gateway_id").(string) @@ -182,8 +171,7 @@ func resourceIpPoolRead(ctx context.Context, d *schema.ResourceData, m interface } func resourceIpPoolUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - resourceContext := d.Get("context").(string) - c := getV1ClientWithResourceContext(m, resourceContext) + c := getV1ClientWithResourceContext(m, "tenant") var diags diag.Diagnostics pcgUID := d.Get("private_cloud_gateway_id").(string) @@ -199,8 +187,7 @@ func resourceIpPoolUpdate(ctx context.Context, d *schema.ResourceData, m interfa } func resourceIpPoolDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - resourceContext := d.Get("context").(string) - c := getV1ClientWithResourceContext(m, resourceContext) + c := getV1ClientWithResourceContext(m, "tenant") var diags diag.Diagnostics pcgUID := d.Get("private_cloud_gateway_id").(string)