diff --git a/google/bigtable_app_profile.go b/google/bigtable_app_profile.go index b5e7f2c87..bea40a12d 100644 --- a/google/bigtable_app_profile.go +++ b/google/bigtable_app_profile.go @@ -62,6 +62,12 @@ func GetBigtableAppProfileApiObject(d TerraformResourceData, config *Config) (ma obj["singleClusterRouting"] = singleClusterRoutingProp } + return resourceBigtableAppProfileEncoder(d, config, obj) +} + +func resourceBigtableAppProfileEncoder(d TerraformResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) { + // Instance is a URL parameter only, so replace self-link/path with resource name only. + d.Set("instance", GetResourceNameFromSelfLink(d.Get("instance").(string))) return obj, nil } diff --git a/google/self_link_helpers.go b/google/self_link_helpers.go index f5cb0893e..df239b7c9 100644 --- a/google/self_link_helpers.go +++ b/google/self_link_helpers.go @@ -11,6 +11,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) +// Compare only the resource name of two self links/paths. +func compareResourceNames(_, old, new string, _ *schema.ResourceData) bool { + return GetResourceNameFromSelfLink(old) == GetResourceNameFromSelfLink(new) +} + // Compare only the relative path of two self links. func compareSelfLinkRelativePaths(_, old, new string, _ *schema.ResourceData) bool { oldStripped, err := getRelativePath(old)