Skip to content

Commit 9fb0730

Browse files
feat: add support for region in vpc-endpoints module
1 parent ef24f75 commit 9fb0730

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

modules/vpc-endpoints/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ No modules.
9595
| <a name="input_create"></a> [create](#input\_create) | Determines whether resources will be created | `bool` | `true` | no |
9696
| <a name="input_create_security_group"></a> [create\_security\_group](#input\_create\_security\_group) | Determines if a security group is created | `bool` | `false` | no |
9797
| <a name="input_endpoints"></a> [endpoints](#input\_endpoints) | A map of interface and/or gateway endpoints containing their properties and configurations | `any` | `{}` | no |
98+
| <a name="input_region"></a> [region](#input\_region) | Region where the resource(s) will be managed. Defaults to the region set in the provider configuration | `string` | `null` | no |
9899
| <a name="input_security_group_description"></a> [security\_group\_description](#input\_security\_group\_description) | Description of the security group created | `string` | `null` | no |
99100
| <a name="input_security_group_ids"></a> [security\_group\_ids](#input\_security\_group\_ids) | Default security group IDs to associate with the VPC endpoints | `list(string)` | `[]` | no |
100101
| <a name="input_security_group_name"></a> [security\_group\_name](#input\_security\_group\_name) | Name to use on security group created. Conflicts with `security_group_name_prefix` | `string` | `null` | no |

modules/vpc-endpoints/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ data "aws_vpc_endpoint_service" "this" {
2424
resource "aws_vpc_endpoint" "this" {
2525
for_each = local.endpoints
2626

27+
region = var.region
28+
2729
vpc_id = var.vpc_id
2830
service_name = try(each.value.service_endpoint, data.aws_vpc_endpoint_service.this[each.key].service_name)
2931
service_region = try(each.value.service_region, null)
@@ -76,6 +78,8 @@ resource "aws_vpc_endpoint" "this" {
7678
resource "aws_security_group" "this" {
7779
count = var.create && var.create_security_group ? 1 : 0
7880

81+
region = var.region
82+
7983
name = var.security_group_name
8084
name_prefix = var.security_group_name_prefix
8185
description = var.security_group_description
@@ -95,6 +99,8 @@ resource "aws_security_group" "this" {
9599
resource "aws_security_group_rule" "this" {
96100
for_each = { for k, v in var.security_group_rules : k => v if var.create && var.create_security_group }
97101

102+
region = var.region
103+
98104
# Required
99105
security_group_id = aws_security_group.this[0].id
100106
protocol = try(each.value.protocol, "tcp")

modules/vpc-endpoints/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ variable "create" {
44
default = true
55
}
66

7+
variable "region" {
8+
description = "Region where the resource(s) will be managed. Defaults to the region set in the provider configuration"
9+
type = string
10+
default = null
11+
}
12+
713
variable "vpc_id" {
814
description = "The ID of the VPC in which the endpoint will be used"
915
type = string

0 commit comments

Comments
 (0)