-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathmain.tf
62 lines (49 loc) · 1.37 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
provider "aws" {
region = "us-east-1"
allowed_account_ids = ["214219211678"]
}
provider "kubernetes" {
host = module.cluster.config.endpoint
cluster_ca_certificate = base64decode(module.cluster.config.ca_data)
exec {
api_version = "client.authentication.k8s.io/v1beta1"
command = "aws"
args = ["eks", "get-token", "--cluster-name", module.cluster.config.name]
}
}
data "http" "ip" {
url = "https://ipv4.icanhazip.com"
}
module "cluster" {
source = "../../"
name = var.cluster_name
vpc_config = data.terraform_remote_state.environment.outputs.vpc_config
endpoint_public_access = true
endpoint_public_access_cidrs = ["${chomp(data.http.ip.response_body)}/32"]
aws_auth_role_map = [
{
username = aws_iam_role.test_role.name
rolearn = aws_iam_role.test_role.arn
groups = ["system:masters"]
},
{
username = "system:node:{{EC2PrivateDNSName}}"
rolearn = module.karpenter.node_role_arn
groups = [
"system:bootstrappers",
"system:nodes",
]
},
]
tags = {
Project = "terraform-aws-eks"
}
}
module "karpenter" {
source = "../../modules/karpenter"
cluster_config = module.cluster.config
oidc_config = module.cluster.oidc_config
}
data "aws_security_group" "nodes" {
id = module.cluster.config.node_security_group
}