Skip to content

Commit 088f30d

Browse files
authored
feat: Adding vpc_flow_log_permissions_boundary (#536)
1 parent af51566 commit 088f30d

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ You can add additional tags with `intra_subnet_tags` as with other subnet types.
161161

162162
VPC Flow Log allows to capture IP traffic for a specific network interface (ENI), subnet, or entire VPC. This module supports enabling or disabling VPC Flow Logs for entire VPC. If you need to have VPC Flow Logs for subnet or ENI, you have to manage it outside of this module with [aws_flow_log resource](https://www.terraform.io/docs/providers/aws/r/flow_log.html).
163163

164+
### Permissions Boundary
165+
166+
If your organization requires a permissions boundary to be attached to the VPC Flow Log role, make sure that you specify an ARN of the permissions boundary policy as `vpc_flow_log_permissions_boundary` argument. Read more about required [IAM policy for publishing flow logs](https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs-cwl.html#flow-logs-iam).
167+
164168
## Conditional creation
165169

166170
Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.
@@ -637,6 +641,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
637641
| transferserver\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Transfer Server endpoint | `list(string)` | `[]` | no |
638642
| transferserver\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Transfer Server endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |
639643
| vpc\_endpoint\_tags | Additional tags for the VPC Endpoints | `map(string)` | `{}` | no |
644+
| vpc\_flow\_log\_permissions\_boundary | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |
640645
| vpc\_flow\_log\_tags | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |
641646
| vpc\_tags | Additional tags for the VPC | `map(string)` | `{}` | no |
642647
| vpn\_gateway\_az | The Availability Zone for the VPN Gateway | `string` | `null` | no |

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,12 @@ variable "vpc_flow_log_tags" {
21172117
default = {}
21182118
}
21192119

2120+
variable "vpc_flow_log_permissions_boundary" {
2121+
description = "The ARN of the Permissions Boundary for the VPC Flow Log IAM Role"
2122+
type = string
2123+
default = null
2124+
}
2125+
21202126
variable "enable_dhcp_options" {
21212127
description = "Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type"
21222128
type = bool

vpc-flow-logs.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ resource "aws_cloudwatch_log_group" "flow_log" {
4545
resource "aws_iam_role" "vpc_flow_log_cloudwatch" {
4646
count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0
4747

48-
name_prefix = "vpc-flow-log-role-"
49-
assume_role_policy = data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0].json
48+
name_prefix = "vpc-flow-log-role-"
49+
assume_role_policy = data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0].json
50+
permissions_boundary = var.vpc_flow_log_permissions_boundary
5051

5152
tags = merge(var.tags, var.vpc_flow_log_tags)
5253
}

0 commit comments

Comments
 (0)