Skip to content

Commit

Permalink
Firebase Hosting site Terraform provider (#6598) (#12960)
Browse files Browse the repository at this point in the history
* Firebase Hosting site Terraform provider

* Add sweeper to Firebase Hosting Site

* Add a basic hosting site without app

* Move app_id to test_vars_overrides to avoid adding random_suffix

* Add defaultUrl. Shorten base_url. Add sites/site-id import

* Create new web app as part of hosting site test

* Fix tab vs spaces

* Separate basic and full test for firebasehosting

* Add update test for google_firebase_hosting_site

* Use immediate delete for test web app

* Use deletion_policy = DELETE for handwritten update test

* Address feedack on site_id name

* Use specific Firebase Hosting docs

Signed-off-by: Modular Magician <magic-modules@google.com>

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Nov 7, 2022
1 parent 6464764 commit a03efd4
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/6598.txt
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_firebase_hosting_site`
```
1 change: 1 addition & 0 deletions google/resource_firebase_hosting_site_test.go
@@ -0,0 +1 @@
package google
129 changes: 129 additions & 0 deletions website/docs/r/firebase_hosting_site.html.markdown
@@ -0,0 +1,129 @@
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Firebase Hosting"
page_title: "Google: google_firebase_hosting_site"
description: |-
A `Site` represents a Firebase Hosting site.
---

# google\_firebase\_hosting\_site

A `Site` represents a Firebase Hosting site.

~> **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.

To get more information about Site, see:

* [API documentation](https://firebase.google.com/docs/reference/hosting/rest/v1beta1/projects.sites)
* How-to Guides
* [Official Documentation](https://firebase.google.com/docs/hosting)

## Example Usage - Firebasehosting Site Basic


```hcl
resource "google_firebase_hosting_site" "default" {
provider = google-beta
project = "my-project-name"
site_id = "site-no-app"
}
```
## Example Usage - Firebasehosting Site Full


```hcl
resource "google_firebase_web_app" "default" {
provider = google-beta
project = "my-project-name"
display_name = "Test web app for Firebase Hosting"
deletion_policy = "DELETE"
}
resource "google_firebase_hosting_site" "full" {
provider = google-beta
project = "my-project-name"
site_id = "site-with-app"
app_id = google_firebase_web_app.default.app_id
}
```

## Argument Reference

The following arguments are supported:



- - -


* `app_id` -
(Optional)
Optional. The [ID of a Web App](https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects.webApps#WebApp.FIELDS.app_id)
associated with the Hosting site.

* `site_id` -
(Optional)
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.

* `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 `projects/{{project}}/sites/{{site_id}}`

* `name` -
Output only. The fully-qualified resource name of the Hosting site, in the
format: projects/PROJECT_IDENTIFIER/sites/SITE_ID PROJECT_IDENTIFIER: the
Firebase project's
[`ProjectNumber`](https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects#FirebaseProject.FIELDS.project_number) ***(recommended)*** or its
[`ProjectId`](https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects#FirebaseProject.FIELDS.project_id).
Learn more about using project identifiers in Google's
[AIP 2510 standard](https://google.aip.dev/cloud/2510).

* `default_url` -
The default URL for the site in the form of https://{name}.web.app


## Timeouts

This resource provides the following
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:

- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.

## Import


Site can be imported using any of these accepted formats:

```
$ terraform import google_firebase_hosting_site.default projects/{{project}}/sites/{{site_id}}
$ terraform import google_firebase_hosting_site.default {{project}}/{{site_id}}
$ terraform import google_firebase_hosting_site.default sites/{{site_id}}
$ terraform import google_firebase_hosting_site.default {{site_id}}
```

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).

0 comments on commit a03efd4

Please sign in to comment.