-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
67 lines (59 loc) · 2.05 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
provider "aws" {
region = "us-east-2"
shared_credentials_file = "~/.aws/credentials"
}
provider "helm" {
kubernetes {
host = module.cluster.cluster.endpoint
cluster_ca_certificate = base64decode(module.cluster.cluster.certificate_authority.0.data)
exec {
api_version = "client.authentication.k8s.io/v1alpha1"
args = ["eks", "get-token", "--cluster-name", module.cluster.cluster.name]
command = "aws"
}
}
}
provider "kubernetes" {
host = module.cluster.cluster.endpoint
cluster_ca_certificate = base64decode(module.cluster.cluster.certificate_authority.0.data)
exec {
api_version = "client.authentication.k8s.io/v1alpha1"
args = ["eks", "get-token", "--cluster-name", module.cluster.cluster.name]
command = "aws"
}
}
locals {
cluster_name = "fullstack-web-template-frontend"
}
module "network" {
source = "./modules/network"
tags = {
// Necessary for AWS Load Balancer Controller
// https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html
"kubernetes.io/cluster/${local.cluster_name}" = "shared"
}
public_subnet_tags = {
// Necessary for AWS Load Balancer Controller
// https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html
"kubernetes.io/cluster/${local.cluster_name}" = "shared"
"kubernetes.io/role/elb" = "1"
}
private_subnet_tags = {
// Necessary for AWS Load Balancer Controller
// https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html
"kubernetes.io/cluster/${local.cluster_name}" = "shared"
"kubernetes.io/role/internal-elb" = "1"
}
}
module "cluster" {
source = "./modules/cluster"
cluster_name = local.cluster_name
vpc_id = module.network.vpc_id
subnets = module.network.private_subnets
}
module "aws_load_balancer_controller" {
source = "chriszhangusc/load-balancer-controller/aws"
version = "1.0.0"
cluster = module.cluster.cluster
kubeconfig = module.cluster.kubeconfig
}