Skip to content

Commit

Permalink
allow id for bigtable app profile instance (#3174) (#373)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Feb 27, 2020
1 parent 0642214 commit f376a30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions google/bigtable_app_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 5 additions & 0 deletions google/self_link_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f376a30

Please sign in to comment.