-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
152 lines (118 loc) · 3.29 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
module "eks_cluster" {
source = "cloudposse/eks-cluster/aws"
version = "0.45.0"
namespace = var.namespace
stage = var.stage
name = var.name
region = var.region
create_security_group = true
vpc_id = var.vpc_id
subnet_ids = var.subnet_ids
kubernetes_version = "1.22"
oidc_provider_enabled = true
enabled_cluster_log_types = []
wait_for_cluster_command = "curl --silent --fail --retry 90 --retry-delay 5 --retry-connrefused --insecure --output /dev/null $ENDPOINT/healthz"
}
module "eks_node_group" {
source = "cloudposse/eks-node-group/aws"
version = "0.28.0"
namespace = var.namespace
stage = var.stage
name = var.name
instance_types = ["t3a.small"]
subnet_ids = var.subnet_ids
cluster_name = module.eks_cluster.eks_cluster_id
desired_size = 12
min_size = 6
max_size = 12
kubernetes_version = ["1.22"]
resources_to_tag = ["instance", "volume", "network-interface"]
label_key_case = "title"
capacity_type = "SPOT"
associated_security_group_ids = [module.eks_cluster.security_group_id]
depends_on = [module.eks_cluster.kubernetes_config_map_id]
create_before_destroy = true
node_group_terraform_timeouts = [{
create = "40m"
update = null
delete = "20m"
}]
}
module "efs" {
source = "cloudposse/efs/aws"
version = "0.32.6"
namespace = var.namespace
stage = var.stage
name = var.name
region = var.region
vpc_id = var.vpc_id
subnets = var.subnet_ids
allowed_security_group_ids = [module.eks_cluster.security_group_id]
}
resource "helm_release" "cert_manager" {
depends_on = [module.eks_node_group]
name = "cert-manager"
repository = "https://charts.jetstack.io"
chart = "cert-manager"
version = "v1.7.1"
namespace = "cert-manager"
create_namespace = true
set {
name = "installCRDs"
value = "true"
}
}
resource "helm_release" "nginx_ingress" {
depends_on = [helm_release.cert_manager, module.eks_node_group]
name = "nginx-ingress"
repository = "https://charts.bitnami.com/bitnami"
chart = "nginx-ingress-controller"
version = "9.1.5"
namespace = "nginx"
create_namespace = true
set {
name = "ingressClassResource.default"
value = "true"
}
set {
name = "publishService.enabled"
value = "true"
}
values = [
<<EOF
config:
hsts: "false"
EOF
]
}
resource "helm_release" "external_dns_helm" {
depends_on = [aws_iam_role.external_dns_controller_role, module.eks_node_group]
name = "external-dns"
repository = "https://charts.bitnami.com/bitnami"
chart = "external-dns"
version = "6.1.5"
namespace = "external-dns"
create_namespace = true
force_update = true
set {
name = "serviceAccount.name"
value = "external-dns-controller"
}
set {
name = "sources"
value = "{ingress}"
}
values = [
<<EOF
serviceAccount:
annotations:
eks.amazonaws.com/role-arn: ${aws_iam_role.external_dns_controller_role.arn}
EOF
]
}
resource "aws_route53_zone" "hireryan" {
name = "hireryan.today"
}
resource "aws_route53_zone" "tailswiki" {
name = "tailswiki.com"
}