-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendpoints.tf
68 lines (54 loc) · 1.75 KB
/
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
# VPC Endpoints for Systems Manager
resource "aws_vpc_endpoint" "ssm" {
vpc_id = data.aws_vpc.default.id
service_name = "com.amazonaws.${var.aws_region}.ssm"
vpc_endpoint_type = "Interface"
security_group_ids = [aws_security_group.vpc_endpoints.id]
subnet_ids = [data.aws_subnets.default.ids[0]]
private_dns_enabled = true
tags = {
Name = "ssm-endpoint"
Environment = var.environment
}
}
resource "aws_vpc_endpoint" "ssmmessages" {
vpc_id = data.aws_vpc.default.id
service_name = "com.amazonaws.${var.aws_region}.ssmmessages"
vpc_endpoint_type = "Interface"
security_group_ids = [aws_security_group.vpc_endpoints.id]
subnet_ids = [data.aws_subnets.default.ids[0]]
private_dns_enabled = true
tags = {
Name = "ssmmessages-endpoint"
Environment = var.environment
}
}
resource "aws_vpc_endpoint" "ec2messages" {
vpc_id = data.aws_vpc.default.id
service_name = "com.amazonaws.${var.aws_region}.ec2messages"
vpc_endpoint_type = "Interface"
security_group_ids = [aws_security_group.vpc_endpoints.id]
subnet_ids = [data.aws_subnets.default.ids[0]]
private_dns_enabled = true
tags = {
Name = "ec2messages-endpoint"
Environment = var.environment
}
}
# Security group for VPC endpoints
resource "aws_security_group" "vpc_endpoints" {
name = "vpc-endpoints-sg"
description = "Security group for VPC endpoints"
vpc_id = data.aws_vpc.default.id
ingress {
description = "HTTPS from VPC"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = [data.aws_vpc.default.cidr_block]
}
tags = {
Name = "vpc-endpoints-sg"
Environment = var.environment
}
}