Skip to content

Commit

Permalink
Merge pull request #7 from mastodon/provider-upgrade
Browse files Browse the repository at this point in the history
Upped the required Fastly provider version, added variables for additional Fastly products.
  • Loading branch information
timetinytim authored Mar 19, 2024
2 parents 7fdcc11 + ef66f93 commit d322575
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 25 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Contains much of the logic and default configuration that exists across all offi
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
| <a name="requirement_fastly"></a> [fastly](#requirement\_fastly) | >= 4.1.0 |
| <a name="requirement_fastly"></a> [fastly](#requirement\_fastly) | >= 5.7.1 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_fastly"></a> [fastly](#provider\_fastly) | >= 4.1.0 |
| <a name="provider_fastly"></a> [fastly](#provider\_fastly) | >= 5.7.1 |

## Modules

Expand Down Expand Up @@ -72,6 +72,7 @@ No modules.
| <a name="input_max_conn"></a> [max\_conn](#input\_max\_conn) | Maximum number of connections for the Backend. | `number` | `500` | no |
| <a name="input_min_tls_version"></a> [min\_tls\_version](#input\_min\_tls\_version) | Minimum allowed TLS version on SSL connections to the backend. | `string` | `"1.2"` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the fastly service (defaults to hostname). | `string` | `""` | no |
| <a name="input_product_enablement"></a> [product\_enablement](#input\_product\_enablement) | Which additional Fastly products to enable for this service. | <pre>object({<br> brotli_compression = optional(bool, false)<br> domain_inspector = optional(bool, false)<br> image_optimizer = optional(bool, false)<br> origin_inspector = optional(bool, false)<br> websockets = optional(bool, false)<br> })</pre> | n/a | yes |
| <a name="input_shield_region"></a> [shield\_region](#input\_shield\_region) | Which Fastly shield region to use. Should correspond with the shield code. | `string` | n/a | yes |
| <a name="input_signal_science_host"></a> [signal\_science\_host](#input\_signal\_science\_host) | Hostname to use to integrate with Signal Sciences | `string` | `""` | no |
| <a name="input_signal_science_shared_key"></a> [signal\_science\_shared\_key](#input\_signal\_science\_shared\_key) | Shared key to use when integrating with Signal Sciences | `string` | `""` | no |
Expand Down
34 changes: 17 additions & 17 deletions logging/fastly_globeviz.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"timestamp": "%{strftime(\{"%Y-%m-%dT%H:%M:%S%z"\}, time.start)}V",
"client_ip": "%{req.http.Fastly-Client-IP}V",
"geo_country": "%{client.geo.country_name}V",
"geo_city": "%{client.geo.city}V",
"host": "%{if(req.http.Fastly-Orig-Host, req.http.Fastly-Orig-Host, req.http.Host)}V",
"url": "%{json.escape(req.url)}V",
"request_method": "%{json.escape(req.method)}V",
"request_protocol": "%{json.escape(req.proto)}V",
"request_referer": "%{json.escape(req.http.referer)}V",
"request_user_agent": "%{json.escape(req.http.User-Agent)}V",
"response_state": "%{json.escape(fastly_info.state)}V",
"response_status": %{resp.status}V,
"response_reason": %{if(resp.response, "%22"+json.escape(resp.response)+"%22", "null")}V,
"response_body_size": %{resp.body_bytes_written}V,
"fastly_server": "%{json.escape(server.identity)}V",
"fastly_is_edge": %{if(fastly.ff.visits_this_service == 0, "true", "false")}V
}
"timestamp":"%{strftime(\{"%Y-%m-%dT%H:%M:%S%z"\}, time.start)}V",
"client_ip":"%{req.http.Fastly-Client-IP}V",
"geo_country":"%{client.geo.country_name}V",
"geo_city":"%{client.geo.city}V",
"host":"%{if(req.http.Fastly-Orig-Host, req.http.Fastly-Orig-Host, req.http.Host)}V",
"url":"%{json.escape(req.url)}V",
"request_method":"%{json.escape(req.method)}V",
"request_protocol":"%{json.escape(req.proto)}V",
"request_referer":"%{json.escape(req.http.referer)}V",
"request_user_agent":"%{json.escape(req.http.User-Agent)}V",
"response_state":"%{json.escape(fastly_info.state)}V",
"response_status":%{resp.status}V,
"response_reason":%{if(resp.response, "%22"+json.escape(resp.response)+"%22", "null")}V,
"response_body_size":%{resp.body_bytes_written}V,
"fastly_server":"%{json.escape(server.identity)}V",
"fastly_is_edge":%{if(fastly.ff.visits_this_service == 0, "true", "false")}V
}
10 changes: 5 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ resource "fastly_service_vcl" "app_service" {

# Additional products
product_enablement {
brotli_compression = false
domain_inspector = false
image_optimizer = false
origin_inspector = false
websockets = false
brotli_compression = var.product_enablement.brotli_compression
domain_inspector = var.product_enablement.domain_inspector
image_optimizer = var.product_enablement.image_optimizer
origin_inspector = var.product_enablement.origin_inspector
websockets = var.product_enablement.websockets
}

# Support Apple Associated Domains
Expand Down
18 changes: 18 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,24 @@ variable "vcl_snippets" {
default = []
}

variable "product_enablement" {
description = "Which additional Fastly products to enable for this service."
type = object({
brotli_compression = optional(bool, false)
domain_inspector = optional(bool, false)
image_optimizer = optional(bool, false)
origin_inspector = optional(bool, false)
websockets = optional(bool, false)
})
default = {
brotli_compression = false
domain_inspector = false
image_optimizer = false
origin_inspector = false
websockets = false
}
}

# IP block lists

variable "ip_blocklist" {
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
fastly = {
source = "fastly/fastly"
version = ">= 4.1.0"
version = ">= 5.7.1"
}
}
}

0 comments on commit d322575

Please sign in to comment.