From febada5a0576a24e40203cd32de0f580cc273fc9 Mon Sep 17 00:00:00 2001 From: michaelfmnk Date: Mon, 29 Jul 2024 13:44:37 +0200 Subject: [PATCH 1/3] FIX: [TF] output from Terraform's "cloudconnexa_connector" and from Swagger has different value of "ID" field --- cloudconnexa/data_source_connector.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cloudconnexa/data_source_connector.go b/cloudconnexa/data_source_connector.go index c7f9307..2d822da 100644 --- a/cloudconnexa/data_source_connector.go +++ b/cloudconnexa/data_source_connector.go @@ -15,6 +15,11 @@ func dataSourceConnector() *schema.Resource { Description: "Use an `cloudconnexa_connector` data source to read an existing CloudConnexa connector.", ReadContext: dataSourceConnectorRead, Schema: map[string]*schema.Schema{ + "connector_id": { + Type: schema.TypeString, + Computed: true, + Description: "The connector ID.", + }, "name": { Type: schema.TypeString, Required: true, @@ -66,6 +71,7 @@ func dataSourceConnectorRead(ctx context.Context, d *schema.ResourceData, m inte if err != nil { return append(diags, diag.FromErr(err)...) } + d.Set("connector_id", connector.Id) d.Set("name", connector.Name) d.Set("description", connector.Description) d.Set("network_item_id", connector.NetworkItemId) From 202acf4db7bf7aaf8e788c109d014cb8e685c6ed Mon Sep 17 00:00:00 2001 From: michaelfmnk Date: Mon, 29 Jul 2024 13:53:27 +0200 Subject: [PATCH 2/3] FIX: [TF] output from Terraform's "cloudconnexa_connector" and from Swagger has different value of "ID" field --- cloudconnexa/data_source_connector.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cloudconnexa/data_source_connector.go b/cloudconnexa/data_source_connector.go index 2d822da..ffb4ab4 100644 --- a/cloudconnexa/data_source_connector.go +++ b/cloudconnexa/data_source_connector.go @@ -2,9 +2,6 @@ package cloudconnexa import ( "context" - "strconv" - "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/openvpn/cloudconnexa-go-client/v2/cloudconnexa" @@ -71,7 +68,7 @@ func dataSourceConnectorRead(ctx context.Context, d *schema.ResourceData, m inte if err != nil { return append(diags, diag.FromErr(err)...) } - d.Set("connector_id", connector.Id) + d.SetId(connector.Id) d.Set("name", connector.Name) d.Set("description", connector.Description) d.Set("network_item_id", connector.NetworkItemId) @@ -84,6 +81,5 @@ func dataSourceConnectorRead(ctx context.Context, d *schema.ResourceData, m inte return append(diags, diag.FromErr(err)...) } d.Set("profile", profile) - d.SetId(strconv.FormatInt(time.Now().Unix(), 10)) return diags } From ea3b3ae7140b7fde9f3b39f645b55d956bf90035 Mon Sep 17 00:00:00 2001 From: michaelfmnk Date: Mon, 29 Jul 2024 13:53:38 +0200 Subject: [PATCH 3/3] FIX: [TF] output from Terraform's "cloudconnexa_connector" and from Swagger has different value of "ID" field --- cloudconnexa/data_source_connector.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cloudconnexa/data_source_connector.go b/cloudconnexa/data_source_connector.go index ffb4ab4..f20b7ba 100644 --- a/cloudconnexa/data_source_connector.go +++ b/cloudconnexa/data_source_connector.go @@ -12,11 +12,6 @@ func dataSourceConnector() *schema.Resource { Description: "Use an `cloudconnexa_connector` data source to read an existing CloudConnexa connector.", ReadContext: dataSourceConnectorRead, Schema: map[string]*schema.Schema{ - "connector_id": { - Type: schema.TypeString, - Computed: true, - Description: "The connector ID.", - }, "name": { Type: schema.TypeString, Required: true,