|
| 1 | +locals { |
| 2 | + wiki_test_domain = "test.wiki.nixos.org" |
| 3 | +} |
| 4 | + |
| 5 | +resource "fastly_service_vcl" "wiki-test" { |
| 6 | + name = local.wiki_test_domain |
| 7 | + default_ttl = 86400 |
| 8 | + |
| 9 | + backend { |
| 10 | + address = "he1.wiki.nixos.org" |
| 11 | + auto_loadbalance = false |
| 12 | + between_bytes_timeout = 10000 |
| 13 | + connect_timeout = 5000 |
| 14 | + error_threshold = 0 |
| 15 | + first_byte_timeout = 15000 |
| 16 | + max_conn = 200 |
| 17 | + name = "wiki_backend" |
| 18 | + port = 443 |
| 19 | + # Shield location for Helsinki backend |
| 20 | + shield = "hel-helsinki-fi" |
| 21 | + ssl_cert_hostname = "he1.wiki.nixos.org" |
| 22 | + ssl_check_cert = true |
| 23 | + use_ssl = true |
| 24 | + weight = 100 |
| 25 | + } |
| 26 | + |
| 27 | + domain { |
| 28 | + name = local.wiki_test_domain |
| 29 | + } |
| 30 | + |
| 31 | + # Pass through the original Host header |
| 32 | + header { |
| 33 | + destination = "http.Host" |
| 34 | + type = "request" |
| 35 | + action = "set" |
| 36 | + name = "Set Host Header" |
| 37 | + source = "\"wiki.nixos.org\"" |
| 38 | + } |
| 39 | + |
| 40 | + logging_s3 { |
| 41 | + name = "${local.wiki_test_domain}-to-s3" |
| 42 | + bucket_name = local.fastlylogs["bucket_name"] |
| 43 | + compression_codec = "zstd" |
| 44 | + domain = local.fastlylogs["s3_domain"] |
| 45 | + format = local.fastlylogs["format"] |
| 46 | + format_version = 2 |
| 47 | + path = "${local.wiki_test_domain}/" |
| 48 | + period = local.fastlylogs["period"] |
| 49 | + message_type = "blank" |
| 50 | + s3_iam_role = local.fastlylogs["iam_role_arn"] |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +resource "fastly_tls_subscription" "wiki-test" { |
| 55 | + domains = [for domain in fastly_service_vcl.wiki-test.domain : domain.name] |
| 56 | + configuration_id = local.fastly_tls12_sni_configuration_id |
| 57 | + certificate_authority = "lets-encrypt" |
| 58 | +} |
| 59 | + |
| 60 | +output "wiki_test_acme_challenge" { |
| 61 | + value = fastly_tls_subscription.wiki-test.managed_dns_challenges |
| 62 | + description = "ACME challenge records for test.wiki.nixos.org - add these to DNS" |
| 63 | +} |
0 commit comments