Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/aws/private-link/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ locals {
}

resource "aws_vpc_endpoint" "this" {
region = var.region
vpc_id = var.vpc_id
subnet_ids = var.subnet_ids
service_name = var.service_name
service_region = var.service_region != "" ? var.service_region : var.region
security_group_ids = local.security_group_ids

vpc_endpoint_type = "Interface"
Expand All @@ -92,6 +94,7 @@ resource "aws_security_group" "this" {
count = var.security_group_ids == null ? 1 : 0

name_prefix = var.service_name
region = var.region
vpc_id = var.vpc_id
description = "For access vpc endpoint service ${var.service_name}"

Expand All @@ -107,6 +110,7 @@ resource "aws_security_group" "this" {
resource "aws_security_group_rule" "this" {
for_each = { for k, v in local.security_group_rules : k => v if var.security_group_ids == null }

region = var.region
security_group_id = aws_security_group.this[0].id
type = each.value.type
protocol = each.value.protocol
Expand Down
8 changes: 7 additions & 1 deletion modules/aws/private-link/variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
variable "region" {
type = string
description = "The region of vpc endpoint service. The VPC Endpoint must be the same region as Endpoint Service"
description = "The region of vpc endpoint to be created. This should be the same as the region of the VPC."
}

variable "service_region" {
type = string
description = "The region of the VPC endpoint service. The VPC Endpoint can be in a different region, will fallback to the VPC endpoint region if not specified."
default = ""
}

variable "vpc_id" {
Expand Down
Loading