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 custom apiKeyId to Firebase apps #8689

Merged
merged 1 commit into from
Aug 21, 2023

Conversation

rainshen49
Copy link
Contributor

@rainshen49 rainshen49 commented Aug 17, 2023

Part of hashicorp/terraform-provider-google#15485

This allows users to associate their own API key with an Android/Apple/Web app registered in their Firebase project.

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • Ran relevant acceptance tests using my own Google Cloud project and credentials (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read Write release notes before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

firebase: added `api_key_id` field to `google_firebase_web_app`, `google_firebase_android_app`, and `google_firebase_apple_app`.

@modular-magician
Copy link
Collaborator

Hello! I am a robot. It looks like you are a: Community Contributor Googler Core Contributor. Tests will run automatically.

@melinath, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 92 insertions(+), 1 deletion(-))
Terraform Beta: Diff ( 12 files changed, 443 insertions(+), 25 deletions(-))
TF Conversion: Diff ( 3 files changed, 30 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2969
Passed tests 2661
Skipped tests: 302
Affected tests: 6

Action taken

Found 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccFirebaseWebApp_firebaseWebAppCustomApiKeyExample|TestAccFirebaseAndroidApp_firebaseAndroidAppCustomApiKeyExample|TestAccFirebaseAppleApp_update|TestAccFirebaseAndroidApp_update|TestAccFirebaseAppleApp_firebaseAppleAppFullExample|TestAccDataSourceGoogleServiceAccountJwt

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccFirebaseAndroidApp_firebaseAndroidAppCustomApiKeyExample[Debug log]
TestAccFirebaseAppleApp_firebaseAppleAppFullExample[Debug log]
TestAccDataSourceGoogleServiceAccountJwt[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccFirebaseWebApp_firebaseWebAppCustomApiKeyExample[Error message] [Debug log]
TestAccFirebaseAppleApp_update[Error message] [Debug log]
TestAccFirebaseAndroidApp_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 90 insertions(+), 1 deletion(-))
Terraform Beta: Diff ( 12 files changed, 439 insertions(+), 25 deletions(-))
TF Conversion: Diff ( 3 files changed, 30 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2969
Passed tests 2664
Skipped tests: 302
Affected tests: 3

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccFirebaseWebApp_firebaseWebAppCustomApiKeyExample|TestAccFirebaseAndroidApp_update|TestAccFirebaseAppleApp_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccFirebaseWebApp_firebaseWebAppCustomApiKeyExample[Debug log]
TestAccFirebaseAndroidApp_update[Debug log]
TestAccFirebaseAppleApp_update[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$
View the build log or the debug log for each test

@rainshen49 rainshen49 marked this pull request as ready for review August 18, 2023 14:18
Copy link
Member

@melinath melinath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM - let me know if you want me to merge as is.

Could you adjust the release note according to https://googlecloudplatform.github.io/magic-modules/contribute/release-notes/? At a minimum it should include the product slug (firebase)

It looks to me like this fixes hashicorp/terraform-provider-google#15485 rather than just being part of that issue - what other work will be left?

@rainshen49
Copy link
Contributor Author

Release note adjusted. Yes pls merge.

hashicorp/terraform-provider-google#15485 has two main concerns:

  1. An unrestricted API key is created when google_firebase_project is provisioned. <-- not addressed by this PR. It's on the API level.
  2. There is no way to reference it & add more restriction. <-- mitigated by this PR because users can just ignore the auto-created API key and use their own created API key.

Let's see if the OP of the issue comes back saying they are satisfied with 2, and then we can mark the issue as fixed. Otherwise, this issue may be left open until we figure out how to address 1.

@ScottSuarez
Copy link
Contributor

@rainshen49 Is this field allowlist only?

We are seeing failures in our nightly runs:

=== RUN   TestAccFirebaseWebApp_firebaseWebAppFull
=== PAUSE TestAccFirebaseWebApp_firebaseWebAppFull
=== CONT  TestAccFirebaseWebApp_firebaseWebAppFull
    vcr_utils.go:152: Step 1/4 error: Error running pre-apply refresh: exit status 1
        Error: Unsupported argument
          on terraform_plugin_test.tf line 60, in resource "google_firebase_web_app" "default":
          60:   api_key_id = google_apikeys_key.key1.uid

@rainshen49
Copy link
Contributor Author

This field is available in the public API. Also, the generated test from firebase_web_app_custom_api_key passed. I suspect the ExternalProviders version constraint is making the test run in an older version of the provider?

ExternalProviders: map[string]resource.ExternalProvider{
	"google": {
		VersionConstraint: "4.58.0",
		Source:            "hashicorp/google<%= "-" + version unless version == 'ga'  -%>",
	},
},

@ScottSuarez
Copy link
Contributor

Thanks !

joelkattapuram pushed a commit to joelkattapuram/magic-modules that referenced this pull request Sep 20, 2023
@rainshen49 rainshen49 deleted the firebase-apikey-web branch February 13, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants