forked from juice-shop/multi-juicer
-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmain.tf
90 lines (70 loc) · 2 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
terraform {
# For shared state:
# Set the resource group in the backend configuration below, then uncomment and apply!
# Note that you probably already create a resource group. Don't forget to set that correctly in this file.
backend "gcs" {
bucket = "tfstate-wrongsecrets-93ac22f5"
prefix = "terraform/state"
}
}
provider "google" {
project = var.project_id
region = var.region
}
provider "random" {}
provider "http" {}
data "http" "ip" {
url = "http://ipecho.net/plain"
}
resource "google_container_cluster" "gke" {
name = var.cluster_name
location = var.region
initial_node_count = 1
min_master_version = var.cluster_version
network = google_compute_network.vpc.name
subnetwork = google_compute_subnetwork.node_subnet.name
deletion_protection = false
workload_identity_config {
workload_pool = "${var.project_id}.svc.id.goog"
}
node_config {
# Google recommends custom service accounts that have cloud-platform scope and permissions granted via IAM Roles.
service_account = google_service_account.wrongsecrets_cluster.email
machine_type = "e2-standard-2"
oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform"
]
labels = {
application = "wrongsecrets"
}
tags = ["wrongsecrets"]
}
master_authorized_networks_config {
cidr_blocks {
cidr_block = "${data.http.ip.response_body}/32"
display_name = "user origin"
}
}
cluster_autoscaling {
enabled = true
resource_limits {
resource_type = "cpu"
minimum = 2 # 1 node * 2 vCPU (e2-standard-2)
maximum = 20 # 10 nodes * 2 vCPU (e2-standard-2)
}
resource_limits {
resource_type = "memory"
minimum = 8 # 1 node * 8 GB (e2-standard-2)
maximum = 80 # 10 nodes * 8 GB (e2-standard-2)
}
}
addons_config {
gce_persistent_disk_csi_driver_config {
enabled = true
}
}
timeouts {
create = "30m"
update = "40m"
}
}