From 218ab434b92cf92474c17b8b3ac352c686e27925 Mon Sep 17 00:00:00 2001 From: lingkai Date: Tue, 13 Feb 2024 15:17:55 -0500 Subject: [PATCH 1/4] App Check DeviceCheck provider --- .../firebaseappcheck/DeviceCheckConfig.yaml | 113 ++++++++++++++++++ ..._app_check_device_check_config_full.tf.erb | 30 +++++ ...p_check_device_check_config_minimal.tf.erb | 29 +++++ ...base_app_check_device_check_config_test.go | 69 +++++++++++ .../test-fixtures/private-key-2.p8 | 3 + .../test-fixtures/private-key.p8 | 3 + 6 files changed, 247 insertions(+) create mode 100644 mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml create mode 100644 mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.erb create mode 100644 mmv1/templates/terraform/examples/firebase_app_check_device_check_config_minimal.tf.erb create mode 100644 mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go create mode 100644 mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key-2.p8 create mode 100644 mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key.p8 diff --git a/mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml b/mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml new file mode 100644 index 000000000000..8c906432efb2 --- /dev/null +++ b/mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml @@ -0,0 +1,113 @@ +# Copyright 2024 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +!ruby/object:Api::Resource +name: "DeviceCheckConfig" +base_url: projects/{{project}}/apps/{{app_id}}/deviceCheckConfig +self_link: projects/{{project}}/apps/{{app_id}}/deviceCheckConfig +create_url: projects/{{project}}/apps/{{app_id}}/deviceCheckConfig?updateMask=tokenTtl,keyId,privateKey +create_verb: :PATCH +update_verb: :PATCH +update_mask: true +skip_delete: true +description: | + An app's DeviceCheck configuration object. Note that the Team ID registered with your + app is used as part of the validation process. Make sure your `google_firebase_apple_app` has a team_id present. +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + "Official Documentation": "https://firebase.google.com/docs/app-check" + api: "https://firebase.google.com/docs/reference/appcheck/rest/v1/projects.apps.deviceCheckConfig" +import_format: + [ + "projects/{{project}}/apps/{{app_id}}/deviceCheckConfig", + "{{project}}/{{app_id}}", + "{{app_id}}", + ] +examples: + - !ruby/object:Provider::Terraform::Examples + name: "firebase_app_check_device_check_config_minimal" + # Need the time_sleep resource + pull_external: true + primary_resource_id: "default" + vars: + bundle_id: "bundle.id.devicecheck" + key_id: "Key ID" + private_key_path: "path/to/private-key.p8" + team_id: "9987654321" + test_vars_overrides: + # Don't add random suffix + private_key_path: '"test-fixtures/private-key.p8"' + team_id: '"9987654321"' + test_env_vars: + project_id: :PROJECT_NAME + - !ruby/object:Provider::Terraform::Examples + name: "firebase_app_check_device_check_config_full" + # Need the time_sleep resource + pull_external: true + primary_resource_id: "default" + vars: + bundle_id: "bundle.id.devicecheck" + key_id: "Key ID" + private_key_path: "path/to/private-key.p8" + team_id: "9987654321" + token_ttl: "7200s" + test_vars_overrides: + # Don't add random suffix + private_key_path: '"test-fixtures/private-key-2.p8"' + team_id: '"9987654321"' + token_ttl: '"7200s"' + test_env_vars: + project_id: :PROJECT_NAME +parameters: + - !ruby/object:Api::Type::String + name: app_id + description: | + The ID of an + [Apple App](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects.iosApps#IosApp.FIELDS.app_id). + required: true + immutable: true + url_param_only: true +properties: + - !ruby/object:Api::Type::String + name: name + description: | + The relative resource name of the DeviceCheck configuration object + output: true + pattern: projects/{{project}}/apps/{{app_id}}/deviceCheckConfig + - !ruby/object:Api::Type::String + name: tokenTtl + description: | + Specifies the duration for which App Check tokens exchanged from DeviceCheck artifacts will be valid. + If unset, a default value of 1 hour is assumed. Must be between 30 minutes and 7 days, inclusive. + + A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s". + default_from_api: true + - !ruby/object:Api::Type::String + name: keyId + description: | + The key identifier of a private key enabled with DeviceCheck, created in your Apple Developer account. + required: true + - !ruby/object:Api::Type::String + name: privateKey + description: | + The contents of the private key (.p8) file associated with the key specified by keyId. + required: true + sensitive: true + ignore_read: true + - !ruby/object:Api::Type::Boolean + name: privateKeySet + description: | + Whether the privateKey field was previously set. Since App Check will never return the + privateKey field, this field is the only way to find out whether it was previously set. + output: true diff --git a/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.erb b/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.erb new file mode 100644 index 000000000000..8e1d39632f26 --- /dev/null +++ b/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.erb @@ -0,0 +1,30 @@ +resource "google_firebase_apple_app" "default" { + project = "<%= ctx[:test_env_vars]['project_id'] %>" + display_name = "Apple app" + bundle_id = "<%= ctx[:vars]['bundle_id'] %>" + team_id = "<%= ctx[:vars]['team_id'] %>" +} + +# It takes a while for App Check to recognize the new app +# If your app already exists, you don't have to wait 30 seconds. +resource "time_sleep" "wait_30s" { + depends_on = [google_firebase_apple_app.default] + create_duration = "30s" +} + +resource "google_firebase_app_check_device_check_config" "default" { + project = "<%= ctx[:test_env_vars]['project_id'] %>" + app_id = google_firebase_apple_app.default.app_id + token_ttl = "<%= ctx[:vars]['token_ttl'] %>" + key_id = "<%= ctx[:vars]['key_id'] %>" + private_key = file("<%= ctx[:vars]['private_key_path'] %>") + + depends_on = [time_sleep.wait_30s] + + lifecycle { + precondition { + condition = google_firebase_apple_app.default.team_id != "" + error_message = "Provide a Team ID on the Apple App to use App Check" + } + } +} diff --git a/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_minimal.tf.erb b/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_minimal.tf.erb new file mode 100644 index 000000000000..8df68adb3edd --- /dev/null +++ b/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_minimal.tf.erb @@ -0,0 +1,29 @@ +resource "google_firebase_apple_app" "default" { + project = "<%= ctx[:test_env_vars]['project_id'] %>" + display_name = "Apple app" + bundle_id = "<%= ctx[:vars]['bundle_id'] %>" + team_id = "<%= ctx[:vars]['team_id'] %>" +} + +# It takes a while for App Check to recognize the new app +# If your app already exists, you don't have to wait 30 seconds. +resource "time_sleep" "wait_30s" { + depends_on = [google_firebase_apple_app.default] + create_duration = "30s" +} + +resource "google_firebase_app_check_device_check_config" "default" { + project = "<%= ctx[:test_env_vars]['project_id'] %>" + app_id = google_firebase_apple_app.default.app_id + key_id = "<%= ctx[:vars]['key_id'] %>" + private_key = file("<%= ctx[:vars]['private_key_path'] %>") + + depends_on = [time_sleep.wait_30s] + + lifecycle { + precondition { + condition = google_firebase_apple_app.default.team_id != "" + error_message = "Provide a Team ID on the Apple App to use App Check" + } + } +} diff --git a/mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go b/mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go new file mode 100644 index 000000000000..0227051bb49b --- /dev/null +++ b/mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go @@ -0,0 +1,69 @@ +package firebaseappcheck_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigUpdate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "project_id": envvar.GetTestProjectFromEnv(), + "team_id": "9987654321", + "private_key_path": "test-fixtures/private-key.p8", + "token_ttl": "3600s", + "random_suffix": acctest.RandString(t, 10), + } + + contextUpdated := map[string]interface{}{ + "project_id": envvar.GetTestProjectFromEnv(), + "team_id": "9987654321", + "private_key_path": "test-fixtures/private-key-2.p8", + "token_ttl": "7200s", + // Bundle ID needs to be the same between updates but different between tests + "random_suffix": context["random_suffix"], + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ExternalProviders: map[string]resource.ExternalProvider{ + "random": {}, + "time": {}, + }, + Steps: []resource.TestStep{ + { + Config: testAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigMinimalExample(context), + }, + { + ResourceName: "google_firebase_app_check_device_check_config.default", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"private_key", "app_id"}, + }, + { + Config: testAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigFullExample(contextUpdated), + }, + { + ResourceName: "google_firebase_app_check_device_check_config.default", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"private_key", "app_id"}, + }, + { + Config: testAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigMinimalExample(contextUpdated), + }, + { + ResourceName: "google_firebase_app_check_device_check_config.default", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"private_key", "app_id"}, + }, + }, + }) +} diff --git a/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key-2.p8 b/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key-2.p8 new file mode 100644 index 000000000000..d54b27a21e5e --- /dev/null +++ b/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key-2.p8 @@ -0,0 +1,3 @@ +-----BEGIN PRIVATE KEY----- +AlsoNotAValidKey +-----END PRIVATE KEY----- \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key.p8 b/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key.p8 new file mode 100644 index 000000000000..3cc3fbe8b740 --- /dev/null +++ b/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key.p8 @@ -0,0 +1,3 @@ +-----BEGIN PRIVATE KEY----- +NotAValidKey +-----END PRIVATE KEY----- \ No newline at end of file From 92da45375dc6edd0fcfe132d984527b7e5667245 Mon Sep 17 00:00:00 2001 From: lingkai Date: Wed, 14 Feb 2024 12:33:17 -0500 Subject: [PATCH 2/4] Remove minimal example & pattern field --- .../firebaseappcheck/DeviceCheckConfig.yaml | 17 ----------- ...p_check_device_check_config_minimal.tf.erb | 29 ------------------- ...base_app_check_device_check_config_test.go | 13 ++------- 3 files changed, 2 insertions(+), 57 deletions(-) delete mode 100644 mmv1/templates/terraform/examples/firebase_app_check_device_check_config_minimal.tf.erb diff --git a/mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml b/mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml index 8c906432efb2..789c46b4a5f0 100644 --- a/mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml +++ b/mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml @@ -35,22 +35,6 @@ import_format: "{{app_id}}", ] examples: - - !ruby/object:Provider::Terraform::Examples - name: "firebase_app_check_device_check_config_minimal" - # Need the time_sleep resource - pull_external: true - primary_resource_id: "default" - vars: - bundle_id: "bundle.id.devicecheck" - key_id: "Key ID" - private_key_path: "path/to/private-key.p8" - team_id: "9987654321" - test_vars_overrides: - # Don't add random suffix - private_key_path: '"test-fixtures/private-key.p8"' - team_id: '"9987654321"' - test_env_vars: - project_id: :PROJECT_NAME - !ruby/object:Provider::Terraform::Examples name: "firebase_app_check_device_check_config_full" # Need the time_sleep resource @@ -84,7 +68,6 @@ properties: description: | The relative resource name of the DeviceCheck configuration object output: true - pattern: projects/{{project}}/apps/{{app_id}}/deviceCheckConfig - !ruby/object:Api::Type::String name: tokenTtl description: | diff --git a/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_minimal.tf.erb b/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_minimal.tf.erb deleted file mode 100644 index 8df68adb3edd..000000000000 --- a/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_minimal.tf.erb +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_firebase_apple_app" "default" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - display_name = "Apple app" - bundle_id = "<%= ctx[:vars]['bundle_id'] %>" - team_id = "<%= ctx[:vars]['team_id'] %>" -} - -# It takes a while for App Check to recognize the new app -# If your app already exists, you don't have to wait 30 seconds. -resource "time_sleep" "wait_30s" { - depends_on = [google_firebase_apple_app.default] - create_duration = "30s" -} - -resource "google_firebase_app_check_device_check_config" "default" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - app_id = google_firebase_apple_app.default.app_id - key_id = "<%= ctx[:vars]['key_id'] %>" - private_key = file("<%= ctx[:vars]['private_key_path'] %>") - - depends_on = [time_sleep.wait_30s] - - lifecycle { - precondition { - condition = google_firebase_apple_app.default.team_id != "" - error_message = "Provide a Team ID on the Apple App to use App Check" - } - } -} diff --git a/mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go b/mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go index 0227051bb49b..2f9d5df800aa 100644 --- a/mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go +++ b/mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go @@ -16,7 +16,7 @@ func TestAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigU "project_id": envvar.GetTestProjectFromEnv(), "team_id": "9987654321", "private_key_path": "test-fixtures/private-key.p8", - "token_ttl": "3600s", + "token_ttl": "3900s", "random_suffix": acctest.RandString(t, 10), } @@ -38,7 +38,7 @@ func TestAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigU }, Steps: []resource.TestStep{ { - Config: testAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigMinimalExample(context), + Config: testAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigFullExample(context), }, { ResourceName: "google_firebase_app_check_device_check_config.default", @@ -55,15 +55,6 @@ func TestAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigU ImportStateVerify: true, ImportStateVerifyIgnore: []string{"private_key", "app_id"}, }, - { - Config: testAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigMinimalExample(contextUpdated), - }, - { - ResourceName: "google_firebase_app_check_device_check_config.default", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"private_key", "app_id"}, - }, }, }) } From 336b22989cc5aabea822e1c1f647d22b45bfa623 Mon Sep 17 00:00:00 2001 From: lingkai Date: Wed, 6 Mar 2024 11:33:58 -0500 Subject: [PATCH 3/4] Add real private keys that are not useful anywhere --- .../test-fixtures/private-key-2.p8 | 14 +++++++++++++- .../firebaseappcheck/test-fixtures/private-key.p8 | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key-2.p8 b/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key-2.p8 index d54b27a21e5e..f581bea0e054 100644 --- a/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key-2.p8 +++ b/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key-2.p8 @@ -1,3 +1,15 @@ -----BEGIN PRIVATE KEY----- -AlsoNotAValidKey +MIICWwIBAAKBgQCVA/2LQtUYJI8KlNHWzNPzGzVv01qavSbmuW0QYjshxRnXDBk+ +fWZePJAmsyuhU4Y2SkM5Wqvgjo/rDPaRPdTiEtKQuNesRgQeOVmAWDkIXEiieTwb +RYuXbdpZhH86Vt6xOMt14tGPKE5VuuySvTqgQRCvRTylrF3koBc0d/8NVQIDAQAB +AoGAG7qBXH+ULYjoAR0OKv00V2FxwRxAGNknuvk4HTtaK3+Evmpm7CTjfpegb0MZ +1Ew5hjKtbae8oe2FRETGQOKTkS68I/D9PGP4aTzmSkf6PjwXwhlBYp09xxv4nmxV +BCbsoicNMvdk0F7SPblnZBO9i0DpZ8pT9wyPo8QzWBfi5IECQQD8gIOja3Zim4R9 +HVL7Blvhzhl2ibuITV2PKfQ11v0a+Om+rZKwdrhxKgWoguDvvP7ExWSPTZJKSm0J +bzhU+APhAkEAlxR3fY+zSpxHaxbOqZ6cea5cZtyHcX607nW8N037yBErIjcJKL65 +gHx9Vq1Xo24o4C6kyzmh00BnkyXul4439QJAPWvtmaUcaSQ3eE/XzaRgWW9PFlyu +t5tKNPcZprcjXppKEc4bLr3SZAS616DuoqKwvqDds1ZFTbkJCRB6/YBPQQJAeyGG +JYKJyKRIHMJw2pNXymBOFNNlXB29jp/ML3LSYwODGRar01ZmT46mhI8wXxV4IQZC +7xLgjhDumWIP69tQRQJAfuOy4TP2drxNI7fP7YenV1ks6CiLHcBN04f6NItWilTN +Cc+Mv/rio9xO56Yp9oePMaFT9QEzfO/cqX6QvyfblQ== -----END PRIVATE KEY----- \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key.p8 b/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key.p8 index 3cc3fbe8b740..d48a562a97bd 100644 --- a/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key.p8 +++ b/mmv1/third_party/terraform/services/firebaseappcheck/test-fixtures/private-key.p8 @@ -1,3 +1,15 @@ -----BEGIN PRIVATE KEY----- -NotAValidKey +MIICXAIBAAKBgG3vDegwb8uUvns/Iuodo/cNK0eMHxqb+2n16dQnxL7az+ShNWKQ +jTSzXY5y4VexrTdPEU5ZiTPONZXyl4/iFvOnyFxnC6Zjyr+xeIU5X4TmjYq0yCuZ +xbovAWw+E4KUKt1V62avd+hGZHPtCKLfV/uYITG7I8R+GyEAdMoaXP8JAgMBAAEC +gYBsQFf7aabMWx3uks84phNNNOSHQY1nUG2Te5nTVY3BOgo44h2Ffz3sxSq9GJaZ +GdatfehWtIgMQWQ20Xk5L7LUzSxmndHbUIzYU17xZrAsgmjYTwvAQ13If2L6S+pz +EUbTLkMnlbAgvtJ2AqZZZ3LE41N9ey60gVB1cCu9fCXLuQJBANAeoDXXvh7nXdyN +Zd84zXpSk8SLmAmQn1JB7z3oPkrZ0dG42GMOzYw9MP8n2bATHV+OB0/gdUFJAYYp +kwz+bJ8CQQCHObHelAlkH3or+JVECpovNMHs2UGB6yF1ZX0Nep3iR90fhi3BsnVo +IQGdHlQC2NL+iaBF4Mv2/dfZTen1vMtXAkEAk7+KQW8+G7ZpXjBLyCMNTO/e08O+ +VdwEH2OLsslzn7PvTxIJHJnfttWiOSJTWrrXOYUdD8nrtENd/574NFtTRQJAaExD +uJ0NsT/mB0wwNM7IpWhXusrHD+G/aMDidyb/56vuDYZ8fE2c6LesevcNbTS3aMPV +7o+4QcUAWwcRUQxQ+QJBAJEAwwzFnLJtrFYEnz7YNufgjiMrX7CBJCwrXGZpZrHX +EdDDOGiLrm871hc3tNQWmzou9AFIwZFeIOXVdIHIQzk= -----END PRIVATE KEY----- \ No newline at end of file From 28e747f02672cd653d06a59ddd3c704b4bbf70ff Mon Sep 17 00:00:00 2001 From: lingkai Date: Wed, 6 Mar 2024 13:56:12 -0500 Subject: [PATCH 4/4] Limit tests to beta --- mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml | 1 + .../firebase_app_check_device_check_config_full.tf.erb | 4 ++++ ...ource_firebase_app_check_device_check_config_test.go.erb} | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) rename mmv1/third_party/terraform/services/firebaseappcheck/{resource_firebase_app_check_device_check_config_test.go => resource_firebase_app_check_device_check_config_test.go.erb} (93%) diff --git a/mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml b/mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml index 789c46b4a5f0..3b708a93471d 100644 --- a/mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml +++ b/mmv1/products/firebaseappcheck/DeviceCheckConfig.yaml @@ -37,6 +37,7 @@ import_format: examples: - !ruby/object:Provider::Terraform::Examples name: "firebase_app_check_device_check_config_full" + min_version: 'beta' # Need the time_sleep resource pull_external: true primary_resource_id: "default" diff --git a/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.erb b/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.erb index 8e1d39632f26..72b6a96fbafb 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.erb +++ b/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.erb @@ -1,4 +1,6 @@ resource "google_firebase_apple_app" "default" { + provider = google-beta + project = "<%= ctx[:test_env_vars]['project_id'] %>" display_name = "Apple app" bundle_id = "<%= ctx[:vars]['bundle_id'] %>" @@ -13,6 +15,8 @@ resource "time_sleep" "wait_30s" { } resource "google_firebase_app_check_device_check_config" "default" { + provider = google-beta + project = "<%= ctx[:test_env_vars]['project_id'] %>" app_id = google_firebase_apple_app.default.app_id token_ttl = "<%= ctx[:vars]['token_ttl'] %>" diff --git a/mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go b/mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go.erb similarity index 93% rename from mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go rename to mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go.erb index 2f9d5df800aa..156a2cac1e59 100644 --- a/mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go +++ b/mmv1/third_party/terraform/services/firebaseappcheck/resource_firebase_app_check_device_check_config_test.go.erb @@ -1,4 +1,6 @@ +<% autogen_exception -%> package firebaseappcheck_test +<% unless version == 'ga' -%> import ( "testing" @@ -31,7 +33,7 @@ func TestAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigU acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, "time": {}, @@ -58,3 +60,4 @@ func TestAccFirebaseAppCheckDeviceCheckConfig_firebaseAppCheckDeviceCheckConfigU }, }) } +<% end -%>