-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvpc_endpoint.tf
63 lines (62 loc) · 2.46 KB
/
vpc_endpoint.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
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint
resource "aws_vpc_endpoint" "ecr" {
vpc_id = aws_vpc.this.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = [for subnet in aws_subnet.private : subnet.id]
security_group_ids = [aws_security_group.endpoint_sg.id]
private_dns_enabled = true
tags = {
"Name" = "${var.name}-ecr"
}
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.this.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = [for subnet in aws_subnet.private : subnet.id]
security_group_ids = [aws_security_group.endpoint_sg.id]
private_dns_enabled = true
tags = {
"Name" = "${var.name}-ecr-api"
}
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint
resource "aws_vpc_endpoint" "cloudwatch" {
vpc_id = aws_vpc.this.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = [for subnet in aws_subnet.private : subnet.id]
security_group_ids = [aws_security_group.endpoint_sg.id]
private_dns_enabled = true
tags = {
"Name" = "${var.name}-logs"
}
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint
resource "aws_vpc_endpoint" "secrets_manager" {
vpc_id = aws_vpc.this.id
service_name = "com.amazonaws.${var.region}.secretsmanager"
vpc_endpoint_type = "Interface"
subnet_ids = [for subnet in aws_subnet.private : subnet.id]
security_group_ids = [aws_security_group.endpoint_sg.id]
private_dns_enabled = true
tags = {
"Name" = "${var.name}-secrets-manager"
}
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.this.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
tags = {
"Name" = "${var.name}-s3"
}
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint_route_table_association
resource "aws_vpc_endpoint_route_table_association" "s3_association" {
route_table_id = aws_route_table.this_rt_private.id
vpc_endpoint_id = aws_vpc_endpoint.s3.id
}