-
Notifications
You must be signed in to change notification settings - Fork 1
/
eks-vpc-endpoints.tf
109 lines (98 loc) · 3.5 KB
/
eks-vpc-endpoints.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
resource "aws_vpc_endpoint" "ec2" {
count = var.enable_ec2_vpc_endpoint ? 1 : 0
vpc_id = var.vpc_id
service_name = "com.amazonaws.${data.aws_region.current.name}.ec2"
vpc_endpoint_type = "Interface"
security_group_ids = var.endpoint_security_group_ids
subnet_ids = var.subnet_ids
private_dns_enabled = var.endpoint_private_dns_enabled
tags = merge(
{
Name = "ep-${var.vpc_id}-${data.aws_region.current.name}-ec2"
},
var.tags)
}
resource "aws_vpc_endpoint" "elasticloadbalancing" {
count = var.enable_elasticloadbalancing_vpc_endpoint ? 1 : 0
vpc_id = var.vpc_id
service_name = "com.amazonaws.${data.aws_region.current.name}.elasticloadbalancing"
vpc_endpoint_type = "Interface"
security_group_ids = var.endpoint_security_group_ids
subnet_ids = var.subnet_ids
private_dns_enabled = var.endpoint_private_dns_enabled
tags = merge(
{
Name = "ep-${var.vpc_id}-${data.aws_region.current.name}-elasticloadbalancing"
},
var.tags)
}
resource "aws_vpc_endpoint" "ecr_api" {
count = var.enable_ecr_api_vpc_endpoint ? 1 : 0
vpc_id = var.vpc_id
service_name = "com.amazonaws.${data.aws_region.current.name}.ecr.api"
vpc_endpoint_type = "Interface"
security_group_ids = var.endpoint_security_group_ids
subnet_ids = var.subnet_ids
private_dns_enabled = var.endpoint_private_dns_enabled
tags = merge(
{
Name = "ep-${var.vpc_id}-${data.aws_region.current.name}-ecr.api"
},
var.tags)
}
resource "aws_vpc_endpoint" "ecr_dkr" {
count = var.enable_ecr_dkr_vpc_endpoint ? 1 : 0
vpc_id = var.vpc_id
service_name = "com.amazonaws.${data.aws_region.current.name}.ecr.dkr"
vpc_endpoint_type = "Interface"
security_group_ids = var.endpoint_security_group_ids
subnet_ids = var.subnet_ids
private_dns_enabled = var.endpoint_private_dns_enabled
tags = merge(
{
Name = "ep-${var.vpc_id}-${data.aws_region.current.name}-ecr.dkr"
},
var.tags)
}
resource "aws_vpc_endpoint" "sts" {
count = var.enable_sts_vpc_endpoint ? 1 : 0
vpc_id = var.vpc_id
service_name = "com.amazonaws.${data.aws_region.current.name}.sts"
vpc_endpoint_type = "Interface"
security_group_ids = var.endpoint_security_group_ids
subnet_ids = var.subnet_ids
private_dns_enabled = var.endpoint_private_dns_enabled
tags = merge(
{
Name = "ep-${var.vpc_id}-${data.aws_region.current.name}-sts"
},
var.tags)
}
resource "aws_vpc_endpoint" "logs" {
count = var.enable_logs_vpc_endpoint ? 1 : 0
vpc_id = var.vpc_id
service_name = "com.amazonaws.${data.aws_region.current.name}.logs"
vpc_endpoint_type = "Interface"
security_group_ids = var.endpoint_security_group_ids
subnet_ids = var.subnet_ids
private_dns_enabled = var.endpoint_private_dns_enabled
tags = merge(
{
Name = "ep-${var.vpc_id}-${data.aws_region.current.name}-logs"
},
var.tags)
}
## For S3 gateway endpoint, only route table IDs are required.
resource "aws_vpc_endpoint" "s3" {
count = var.enable_s3_vpc_endpoint ? 1 : 0
vpc_id = var.vpc_id
service_name = "com.amazonaws.${data.aws_region.current.name}.s3"
vpc_endpoint_type = "Gateway"
private_dns_enabled = var.endpoint_private_dns_enabled
route_table_ids = var.endpoint_route_table_ids
tags = merge(
{
Name = "ep-${var.vpc_id}-${data.aws_region.current.name}-s3-gateway"
},
var.tags)
}