-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
90 lines (72 loc) · 1.75 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
provider "helm" {
kubernetes {
config_path = "~/.kube/demo-config"
}
}
provider "rancher2" {
alias = "bootstrap"
api_url = "https://${var.dns_name}"
bootstrap = true
}
resource "helm_release" "certmanager" {
count = var.ingress_tls_source == "secret" || var.ingress_tls_source == "external" ? 0 : 1
name = "cert-manager"
namespace = "cert-manager"
create_namespace = "true"
repository = "https://charts.jetstack.io"
chart = "cert-manager"
version = "v1.8.2"
set{
name = "installCRDs"
value = "true"
}
}
resource "helm_release" "rancher" {
name = "rancher"
namespace = "cattle-system"
create_namespace = "true"
repository = "https://releases.rancher.com/server-charts/stable"
chart = "rancher"
version = "2.6.6"
set {
name = "hostname"
value = var.dns_name
}
set {
name = "ingress.tls.source"
value = var.ingress_tls_source
}
set {
name = "letsEncrypt.email"
value = var.letsencrypt_email
}
set {
name = "letsEncrypt.ingress.class"
value = var.letsencrypt_ingress_class
}
set {
name = "auditLog.level"
value = "1"
}
set {
name = "privateCA"
value = var.private_ca
}
set {
name = "bootstrapPassword"
value = var.bootstrap_password
}
depends_on = [helm_release.certmanager]
}
module "iam" {
count = var.aws_ccm ? 1 : 0
source = "./modules/policies"
tags = var.tags
}
module "bootstrap" {
source = "./modules/bootstrap"
providers = {rancher2 = rancher2.bootstrap}
initial_password = var.bootstrap_password
rancher_url = "https://${var.dns_name}"
depends_on = [helm_release.rancher]
}