Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google_firebase_android_app should be replaced when package_name changes #7100

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/10194.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
firebase: made the `google_firebase_android_app` resource's `package_name` field required and immutable. This prevents API errors encountered by users who attempted to update or leave that field unset in their configurations.
```
23 changes: 7 additions & 16 deletions google-beta/services/firebase/resource_firebase_android_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,20 @@ func ResourceFirebaseAndroidApp() *schema.Resource {
Required: true,
Description: `The user-assigned display name of the AndroidApp.`,
},
"package_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `The canonical package name of the Android app as would appear in the Google Play
Developer Console.`,
},
"api_key_id": {
Type: schema.TypeString,
Computed: true,
Optional: true,
Description: `The globally unique, Google-assigned identifier (UID) for the Firebase API key associated with the AndroidApp.
If apiKeyId is not set during creation, then Firebase automatically associates an apiKeyId with the AndroidApp.
This auto-associated key may be an existing valid key or, if no valid key exists, a new one will be provisioned.`,
},
"package_name": {
Type: schema.TypeString,
Optional: true,
Description: `Immutable. The canonical package name of the Android app as would appear in the Google Play
Developer Console.`,
},
"sha1_hashes": {
Type: schema.TypeList,
Expand Down Expand Up @@ -337,12 +338,6 @@ func resourceFirebaseAndroidAppUpdate(d *schema.ResourceData, meta interface{})
} else if v, ok := d.GetOkExists("display_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, displayNameProp)) {
obj["displayName"] = displayNameProp
}
packageNameProp, err := expandFirebaseAndroidAppPackageName(d.Get("package_name"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("package_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, packageNameProp)) {
obj["packageName"] = packageNameProp
}
sha1HashesProp, err := expandFirebaseAndroidAppSha1Hashes(d.Get("sha1_hashes"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -380,10 +375,6 @@ func resourceFirebaseAndroidAppUpdate(d *schema.ResourceData, meta interface{})
updateMask = append(updateMask, "displayName")
}

if d.HasChange("package_name") {
updateMask = append(updateMask, "packageName")
}

if d.HasChange("sha1_hashes") {
updateMask = append(updateMask, "sha1Hashes")
}
Expand Down
10 changes: 5 additions & 5 deletions website/docs/r/firebase_android_app.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ The following arguments are supported:
(Required)
The user-assigned display name of the AndroidApp.

* `package_name` -
(Required)
The canonical package name of the Android app as would appear in the Google Play
Developer Console.

- - -

- - -

* `package_name` -
(Optional)
Immutable. The canonical package name of the Android app as would appear in the Google Play
Developer Console.

* `sha1_hashes` -
(Optional)
Expand Down