From 636bc38bb752b41062c788932fff643b9e7f57b6 Mon Sep 17 00:00:00 2001 From: Lingkai Shen Date: Tue, 10 Dec 2024 10:49:54 -0500 Subject: [PATCH] Add regex --- mmv1/products/firebasehosting/Version.yaml | 7 +++++ ...ebasehosting_version_headers_regex.tf.tmpl | 26 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 mmv1/templates/terraform/examples/firebasehosting_version_headers_regex.tf.tmpl diff --git a/mmv1/products/firebasehosting/Version.yaml b/mmv1/products/firebasehosting/Version.yaml index 26e0f4971548..2552abbe52bf 100644 --- a/mmv1/products/firebasehosting/Version.yaml +++ b/mmv1/products/firebasehosting/Version.yaml @@ -53,6 +53,13 @@ examples: site_id: 'site-id' test_env_vars: project_id: 'PROJECT_NAME' + - name: 'firebasehosting_version_headers_regex' + primary_resource_id: 'default' + min_version: 'beta' + vars: + site_id: 'site-id' + test_env_vars: + project_id: 'PROJECT_NAME' - name: 'firebasehosting_version_path' primary_resource_id: 'default' min_version: 'beta' diff --git a/mmv1/templates/terraform/examples/firebasehosting_version_headers_regex.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_version_headers_regex.tf.tmpl new file mode 100644 index 000000000000..89d9ebe06502 --- /dev/null +++ b/mmv1/templates/terraform/examples/firebasehosting_version_headers_regex.tf.tmpl @@ -0,0 +1,26 @@ +resource "google_firebase_hosting_site" "default" { + provider = google-beta + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" +} + +resource "google_firebase_hosting_version" "default" { + provider = google-beta + site_id = google_firebase_hosting_site.default.site_id + config { + headers { + # Also okay to use glob + regex = "^~/headers$" + headers = { + my-header = "my-value" + } + } + } +} + +resource "google_firebase_hosting_release" "default" { + provider = google-beta + site_id = google_firebase_hosting_site.default.site_id + version_name = google_firebase_hosting_version.default.name + message = "With custom headers" +} \ No newline at end of file