Skip to content
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
42 changes: 11 additions & 31 deletions terraform/.terraform.lock.hcl

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

3 changes: 1 addition & 2 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ terraform {
source = "heroku/heroku"
}
cloudflare = {
source = "cloudflare/cloudflare"
version = "4.52.7"
source = "cloudflare/cloudflare"
}
}
}
Expand Down
52 changes: 34 additions & 18 deletions terraform/www.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,69 @@ locals {
}
}

data "cloudflare_accounts" "this" {
name = "Kitware"
data "cloudflare_account" "this" {
# Kitware
account_id = "b7ba799b50a979650d3362e965257042"
}

resource "cloudflare_pages_project" "www" {
account_id = data.cloudflare_accounts.this.accounts[0].id
account_id = data.cloudflare_account.this.id
name = "geodatalytics"
production_branch = "master"

source {
source = {
type = "github"
config {
config = {
production_branch = "master"
owner = "OpenGeoscience"
repo_name = "geodatalytics"
path_includes = ["web/*"]
}
}

build_config {
build_config = {
build_caching = true
root_dir = "web"
build_command = "npm run build"
destination_dir = "dist"
}

deployment_configs {
preview {
environment_variables = local.www_env_vars
deployment_configs = {
preview = {
env_vars = {
for k, v in local.www_env_vars : k => {
type = "plain_text"
value = v
}
}
}
production {
environment_variables = merge(
local.www_env_vars,
production = {
env_vars = merge(
{
for k, v in local.www_env_vars : k => {
type = "plain_text"
value = v
}
},
{
VITE_SENTRY_DSN = "https://648b9234b2fc2df0dd59192ddb0111f7@o267860.ingest.us.sentry.io/4511108704501760"
VITE_SENTRY_DSN = {
type = "plain_text"
value = "https://648b9234b2fc2df0dd59192ddb0111f7@o267860.ingest.us.sentry.io/4511108704501760"
}
SENTRY_AUTH_TOKEN = {
type = "secret_text"
value = var.SENTRY_AUTH_TOKEN
}
},
)
secrets = {
SENTRY_AUTH_TOKEN = var.SENTRY_AUTH_TOKEN
}
}
}
}

resource "cloudflare_pages_domain" "www" {
account_id = data.cloudflare_accounts.this.accounts[0].id
account_id = data.cloudflare_account.this.id
project_name = cloudflare_pages_project.www.name
domain = aws_route53_record.www.fqdn
name = aws_route53_record.www.fqdn
}

resource "aws_route53_record" "www" {
Expand Down