diff --git a/internal/common/resource_id.go b/internal/common/resource_id.go index 614072a88..033ff28a8 100644 --- a/internal/common/resource_id.go +++ b/internal/common/resource_id.go @@ -2,6 +2,7 @@ package common import ( "fmt" + "reflect" "strconv" "strings" ) @@ -66,6 +67,10 @@ func (id *ResourceID) Make(parts ...any) string { } stringParts := make([]string, len(parts)) for i, part := range parts { + // Unwrap pointers + if reflect.ValueOf(part).Kind() == reflect.Ptr { + part = reflect.ValueOf(part).Elem().Interface() + } expectedField := id.expectedFields[i] switch expectedField.Type { case ResourceIDFieldTypeInt: diff --git a/internal/resources/cloud/resource_cloud_access_policy_token_test.go b/internal/resources/cloud/resource_cloud_access_policy_token_test.go index bb0d8b983..a16dc9027 100644 --- a/internal/resources/cloud/resource_cloud_access_policy_token_test.go +++ b/internal/resources/cloud/resource_cloud_access_policy_token_test.go @@ -154,7 +154,7 @@ func testAccCloudAccessPolicyCheckExists(rn string, a *gcom.AuthAccessPolicy) re return fmt.Errorf("resource id not set") } - region, id, _ := strings.Cut(rs.Primary.ID, "/") + region, id, _ := strings.Cut(rs.Primary.ID, ":") client := testutils.Provider.Meta().(*common.Client).GrafanaCloudAPI policy, _, err := client.AccesspoliciesAPI.GetAccessPolicy(context.Background(), id).Region(region).Execute() @@ -179,7 +179,7 @@ func testAccCloudAccessPolicyTokenCheckExists(rn string, a *gcom.AuthToken) reso return fmt.Errorf("resource id not set") } - region, id, _ := strings.Cut(rs.Primary.ID, "/") + region, id, _ := strings.Cut(rs.Primary.ID, ":") client := testutils.Provider.Meta().(*common.Client).GrafanaCloudAPI token, _, err := client.TokensAPI.GetToken(context.Background(), id).Region(region).Execute()