File tree Expand file tree Collapse file tree 14 files changed +781
-819
lines changed Expand file tree Collapse file tree 14 files changed +781
-819
lines changed Original file line number Diff line number Diff line change 1
1
resource "cloudflare_record" "coder" {
2
+ for_each = local. deployments
2
3
zone_id = var. cloudflare_zone_id
3
- name = local. coder_subdomain
4
- content = google_compute_address. coder [" primary" ]. address
5
- type = " A"
6
- ttl = 3600
7
- }
8
-
9
- resource "cloudflare_record" "coder_europe" {
10
- zone_id = var. cloudflare_zone_id
11
- name = local. coder_europe_subdomain
12
- content = google_compute_address. coder [" europe" ]. address
4
+ name = each. value . subdomain
5
+ content = google_compute_address. coder [each . key ]. address
13
6
type = " A"
14
7
ttl = 3600
15
8
}
Original file line number Diff line number Diff line change
1
+ locals {
2
+ deployments = {
3
+ primary = {
4
+ subdomain = " ${ var . name } -scaletest"
5
+ url = " http://${ var . name } -scaletest.${ var . cloudflare_domain } "
6
+ region = " us-east1"
7
+ zone = " us-east1-c"
8
+ cidr = " 10.200.0.0/24"
9
+ }
10
+ europe = {
11
+ subdomain = " ${ var . name } -europe-scaletest"
12
+ url = " http://${ var . name } -europe-scaletest.${ var . cloudflare_domain } "
13
+ region = " europe-west1"
14
+ zone = " europe-west1-b"
15
+ cidr = " 10.201.0.0/24"
16
+ }
17
+ asia = {
18
+ subdomain = " ${ var . name } -asia-scaletest"
19
+ url = " http://${ var . name } -asia-scaletest.${ var . cloudflare_domain } "
20
+ region = " asia-southeast1"
21
+ zone = " asia-southeast1-a"
22
+ cidr = " 10.202.0.0/24"
23
+ }
24
+ }
25
+ }
Original file line number Diff line number Diff line change @@ -4,23 +4,6 @@ data "google_compute_default_service_account" "default" {
4
4
}
5
5
6
6
locals {
7
- clusters = {
8
- primary = {
9
- region = " us-east1"
10
- zone = " us-east1-c"
11
- cidr = " 10.200.0.0/24"
12
- }
13
- europe = {
14
- region = " europe-west1"
15
- zone = " europe-west1-b"
16
- cidr = " 10.201.0.0/24"
17
- }
18
- asia = {
19
- region = " asia-southeast1"
20
- zone = " asia-southeast1-a"
21
- cidr = " 10.202.0.0/24"
22
- }
23
- }
24
7
node_pools = {
25
8
primary_coder = {
26
9
name = " coder"
@@ -71,7 +54,7 @@ locals {
71
54
}
72
55
73
56
resource "google_container_cluster" "cluster" {
74
- for_each = local. clusters
57
+ for_each = local. deployments
75
58
name = " ${ var . name } -${ each . key } "
76
59
location = each. value . zone
77
60
project = var. project_id
@@ -118,7 +101,7 @@ resource "google_container_cluster" "cluster" {
118
101
resource "google_container_node_pool" "node_pool" {
119
102
for_each = local. node_pools
120
103
name = each. value . name
121
- location = local. clusters [each . value . cluster ]. zone
104
+ location = local. deployments [each . value . cluster ]. zone
122
105
project = var. project_id
123
106
cluster = google_container_cluster. cluster [each . value . cluster ]. name
124
107
autoscaling {
Original file line number Diff line number Diff line change 1
1
resource "google_sql_database_instance" "db" {
2
2
name = " ${ var . name } -coder"
3
3
project = var. project_id
4
- region = local. clusters . primary . region
4
+ region = local. deployments . primary . region
5
5
database_version = var. cloudsql_version
6
6
deletion_protection = false
7
7
@@ -13,7 +13,7 @@ resource "google_sql_database_instance" "db" {
13
13
availability_type = " ZONAL"
14
14
15
15
location_preference {
16
- zone = local. clusters . primary . zone
16
+ zone = local. deployments . primary . zone
17
17
}
18
18
19
19
database_flags {
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ resource "google_compute_network" "vpc" {
9
9
}
10
10
11
11
resource "google_compute_subnetwork" "subnet" {
12
- for_each = local. clusters
12
+ for_each = local. deployments
13
13
name = " ${ var . name } -${ each . key } "
14
14
project = var. project_id
15
15
region = each. value . region
@@ -18,7 +18,7 @@ resource "google_compute_subnetwork" "subnet" {
18
18
}
19
19
20
20
resource "google_compute_address" "coder" {
21
- for_each = local. clusters
21
+ for_each = local. deployments
22
22
project = var. project_id
23
23
region = each. value . region
24
24
name = " ${ var . name } -${ each . key } -coder"
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments