-
Notifications
You must be signed in to change notification settings - Fork 2
/
gke_modules.tf
90 lines (78 loc) · 3.64 KB
/
gke_modules.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
module "prometheus" {
source = "./modules/prometheus-grafana"
load_config_file = false
host = module.gke.primary_cluster_endpoint
token = module.gke.primary_cluster_token
cluster_ca_certificate = module.gke.primary_cluster_ca_certificate
client_key = ""
client_certificate = ""
depends_on_nginx_plus = [module.gke.primary_endpoint, module.gke.node_pool, module.gke.endpoint]
}
module "api-deployment" {
source = "./modules/apis"
tls_crt = file("default.crt")
tls_key = file("default.key")
image = "ingress/${var.ingress_controller_image_name}:${var.ingress_conroller_version}"
load_config_file = false
host = module.gke.primary_cluster_endpoint
token = module.gke.primary_cluster_token
cluster_ca_certificate = module.gke.primary_cluster_ca_certificate
client_key = ""
client_certificate = ""
weather-api-image = var.weather-api-image
echo-api-image = var.echo-api-image
swapi-image = var.swapi-image
depends_on_nginx_plus = [module.nginx-plus-ingress-deployment.lb_ip, module.gke.primary_endpoint, module.gke.node_pool, module.gke.endpoint]
}
locals {
external_loadbalancer = module.nginx-plus-ingress-deployment.lb_ip
grafana_dashboard_url = module.prometheus.lb_ip
}
module "nginx-plus-ingress-deployment" {
source = "./modules/nginx-plus"
tls_crt = file("default.crt")
tls_key = file("default.key")
name_of_ingress_container = var.name_of_ingress_container
ingress_conroller_version = var.ingress_conroller_version
image = "${var.gke_container_registry_region}/${var.project_id}/${var.ingress_controller_image_name}:${var.ingress_conroller_version}"
load_config_file = false
host = module.gke.primary_cluster_endpoint
token = module.gke.primary_cluster_token
cluster_ca_certificate = module.gke.primary_cluster_ca_certificate
client_key = ""
client_certificate = ""
depends_on_kube = [module.gke.primary_endpoint, module.gke.node_pool, module.gke.endpoint]
}
module "gke" {
depends_on_kic = [module.kic.id, random_pet.myprefix]
source = "./modules/gke"
project_id = var.project_id
region = var.region
kubernetes_version = var.gke_kubernetes_version
machine_type = var.machine_type
gke_username = var.gke_username
gke_password = var.gke_password
gke_num_nodes = var.gke_num_nodes
network = "${random_pet.myprefix.id}-${var.network}"
subnetwork = "${random_pet.myprefix.id}-${var.subnetwork}"
tag_1_node_pool = var.tag_1_node_pool
tag_2_node_pool = var.tag_2_node_pool
unique_user_id = var.unique_user_id
environment = var.environment
subnetwork_cidr = var.subnetwork_cidr
gke_cluster_name = "${random_pet.myprefix.id}-${var.gke_cluster_name}"
initial_node_count = var.initial_node_count
ingress_conroller_version = var.ingress_conroller_version
ingress_controller_prefix = "${var.gke_container_registry_region}/${var.project_id}"
ingress_controller_image_name = var.ingress_controller_image_name
}
module "kic" {
source = "./modules/kic"
ingress_conroller_version = var.ingress_conroller_version
ingress_controller_prefix = "${var.gke_container_registry_region}/${var.project_id}"
ingress_controller_image_name = var.ingress_controller_image_name
}
resource "random_pet" "myprefix" {
length = 1
prefix = var.prefix
}