Skip to content

Commit 9bc968a

Browse files
authored
Merge pull request #522 from Kitware/cloudflare-5
Upgrade Cloudflare Terraform provider to v5
2 parents bda6a6a + a897876 commit 9bc968a

3 files changed

Lines changed: 46 additions & 51 deletions

File tree

terraform/.terraform.lock.hcl

Lines changed: 11 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

terraform/main.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ terraform {
1717
source = "heroku/heroku"
1818
}
1919
cloudflare = {
20-
source = "cloudflare/cloudflare"
21-
version = "4.52.7"
20+
source = "cloudflare/cloudflare"
2221
}
2322
}
2423
}

terraform/www.tf

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,69 @@ locals {
44
}
55
}
66

7-
data "cloudflare_accounts" "this" {
8-
name = "Kitware"
7+
data "cloudflare_account" "this" {
8+
# Kitware
9+
account_id = "b7ba799b50a979650d3362e965257042"
910
}
1011

1112
resource "cloudflare_pages_project" "www" {
12-
account_id = data.cloudflare_accounts.this.accounts[0].id
13+
account_id = data.cloudflare_account.this.id
1314
name = "bats-ai"
1415
production_branch = "main"
1516

16-
source {
17+
source = {
1718
type = "github"
18-
config {
19+
config = {
1920
production_branch = "main"
2021
owner = "Kitware"
2122
repo_name = "batai"
23+
path_includes = ["client/*"]
2224
}
2325
}
2426

25-
build_config {
27+
build_config = {
2628
build_caching = true
2729
root_dir = "client"
2830
build_command = "npm run build"
2931
destination_dir = "dist"
3032
}
3133

32-
deployment_configs {
33-
preview {
34-
environment_variables = local.www_env_vars
34+
deployment_configs = {
35+
preview = {
36+
env_vars = {
37+
for k, v in local.www_env_vars : k => {
38+
type = "plain_text"
39+
value = v
40+
}
41+
}
3542
}
36-
production {
37-
environment_variables = merge(
38-
local.www_env_vars,
43+
production = {
44+
env_vars = merge(
45+
{
46+
for k, v in local.www_env_vars : k => {
47+
type = "plain_text"
48+
value = v
49+
}
50+
},
3951
{
40-
VITE_SENTRY_DSN = "https://a224627951abd0f0606d8578cacef5d6@o267860.ingest.us.sentry.io/4510829950730240"
52+
VITE_SENTRY_DSN = {
53+
type = "plain_text"
54+
value = "https://a224627951abd0f0606d8578cacef5d6@o267860.ingest.us.sentry.io/4510829950730240"
55+
}
56+
SENTRY_AUTH_TOKEN = {
57+
type = "secret_text"
58+
value = var.SENTRY_AUTH_TOKEN
59+
}
4160
},
4261
)
43-
secrets = {
44-
SENTRY_AUTH_TOKEN = var.SENTRY_AUTH_TOKEN
45-
}
4662
}
4763
}
4864
}
4965

5066
resource "cloudflare_pages_domain" "www" {
51-
account_id = data.cloudflare_accounts.this.accounts[0].id
67+
account_id = data.cloudflare_account.this.id
5268
project_name = cloudflare_pages_project.www.name
53-
domain = aws_route53_record.www.fqdn
69+
name = aws_route53_record.www.fqdn
5470
}
5571

5672
resource "aws_route53_record" "www" {

0 commit comments

Comments
 (0)