-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.tf
82 lines (66 loc) · 1.92 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
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = true
}
resource "aws_internet_gateway" "main" {
vpc_id = aws_vpc.main.id
}
resource "aws_route_table" "main" {
vpc_id = aws_vpc.main.id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.main.id
}
route {
cidr_block = "10.0.0.0/16"
gateway_id = "local"
}
}
resource "aws_subnet" "subnet_1" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.0.0/20"
availability_zone = "us-east-1b"
map_public_ip_on_launch = true
}
resource "aws_subnet" "subnet_2" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.16.0/20"
availability_zone = "us-east-1c"
map_public_ip_on_launch = true
}
resource "aws_subnet" "subnet_3" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.32.0/20"
availability_zone = "us-east-1d"
map_public_ip_on_launch = true
}
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 19.0"
cluster_name = "my-cluster-eks"
cluster_version = "1.27"
cluster_endpoint_public_access = true
vpc_id = aws_vpc.main.id
subnet_ids = [aws_subnet.subnet_1.id, aws_subnet.subnet_2.id, aws_subnet.subnet_3.id]
control_plane_subnet_ids = [aws_subnet.subnet_1.id, aws_subnet.subnet_2.id, aws_subnet.subnet_3.id]
eks_managed_node_groups = {
green = {
min_size = 1
max_size = 1
desired_size = 1
instance_types = ["t3.medium"]
}
}
}
resource "aws_ecr_repository" "microservice_a" {
name = "microservice-a"
}
resource "aws_ecr_repository" "microservice_b" {
name = "microservice-b"
}
output "ecr_repository_url_microservice_a" {
value = aws_ecr_repository.microservice_a.repository_url
}
output "ecr_repository_url_microservice_b" {
value = aws_ecr_repository.microservice_b.repository_url
}