Skip to content

Commit

Permalink
feat: Turning on CDN for space/bucket with map data
Browse files Browse the repository at this point in the history
  • Loading branch information
martintomas committed Jun 5, 2024
1 parent 783f948 commit 8511101
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions infrastructure/base/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ locals {
BUCKET_BUCKET = "${var.project_name}-staging-cms"
BUCKET_ENDPOINT = "https://${var.do_region}.digitaloceanspaces.com"

# DigitalOcean Spaces to store map data
BUCKET_MAP_DATA_ENDPOINT = "https://${var.project_name}-staging.${var.do_region}.cdn.digitaloceanspaces.com"

# Database
DATABASE_CLIENT = "postgres"
DATABASE_HOST = module.staging.postgresql_host
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/base/modules/env/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ module "app" {
do_app_image_tag = var.do_app_image_tag
}

resource "digitalocean_cdn" "space_cdn" {
origin = module.space.bucket_domain_name
}

resource "digitalocean_spaces_bucket_cors_configuration" "space_cms_cors" {
bucket = module.space_cms.space_id
region = var.do_region
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/base/modules/space/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
output "space_id" {
value = digitalocean_spaces_bucket.project_space.id
}

output "bucket_domain_name" {
value = digitalocean_spaces_bucket.project_space.bucket_domain_name
}

0 comments on commit 8511101

Please sign in to comment.