-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.tf
More file actions
44 lines (37 loc) · 1.13 KB
/
main.tf
File metadata and controls
44 lines (37 loc) · 1.13 KB
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
# VPC Interface Endpoint in the consumer VPC.
# Connects to a PrivateLink Endpoint Service in another VPC,
# giving local services a DNS name that routes traffic across VPCs.
resource "aws_security_group" "endpoint" {
name = "pl-endpoint-${var.environment}-${var.stage}-${var.family}"
description = "Allow traffic to PrivateLink endpoint for ${var.family}"
vpc_id = var.vpc_id
ingress {
from_port = var.port
to_port = var.port
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Environment = var.environment
Stage = var.stage
}
}
resource "aws_vpc_endpoint" "this" {
vpc_id = var.vpc_id
service_name = var.endpoint_service_name
vpc_endpoint_type = "Interface"
subnet_ids = var.subnet_ids
private_dns_enabled = false
security_group_ids = [aws_security_group.endpoint.id]
tags = {
Name = "pl-endpoint-${var.environment}-${var.stage}-${var.family}"
Environment = var.environment
Stage = var.stage
}
}