Skip to content

Commit

Permalink
Merge branch 'terraform-aws-modules:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
velkovb authored Feb 11, 2025
2 parents d8c563d + 1d991e4 commit ee58836
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.96.1
rev: v1.96.2
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,41 @@

All notable changes to this project will be documented in this file.

## [5.18.1](https://github.com/terraform-aws-modules/terraform-aws-vpc/compare/v5.18.0...v5.18.1) (2025-01-28)


### Bug Fixes

* Fixed service_region argument in the VPC endpoint module ([#1162](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1162)) ([5415dee](https://github.com/terraform-aws-modules/terraform-aws-vpc/commit/5415deebeb608f1e622a336f045c79b08d144f46))

## [5.18.0](https://github.com/terraform-aws-modules/terraform-aws-vpc/compare/v5.17.0...v5.18.0) (2025-01-27)


### Features

* Support for cross region VPC endpoints ([#1161](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1161)) ([7e205ad](https://github.com/terraform-aws-modules/terraform-aws-vpc/commit/7e205ad0513fe00290b9570cabf52f5e7ce6b84f))

## [5.17.0](https://github.com/terraform-aws-modules/terraform-aws-vpc/compare/v5.16.0...v5.17.0) (2024-12-18)


### Features

* Define default name for VPC endpoint ([#1151](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1151)) ([41348d3](https://github.com/terraform-aws-modules/terraform-aws-vpc/commit/41348d36b3fee6bc5cd58fed18c1210401ea128e))

## [5.16.0](https://github.com/terraform-aws-modules/terraform-aws-vpc/compare/v5.15.0...v5.16.0) (2024-11-18)


### Features

* Added additional conditions into Flow Log IAM Role Assumption Policy ([#1138](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1138)) ([7744d3f](https://github.com/terraform-aws-modules/terraform-aws-vpc/commit/7744d3fea63db36bcb15485f3694c0646be44da0))

## [5.15.0](https://github.com/terraform-aws-modules/terraform-aws-vpc/compare/v5.14.0...v5.15.0) (2024-11-03)


### Features

* Add option to create/delete NAT Gateway route for private route tables ([#1127](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1127)) ([f02a1af](https://github.com/terraform-aws-modules/terraform-aws-vpc/commit/f02a1af5aedc550c81048cfa880153bedf2a006d))

## [5.14.0](https://github.com/terraform-aws-modules/terraform-aws-vpc/compare/v5.13.0...v5.14.0) (2024-10-18)


Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ No modules.
| <a name="input_create_igw"></a> [create\_igw](#input\_create\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |
| <a name="input_create_multiple_intra_route_tables"></a> [create\_multiple\_intra\_route\_tables](#input\_create\_multiple\_intra\_route\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |
| <a name="input_create_multiple_public_route_tables"></a> [create\_multiple\_public\_route\_tables](#input\_create\_multiple\_public\_route\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |
| <a name="input_create_private_nat_gateway_route"></a> [create\_private\_nat\_gateway\_route](#input\_create\_private\_nat\_gateway\_route) | Controls if a nat gateway route should be created to give internet access to the private subnets | `bool` | `true` | no |
| <a name="input_create_redshift_subnet_group"></a> [create\_redshift\_subnet\_group](#input\_create\_redshift\_subnet\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |
| <a name="input_create_redshift_subnet_route_table"></a> [create\_redshift\_subnet\_route\_table](#input\_create\_redshift\_subnet\_route\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |
| <a name="input_create_vpc"></a> [create\_vpc](#input\_create\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |
Expand Down Expand Up @@ -452,6 +453,7 @@ No modules.
| <a name="input_external_nat_ip_ids"></a> [external\_nat\_ip\_ids](#input\_external\_nat\_ip\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\_nat\_ips) | `list(string)` | `[]` | no |
| <a name="input_external_nat_ips"></a> [external\_nat\_ips](#input\_external\_nat\_ips) | List of EIPs to be used for `nat_public_ips` output (used in combination with reuse\_nat\_ips and external\_nat\_ip\_ids) | `list(string)` | `[]` | no |
| <a name="input_flow_log_cloudwatch_iam_role_arn"></a> [flow\_log\_cloudwatch\_iam\_role\_arn](#input\_flow\_log\_cloudwatch\_iam\_role\_arn) | The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow\_log\_destination\_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided | `string` | `""` | no |
| <a name="input_flow_log_cloudwatch_iam_role_conditions"></a> [flow\_log\_cloudwatch\_iam\_role\_conditions](#input\_flow\_log\_cloudwatch\_iam\_role\_conditions) | Additional conditions of the CloudWatch role assumption policy | <pre>list(object({<br/> test = string<br/> variable = string<br/> values = list(string)<br/> }))</pre> | `[]` | no |
| <a name="input_flow_log_cloudwatch_log_group_class"></a> [flow\_log\_cloudwatch\_log\_group\_class](#input\_flow\_log\_cloudwatch\_log\_group\_class) | Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT\_ACCESS | `string` | `null` | no |
| <a name="input_flow_log_cloudwatch_log_group_kms_key_id"></a> [flow\_log\_cloudwatch\_log\_group\_kms\_key\_id](#input\_flow\_log\_cloudwatch\_log\_group\_kms\_key\_id) | The ARN of the KMS Key to use when encrypting log data for VPC flow logs | `string` | `null` | no |
| <a name="input_flow_log_cloudwatch_log_group_name_prefix"></a> [flow\_log\_cloudwatch\_log\_group\_name\_prefix](#input\_flow\_log\_cloudwatch\_log\_group\_name\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs | `string` | `"/aws/vpc-flow-log/"` | no |
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ resource "aws_nat_gateway" "this" {
}

resource "aws_route" "private_nat_gateway" {
count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0
count = local.create_vpc && var.enable_nat_gateway && var.create_private_nat_gateway_route ? local.nat_gateway_count : 0

route_table_id = element(aws_route_table.private[*].id, count.index)
destination_cidr_block = var.nat_gateway_destination_cidr_block
Expand Down
4 changes: 2 additions & 2 deletions modules/vpc-endpoints/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ module "endpoints" {
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.46 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.83 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.46 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.83 |

## Modules

Expand Down
12 changes: 9 additions & 3 deletions modules/vpc-endpoints/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ locals {
data "aws_vpc_endpoint_service" "this" {
for_each = local.endpoints

service = try(each.value.service, null)
service_name = try(each.value.service_name, null)
service = try(each.value.service, null)
service_name = try(each.value.service_name, null)
service_regions = try(coalescelist(compact([each.value.service_region])), null)

filter {
name = "service-type"
Expand All @@ -25,6 +26,7 @@ resource "aws_vpc_endpoint" "this" {

vpc_id = var.vpc_id
service_name = try(each.value.service_endpoint, data.aws_vpc_endpoint_service.this[each.key].service_name)
service_region = try(each.value.service_region, null)
vpc_endpoint_type = try(each.value.service_type, "Interface")
auto_accept = try(each.value.auto_accept, null)

Expand All @@ -44,7 +46,11 @@ resource "aws_vpc_endpoint" "this" {
}
}

tags = merge(var.tags, try(each.value.tags, {}))
tags = merge(
var.tags,
{ "Name" = replace(each.key, ".", "-") },
try(each.value.tags, {}),
)

timeouts {
create = try(var.timeouts.create, "10m")
Expand Down
2 changes: 1 addition & 1 deletion modules/vpc-endpoints/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.46"
version = ">= 5.83"
}
}
}
16 changes: 16 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,12 @@ variable "private_subnet_suffix" {
default = "private"
}

variable "create_private_nat_gateway_route" {
description = "Controls if a nat gateway route should be created to give internet access to the private subnets"
type = bool
default = true
}

variable "private_subnet_tags" {
description = "Additional tags for the private subnets"
type = map(string)
Expand Down Expand Up @@ -1597,6 +1603,16 @@ variable "create_flow_log_cloudwatch_iam_role" {
default = false
}

variable "flow_log_cloudwatch_iam_role_conditions" {
description = "Additional conditions of the CloudWatch role assumption policy"
type = list(object({
test = string
variable = string
values = list(string)
}))
default = []
}

variable "flow_log_cloudwatch_iam_role_arn" {
description = "The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow_log_destination_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided"
type = string
Expand Down
9 changes: 9 additions & 0 deletions vpc-flow-logs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ data "aws_iam_policy_document" "flow_log_cloudwatch_assume_role" {
effect = "Allow"

actions = ["sts:AssumeRole"]

dynamic "condition" {
for_each = var.flow_log_cloudwatch_iam_role_conditions
content {
test = condition.value.test
variable = condition.value.variable
values = condition.value.values
}
}
}
}

Expand Down

0 comments on commit ee58836

Please sign in to comment.