Skip to content

Commit

Permalink
feat: codify the infra
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobCoffee committed Sep 3, 2024
1 parent 2a45f8c commit dd8831b
Show file tree
Hide file tree
Showing 12 changed files with 581 additions and 0 deletions.
15 changes: 15 additions & 0 deletions infra/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

**/.terraform/*
*.tfstate
*.tfstate.*
crash.log
crash.*.log
*.tfvars
*.tfvars.json
override.tf
override.tf.json
*_override.tf
*_override.tf.json
.terraform.tfstate.lock.info
.terraformrc
terraform.rc
24 changes: 24 additions & 0 deletions infra/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions infra/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.PHONY: fmt
fmt:
@terraform fmt ./**/*.tf

.PHONY: check
check:
@terraform validate

.PHONY: yolo
yolo:
@echo "Wise, you are not..."
@terraform apply -auto-approve
49 changes: 49 additions & 0 deletions infra/cdn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Fastly CDN Config

This module creates Fastly services for the Python.org CDN.

## Usage
# Fastly VCL Terraform Module

This Terraform module configures a Fastly service using VCL (Varnish Configuration Language) for Python.org. It sets up a robust CDN configuration with various features to optimize performance, security, and logging.

## Features

- Configures Fastly VCL service for Python.org
- Supports multiple domains (primary and extra domains)
- Sets up backends with health checks
- Implements caching strategies and TTL configurations
- Configures HTTPS and HSTS
- Implements rate limiting
- Sets up logging to Datadog and S3
- Configures various headers and request/response manipulations
- Implements IP blocking capabilities

## Usage

```hcl
module "fastly_production" {
source = "./cdn"
name = "CoolPythonApp.org"
domain = "CoolPythonApp.org"
extra_domains = ["www.CoolPythonApp.org"]
backend_address = "service.CoolPythonApp.org"
default_ttl = 3600
datadog_key = var.DATADOG_API_KEY
fastly_key = var.FASTLY_API_KEY
fastly_header_token = var.FASTLY_HEADER_TOKEN
fastly_s3_logging = var.fastly_s3_logging
}
```

## Outputs

N/A

## Requirements

Tested on
- Tested on Terraform 1.8.5
- Fastly provider 5.13.0
25 changes: 25 additions & 0 deletions infra/cdn/certs/psf.io.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-----BEGIN CERTIFICATE-----
MIIEQzCCAyugAwIBAgIUYH38nEb2KLRgscKhjcNpBLRUz+UwDQYJKoZIhvcNAQEL
BQAwgbAxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIDAZPcmVnb24xEjAQBgNVBAcMCUJl
YXZlcnRvbjEjMCEGA1UECgwaUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24xHDAa
BgNVBAsME0luZnJhc3RydWN0dXJlIFRlYW0xDzANBgNVBAMMBlBTRl9DQTEoMCYG
CSqGSIb3DQEJARYZaW5mcmFzdHJ1Y3R1cmVAcHl0aG9uLm9yZzAeFw0yNDAyMTIx
NzU0MDZaFw0yOTAyMTAxNzU0MDZaMIGwMQswCQYDVQQGEwJVUzEPMA0GA1UECAwG
T3JlZ29uMRIwEAYDVQQHDAlCZWF2ZXJ0b24xIzAhBgNVBAoMGlB5dGhvbiBTb2Z0
d2FyZSBGb3VuZGF0aW9uMRwwGgYDVQQLDBNJbmZyYXN0cnVjdHVyZSBUZWFtMQ8w
DQYDVQQDDAZQU0ZfQ0ExKDAmBgkqhkiG9w0BCQEWGWluZnJhc3RydWN0dXJlQHB5
dGhvbi5vcmcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCXAZagv2UK
AEnnnnrK/WWcZIKo/l+HTgL01XhReu9CDNs3f3ESlRT3Y4Hbla/pYRu9VM8tMGYS
xG5FGJQ2JPVnKCb3mIEC7wy9+VOaQIp3l8+o0lDQhsOZs78ZA8XQpNLD5OURsUHJ
re1U6WOTryMJwxpO+DzSBU+oSwfdn2k0BAJqSeIU45hHXeHO24z7GePuk3I1wb+E
vfhtdIF/tHvF1I6h7ntmHUeUWYrTKXKB9meMAFwEC1ZNoN1z05X68cSe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