Skip to content

Commit

Permalink
Firebase Hosting SiteConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
rainshen49 committed Nov 7, 2022
1 parent b2a5ec8 commit 6d3c8ac
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 1 deletion.
35 changes: 34 additions & 1 deletion mmv1/products/firebasehosting/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,37 @@ objects:
- !ruby/object:Api::Type::String
name: defaultUrl
output: true
description: The default URL for the site in the form of https://{name}.web.app
description: The default URL for the site in the form of https://{name}.web.app
- !ruby/object:Api::Resource
name: 'SiteConfig'
min_version: beta
base_url: projects/{{project}}/sites/{{site_id}}
self_link: sites/{{site_id}}/config
create_url: sites/{{site_id}}/config?update_mask=maxVersions,cloudLoggingEnabled # SiteConfig is created as part of Site creation, treat as an update
create_verb: :PATCH
update_verb: :PATCH
update_mask: true
description: |
A `SiteConfig` contains metadata associated with a specific site that
controls Firebase Hosting serving behavior
parameters:
- !ruby/object:Api::Type::String
name: site_id
description: |
Required. Immutable. A globally unique identifier for the Hosting site. This identifier is
used to construct the Firebase-provisioned subdomains for the site, so it must also be a valid
domain name label.
input: true
url_param_only: true
properties:
- !ruby/object:Api::Type::Integer
name: maxVersions
description: |
The number of FINALIZED versions that will be held for a site before automatic deletion. When a new
version is deployed, content for versions in storage in excess of this number will be deleted, and
will no longer be billed for storage usage. Oldest versions will be deleted first; Default is 100
default_value: 100
- !ruby/object:Api::Type::Boolean
name: cloudLoggingEnabled
description: |
Whether or not web requests made by site visitors are logged via Cloud Logging.
21 changes: 21 additions & 0 deletions mmv1/products/firebasehosting/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,27 @@ overrides: !ruby/object:Overrides::ResourceOverrides
site_id: site-with-app
test_env_vars:
project_id: :PROJECT_NAME
SiteConfig: !ruby/object:Overrides::Terraform::ResourceOverride
import_format: ['projects/{{project}}/sites/{{site_id}}/config', 'sites/{{site_id}}/config', '{{site_id}}/config']
skip_delete: true # SiteConfig is a singleton child of Site
skip_sweeper: true # no sweeper
examples:
- !ruby/object:Provider::Terraform::Examples
name: "firebasehosting_siteconfig_basic"
min_version: "beta"
primary_resource_id: "default"
vars:
site_id: site-config
test_env_vars:
project_id: :PROJECT_NAME
- !ruby/object:Provider::Terraform::Examples
name: "firebasehosting_siteconfig_full"
min_version: "beta"
primary_resource_id: "full"
vars:
site_id: site-config-full
test_env_vars:
project_id: :PROJECT_NAME
# This is for copying files over
files: !ruby/object:Provider::Config::Files
# These files have templating (ERB) code that will be run.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "google_firebase_hosting_site" "default" {
provider = google-beta
project = "<%= ctx[:test_env_vars]['project_id'] %>"
site_id = "<%= ctx[:vars]['site_id'] %>"
}

resource "google_firebase_hosting_site_config" "default" {
provider = google-beta
project = "<%= ctx[:test_env_vars]['project_id'] %>"
site_id = "<%= ctx[:vars]['site_id'] %>"

depends_on = [google_firebase_hosting_site.default]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resource "google_firebase_hosting_site" "default" {
provider = google-beta
project = "<%= ctx[:test_env_vars]['project_id'] %>"
site_id = "<%= ctx[:vars]['site_id'] %>"
}

resource "google_firebase_hosting_site_config" "full" {
provider = google-beta
project = "<%= ctx[:test_env_vars]['project_id'] %>"
site_id = "<%= ctx[:vars]['site_id'] %>"
max_versions = 100
cloud_logging_enabled = true

depends_on = [google_firebase_hosting_site.default]
}

0 comments on commit 6d3c8ac

Please sign in to comment.