-
Notifications
You must be signed in to change notification settings - Fork 23
/
main.tf
119 lines (83 loc) · 2.67 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
## Alicloud Managed Kubernetes Service (ACK)
module "alibaba" {
source = "hajowieland/k8s/alicloud"
enable_alibaba = var.enable_alibaba
ali_access_key = var.ali_access_key
ali_secret_key = var.ali_secret_key
ack_node_count = var.nodes
}
## Amazon Web Services (EKS)
module "amazon" {
source = "hajowieland/k8s/aws"
enable_amazon = var.enable_amazon
}
## Digital Ocean Kubernetes ("DOK")
module "digitalocean" {
source = "hajowieland/k8s/digitalocean"
enable_digitalocean = var.enable_digitalocean
do_token = var.do_token
do_k8s_nodepool_size = var.nodes
}
## Google Cloud Platform (GKE)
module "google" {
source = "hajowieland/k8s/google"
enable_google = var.enable_google
gcp_project = var.gcp_project
gke_nodes = var.nodes
}
## Microsoft Azure (AKS)
module "microsoft" {
source = "hajowieland/k8s/azurerm"
enable_microsoft = var.enable_microsoft
az_tenant_id = var.az_tenant_id
az_client_id = var.az_client_id
az_client_secret = var.az_client_secret
aks_nodes = var.nodes
}
## Oracle Cloud Infrastructure Container Service for Kubernetes (OKE)
module "oracle" {
source = "hajowieland/k8s/oci"
enable_oracle = var.enable_oracle
oci_user_ocid = var.oci_user_ocid
oci_tenancy_ocid = var.oci_tenancy_ocid
oci_fingerprint = var.oci_fingerprint
oke_node_pool_size = var.nodes
}
# Create kubeconfig files in main module directory
# (will be created in submodule directories, too)
resource "local_file" "kubeconfigali" {
count = var.enable_alibaba ? 1 : 0
content = module.alibaba.kubeconfig_path_ali
filename = "${path.module}/kubeconfig_ali"
depends_on = [module.alibaba]
}
resource "local_file" "kubeconfigaws" {
count = var.enable_amazon ? 1 : 0
content = module.amazon.kubeconfig_path_aws
filename = "${path.module}/kubeconfig_aws"
depends_on = [module.amazon]
}
resource "local_file" "kubeconfigdo" {
count = var.enable_digitalocean ? 1 : 0
content = module.digitalocean.kubeconfig_path_do
filename = "${path.module}/kubeconfig_do"
depends_on = [module.alibaba]
}
resource "local_file" "kubeconfiggke" {
count = var.enable_google ? 1 : 0
content = module.google.kubeconfig_path_gke
filename = "${path.module}/kubeconfig_gke"
depends_on = [module.google]
}
resource "local_file" "kubeconfigaks" {
count = var.enable_microsoft ? 1 : 0
content = module.microsoft.kubeconfig_path_aks
filename = "${path.module}/kubeconfig_aks"
depends_on = [module.microsoft]
}
resource "local_file" "kubeconfigoci" {
count = var.enable_oracle ? 1 : 0
content = module.oracle.kubeconfig_path_oci
filename = "${path.module}/kubeconfig_oci"
depends_on = [module.oracle]
}