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 headers to Hosting Version #20654

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/12527.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
firebasehosting: added `headers` field in `google_firebase_hosting_version` resource (beta)
```
82 changes: 82 additions & 0 deletions website/docs/r/firebase_hosting_version.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,68 @@ resource "google_firebase_hosting_release" "default" {
message = "Redirect to Google"
}
```
## Example Usage - Firebasehosting Version Headers


```hcl
resource "google_firebase_hosting_site" "default" {
provider = google-beta
project = "my-project-name"
site_id = "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 regex
glob = "/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"
}
```
## Example Usage - Firebasehosting Version Headers Regex


```hcl
resource "google_firebase_hosting_site" "default" {
provider = google-beta
project = "my-project-name"
site_id = "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"
}
```
## Example Usage - Firebasehosting Version Path


Expand Down Expand Up @@ -228,6 +290,12 @@ The following arguments are supported:
triggers Hosting to respond with a redirect to the specified destination path.
Structure is [documented below](#nested_redirects).

* `headers` -
(Optional)
An array of objects, where each object specifies a URL pattern that, if matched to the request URL path,
triggers Hosting to apply the specified custom response headers.
Structure is [documented below](#nested_headers).


<a name="nested_rewrites"></a>The `rewrites` block supports:

Expand Down Expand Up @@ -290,6 +358,20 @@ The following arguments are supported:
}
```

<a name="nested_headers"></a>The `headers` block supports:

* `glob` -
(Optional)
The user-supplied glob to match against the request URL path.

* `regex` -
(Optional)
The user-supplied RE2 regular expression to match against the request URL path.

* `headers` -
(Required)
The additional headers to add to the response. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

## Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:
Expand Down
Loading