-
Notifications
You must be signed in to change notification settings - Fork 1
/
endpoint.tf
44 lines (38 loc) · 1.63 KB
/
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
resource "mongodbatlas_privatelink_endpoint" "east" {
project_id = var.project_id
provider_name = "AWS"
region = "US_EAST_2"
}
resource "aws_vpc_endpoint" "east" {
vpc_id = aws_vpc.east.id
service_name = mongodbatlas_privatelink_endpoint.east.endpoint_service_name
vpc_endpoint_type = "Interface"
subnet_ids = [aws_subnet.east_public1.id]
security_group_ids = [aws_security_group.east_sg_ssh.id, aws_security_group.east_sg_mongod.id]
}
resource "mongodbatlas_privatelink_endpoint_service" "east" {
project_id = mongodbatlas_privatelink_endpoint.east.project_id
private_link_id = mongodbatlas_privatelink_endpoint.east.private_link_id
endpoint_service_id = aws_vpc_endpoint.east.id
provider_name = "AWS"
}
resource "mongodbatlas_privatelink_endpoint" "west" {
project_id = var.project_id
provider_name = "AWS"
region = "US_WEST_1"
}
resource "aws_vpc_endpoint" "west" {
provider = aws.west
vpc_id = aws_vpc.west.id
service_name = mongodbatlas_privatelink_endpoint.west.endpoint_service_name
vpc_endpoint_type = "Interface"
subnet_ids = [aws_subnet.west_public.id]
security_group_ids = [aws_security_group.west_sg_ssh.id, aws_security_group.west_sg_mongod.id]
}
resource "mongodbatlas_privatelink_endpoint_service" "west" {
project_id = mongodbatlas_privatelink_endpoint.west.project_id
private_link_id = mongodbatlas_privatelink_endpoint.west.private_link_id
endpoint_service_id = aws_vpc_endpoint.west.id
provider_name = "AWS"
depends_on = [mongodbatlas_privatelink_endpoint_service.east]
}