From 62ed320afb0b9a23cf5e01b29d311721bf11a043 Mon Sep 17 00:00:00 2001 From: Ricardo Ferraz Leal Date: Tue, 29 Nov 2022 14:09:03 -0500 Subject: [PATCH] chore: fixed the ID to fetch only the mysql/postgres server --- .../services/mysql/mysql_configuration_set_resource.go | 9 ++++++--- .../postgres/postgresql_configuration_set_resource.go | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/internal/services/mysql/mysql_configuration_set_resource.go b/internal/services/mysql/mysql_configuration_set_resource.go index 25956f4ebde7..282a791f4e60 100644 --- a/internal/services/mysql/mysql_configuration_set_resource.go +++ b/internal/services/mysql/mysql_configuration_set_resource.go @@ -6,6 +6,7 @@ package mysql import ( "fmt" "log" + "strings" "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" @@ -67,13 +68,15 @@ func resourceMySQLConfigurationSetRead(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ConfigurationID(d.Id()) + // id, err := parse.ConfigurationID(serverID) + serverID := strings.TrimSuffix(d.Id(), "/configurationSet/set") + id, err := parse.ServerID(serverID) if err != nil { return err } resourceGroup := id.ResourceGroup - serverName := id.ServerName + serverName := id.Name resp, err := client.ListByServer(ctx, resourceGroup, serverName) if err != nil { if utils.ResponseWasNotFound(resp.Response) { @@ -92,7 +95,7 @@ func resourceMySQLConfigurationSetRead(d *pluginsdk.ResourceData, meta interface configMap[*key] = *value } - d.Set("server_name", id.ServerName) + d.Set("server_name", id.Name) d.Set("resource_group_name", id.ResourceGroup) d.Set("config_map", configMap) diff --git a/internal/services/postgres/postgresql_configuration_set_resource.go b/internal/services/postgres/postgresql_configuration_set_resource.go index 248c25e153f1..e9aecfd777ee 100644 --- a/internal/services/postgres/postgresql_configuration_set_resource.go +++ b/internal/services/postgres/postgresql_configuration_set_resource.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "log" + "strings" "time" "github.com/hashicorp/go-azure-helpers/lang/response" @@ -71,7 +72,8 @@ func resourcePostgreSQLConfigurationSetRead(d *pluginsdk.ResourceData, meta inte defer cancel() - id, err := configurations.ParseServerID(d.Id()) + serverID := strings.TrimSuffix(d.Id(), "/configurationSet/set") + id, err := configurations.ParseServerID(serverID) if err != nil { return err }