-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.tf
157 lines (124 loc) · 4.81 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
module "clusters" {
source = "./modules/clusters"
home_region = var.home_region
tenancy_id = var.tenancy_id
compartment_id = var.compartment_id
label_prefix = var.label_prefix
# ssh keys
ssh_public_key_path = var.ssh_public_key_path
# networking
cidrs = var.cidrs
connectivity_mode = var.connectivity_mode
kubernetes_version = var.kubernetes_version
# clusters
admin_region = var.admin_region
clusters = var.managed_clusters
cluster_type = var.cluster_type
oke_control_plane = var.oke_control_plane
preferred_cni = var.preferred_cni
worker_cloud_init = var.worker_cloud_init
nodepools = var.nodepools
thanos = var.thanos
providers = {
oci.home = oci.home,
oci.johannesburg = oci.johannesburg,
oci.chuncheon = oci.chuncheon,
oci.hyderabad = oci.hyderabad,
oci.mumbai = oci.mumbai,
oci.osaka = oci.osaka,
oci.seoul = oci.seoul,
oci.singapore = oci.singapore,
oci.tokyo = oci.tokyo,
oci.amsterdam = oci.amsterdam,
oci.frankfurt = oci.frankfurt,
oci.london = oci.london,
oci.madrid = oci.madrid,
oci.marseille = oci.marseille,
oci.milan = oci.milan,
oci.newport = oci.newport,
oci.paris = oci.paris,
oci.stockholm = oci.stockholm,
oci.zurich = oci.zurich,
oci.abudhabi = oci.abudhabi,
oci.dubai = oci.dubai,
oci.jeddah = oci.jeddah,
oci.jerusalem = oci.jerusalem,
oci.melbourne = oci.melbourne,
oci.sydney = oci.sydney,
oci.santiago = oci.santiago,
oci.saupaulo = oci.saupaulo,
oci.vinhedo = oci.vinhedo,
oci.ashburn = oci.ashburn,
oci.chicago = oci.chicago,
oci.montreal = oci.montreal,
oci.phoenix = oci.phoenix,
oci.queretaro = oci.queretaro,
oci.sanjose = oci.sanjose,
oci.toronto = oci.toronto
}
}
module "verrazzano" {
source = "./modules/verrazzano"
label_prefix = var.label_prefix
bastion_ip = module.admin.bastion_public_ip
operator_ip = module.admin.operator_private_ip
ssh_private_key_path = var.ssh_private_key_path
cluster_type = var.cluster_type
# verrazzano
install_verrazzano = var.install_verrazzano
verrazzano_version = var.verrazzano_version
# verrazzano infrastructure
admin_region = var.admin_region
oke_control_plane = var.oke_control_plane
verrazzano_profile = var.verrazzano_profile
verrazzano_control_plane = var.verrazzano_control_plane
verrazzano_data_plane = var.verrazzano_data_plane
verrazzano_load_balancer = var.verrazzano_load_balancer
all_cluster_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = module.admin.cluster_id }, local.managed_clusters)
managed_cluster_ids = local.managed_clusters
int_nsg_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = module.admin.int_lb_nsg_id }, local.cluster_int_nsg_ids)
int_lb_subnet_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = module.admin.int_lb_subnet_id }, local.cluster_int_lb_subnet_ids)
pub_nsg_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = module.admin.pub_lb_nsg_id }, local.cluster_pub_nsg_ids)
# verrazzano components
argocd = var.argocd
cluster_api = var.cluster_api
coherence = var.coherence
configure_dns = var.configure_dns
console = var.console
fluentd = var.fluentd
grafana = var.grafana
jaeger = var.jaeger
kiali = var.kiali
kube_state_metrics = var.kube_state_metrics
opensearch = var.opensearch
opensearch_dashboards = var.opensearch_dashboards
prometheus = var.prometheus
prometheus_operator = var.prometheus_operator
rancher = var.rancher
thanos = var.thanos
velero = var.velero
weblogic_operator = var.weblogic_operator
# dns
dns_compartment_id = var.dns_compartment_id
dns_secret_id = var.dns_secret_id
dns_zone_id = var.dns_zone_id
dns_zone_name = var.dns_zone_name
# istio
mesh_id = var.mesh_id
istio_model = var.istio_model
depends_on = [
module.clusters
]
count = tobool(var.get_kubeconfigs) ? 1 : 0
}
resource "oci_identity_policy" "workload-identity" {
provider = oci.home
compartment_id = var.compartment_id
description = format("Workload Identity Policy for OKE clusters to write metrics to Object Storage")
name = format("oke-%v-%s", "thanos", module.admin.state_id)
statements = flatten(local.thanos_policy_statement)
lifecycle {
ignore_changes = [defined_tags, freeform_tags]
}
count = var.cluster_type == "enhanced" ? 1 : 0
}