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

Add Firebase AppleApp Data Source #6876

Merged
merged 52 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
cd2e519
Update api.yaml
mraouffouad Sep 28, 2022
1b15c11
Update api.yaml
mraouffouad Sep 29, 2022
165fe20
Update api.yaml
mraouffouad Sep 30, 2022
e8e5952
Update api.yaml
mraouffouad Sep 30, 2022
7e4c7b6
Update terraform.yaml
mraouffouad Sep 30, 2022
ddf4945
Create firebase_apple_app_basic.tf.erb
mraouffouad Sep 30, 2022
aa06508
Responding to tylerg-dev's comments
mraouffouad Oct 5, 2022
b4bdab7
Fixing the failing TestAccFirebaseAppleApp_firebaseAppleAppBasicExamp…
mraouffouad Oct 5, 2022
538088e
Add a handwritten sweeper to hard-delete the AppleApp
mraouffouad Oct 9, 2022
34d6a94
Fix typo in update_mask
mraouffouad Oct 9, 2022
5810834
Fix var name in test
mraouffouad Oct 9, 2022
8eba423
Add delete request body
mraouffouad Oct 13, 2022
15bac81
Change appId to app_id in the sweeper delete url
mraouffouad Oct 13, 2022
c367f5e
Use custom_delete for deleting the AppleApp resource
mraouffouad Oct 14, 2022
ff60f99
Merge branch 'main' into ios_app
mraouffouad Oct 18, 2022
d332361
Update api.yaml
mraouffouad Oct 18, 2022
6e89e74
Remove the repeated block in terraform.api
mraouffouad Oct 18, 2022
9805363
Add a 5 sec in the post_delete template
mraouffouad Oct 19, 2022
46c1231
Move the 5 sec delay to the custom delete code
mraouffouad Oct 19, 2022
f4e7399
Add "Optional" to the deletion_policy description.
mraouffouad Oct 20, 2022
d5e1d4e
Merge branch 'GoogleCloudPlatform:main' into ios_app
mraouffouad Oct 20, 2022
20641e3
Merge branch 'main' into ios_app
mraouffouad Oct 21, 2022
15f9662
Merge branch 'GoogleCloudPlatform:main' into ios_app
mraouffouad Nov 3, 2022
0f57c62
Address melinath@ comments
mraouffouad Nov 10, 2022
1830e35
Add a manual update test
mraouffouad Nov 10, 2022
5c8ca6b
Remove unnecessary randomness. Also, move attributes to the vars sect…
mraouffouad Nov 11, 2022
001787e
Update mmv1/products/firebase/terraform.yaml
mraouffouad Nov 11, 2022
7f47475
Update mmv1/products/firebase/terraform.yaml
mraouffouad Nov 11, 2022
6bce9c0
Update mmv1/products/firebase/terraform.yaml
mraouffouad Nov 11, 2022
c9ca82e
Update mmv1/third_party/terraform/tests/resource_firebase_apple_app_u…
mraouffouad Nov 11, 2022
387eaff
Update mmv1/third_party/terraform/tests/resource_firebase_apple_app_u…
mraouffouad Nov 11, 2022
7dcb89a
Update mmv1/third_party/terraform/tests/resource_firebase_apple_app_u…
mraouffouad Nov 11, 2022
5b5ba72
Adding back the test_vars_overrides.
mraouffouad Nov 11, 2022
4cc80e4
Merge branch 'GoogleCloudPlatform:main' into ios_app
mraouffouad Nov 27, 2022
0121239
Add a Datasource for Firebase AppleApp
mraouffouad Nov 28, 2022
89689ba
Fix lint warnings
mraouffouad Nov 28, 2022
aba4652
Add documentations and fix the test
mraouffouad Dec 2, 2022
fd0c71d
Update the test providers.
mraouffouad Dec 2, 2022
745a62b
Remove the providers from the AppleApp datasource tests
mraouffouad Dec 2, 2022
96a89f4
Merge branch 'GoogleCloudPlatform:main' into ios_app
mraouffouad Dec 2, 2022
358cd48
Merge branch 'GoogleCloudPlatform:main' into ios_app
mraouffouad Dec 5, 2022
0617222
Merge branch 'GoogleCloudPlatform:main' into ios_app
mraouffouad Dec 5, 2022
5305c73
Add GA tags to the data source test and rename it to .go.erb
mraouffouad Dec 6, 2022
862b055
Merge branch 'main' into ios_app
mraouffouad Dec 7, 2022
aafecb0
Fix tabs in Datasource map.
mraouffouad Dec 7, 2022
e8bf844
Merge branch 'GoogleCloudPlatform:main' into ios_app
mraouffouad Dec 9, 2022
e50906c
Add randomness to bundle_id to avoid collision.
mraouffouad Dec 9, 2022
4c81148
Responding to roaks3's comments
mraouffouad Dec 13, 2022
4a5e880
Merge branch 'GoogleCloudPlatform:main' into ios_app
mraouffouad Dec 13, 2022
fc7db85
Merge branch 'GoogleCloudPlatform:main' into ios_app
mraouffouad Dec 13, 2022
23917ac
Remove ws from data_source_google_firebase_web_app.go.erb
mraouffouad Dec 14, 2022
4be0ff3
Remove unneeded whitespaces from provider.go.erb
mraouffouad Dec 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<% autogen_exception -%>
package google
<% unless version == 'ga' -%>
import (
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceGoogleFirebaseAppleApp() *schema.Resource {
// Generate datasource schema from resource
dsSchema := datasourceSchemaFromResourceSchema(resourceFirebaseAppleApp().Schema)

// Set 'Required' schema elements
addRequiredFieldsToSchema(dsSchema, "app_id")

return &schema.Resource{
Read: dataSourceGoogleFirebaseAppleAppRead,
Schema: dsSchema,
}
}

func dataSourceGoogleFirebaseAppleAppRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
appId := d.Get("app_id")
project, err := getProject(d, config)
if err != nil {
return err
}
name := fmt.Sprintf("projects/%s/iosApps/%s", project, appId.(string))
d.SetId(name)
if err := d.Set("name", name); err != nil {
return fmt.Errorf("Error setting name: %s", err)
}
return resourceFirebaseAppleAppRead(d, meta)
}
<% end -%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<% autogen_exception -%>
package google
<% unless version == 'ga' -%>
import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccDataSourceGoogleFirebaseAppleApp(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"project_id": getTestProjectFromEnv(),
"bundle_id": "apple.app." + randString(t, 5),
"display_name": "Display Name AppleApp DataSource",
"app_store_id": 12345,
"team_id": 1234567890,
}

resourceName := "data.google_firebase_apple_app.my_app"

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccDataSourceGoogleFirebaseAppleApp(context),
Check: resource.ComposeTestCheckFunc(
checkDataSourceStateMatchesResourceStateWithIgnores(
resourceName,
"google_firebase_apple_app.my_app",
map[string]struct{}{
"deletion_policy": {},
},
),
),
},
},
})
}

func testAccDataSourceGoogleFirebaseAppleApp(context map[string]interface{}) string {
return Nprintf(`
resource "google_firebase_apple_app" "my_app" {
project = "%{project_id}"
bundle_id = "%{bundle_id}"
display_name = "%{display_name}"
app_store_id = "%{app_store_id}"
team_id = "%{team_id}"
}

data "google_firebase_apple_app" "my_app" {
app_id = google_firebase_apple_app.my_app.app_id
}
`, context)
}
<% end -%>
1 change: 1 addition & 0 deletions mmv1/third_party/terraform/utils/provider.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ func Provider() *schema.Provider {
<% unless version == 'ga' -%>
"google_kms_secret_asymmetric": dataSourceGoogleKmsSecretAsymmetric(),
"google_firebase_android_app": dataSourceGoogleFirebaseAndroidApp(),
"google_firebase_apple_app": dataSourceGoogleFirebaseAppleApp(),
"google_firebase_web_app": dataSourceGoogleFirebaseWebApp(),
"google_firebase_web_app_config": dataSourceGoogleFirebaseWebappConfig(),
<% end -%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The following arguments are supported:

* `app_id` -
(Required)
The app_ip of name of the Firebase androidApp.
The app_id of name of the Firebase androidApp.


- - -
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
subcategory: "Firebase"
page_title: "Google: google_firebase_apple_app"
description: |-
A Google Cloud Firebase Apple application instance
---

# google\_firebase\_apple\_app

A Google Cloud Firebase Apple application instance

~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.


## Argument Reference

The following arguments are supported:


* `app_id` -
(Required)
The app_id of name of the Firebase iosApp.


- - -


* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.


## Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

* `id` - an identifier for the resource with format `{{name}}`

* `name` -
The fully qualified resource name of the App, for example:
projects/projectId/iosApps/appId

* `app_id` -
Immutable. The globally unique, Firebase-assigned identifier of the App.
This identifier should be treated as an opaque token, as the data format is not specified.

* `display_name` -
The user-assigned display name of the App.

* `bundle_id` -
The canonical bundle ID of the Apple app as it would appear in the Apple AppStore.

* `app_store_id` -
The automatically generated Apple ID assigned to the Apple app by Apple in the Apple App Store.

* `team_id` -
The Apple Developer Team ID associated with the App in the App Store.