https://github.com/native-cube/terraform-aws-vpc-flow-logs
Terraform module for enabling AWS VPC flow logs.
https://github.com/native-cube/terraform-aws-vpc-flow-logs
aws terraform terraform-module vpc vpc-flow-logs vpc-flowlogs
Last synced: 3 months ago
JSON representation
Terraform module for enabling AWS VPC flow logs.
- Host: GitHub
- URL: https://github.com/native-cube/terraform-aws-vpc-flow-logs
- Owner: native-cube
- License: apache-2.0
- Created: 2022-02-03T08:38:56.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-08-08T08:35:53.000Z (10 months ago)
- Last Synced: 2025-08-08T10:19:16.157Z (10 months ago)
- Topics: aws, terraform, terraform-module, vpc, vpc-flow-logs, vpc-flowlogs
- Language: HCL
- Homepage: https://registry.terraform.io/modules/native-cube/vpc-flow-logs/aws
- Size: 24.4 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/native-cube/terraform-aws-vpc-flow-logs/releases/latest)
# terraform-aws-vpc-flow-logs
Terraform module for enabling AWS VPC flow logs.
## Usage
```hcl
module "vpc-flow-logs" {
source = "native-cube/vpc-flow-logs/aws"
version = "~> 2.2"
name_prefix = "native-cube-example"
vpc_id = "vpc-123456789"
traffic_type = "ALL"
tags = {
Project = "native-cube"
}
}
```
## Examples
* [VPC flow logs](https://github.com/native-cube/terraform-aws-vpc-flow-logs/tree/main/examples/core)
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0.0 |
| [aws](#requirement\_aws) | >= 3.0 |
## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | >= 3.0 |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_cloudwatch_log_group.flow_logs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
| [aws_flow_log.flow_logs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/flow_log) | resource |
| [aws_iam_role.flow_logs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [aws_iam_role_policy.flow_logs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) | resource |
| [aws_iam_policy_document.cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [cloudwatch\_log\_group\_name](#input\_cloudwatch\_log\_group\_name) | Custom name used for cloudwatch log group | `string` | `null` | no |
| [kms\_key\_id](#input\_kms\_key\_id) | The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires permissions for the CMK whenever the encrypted data is requested. | `string` | `null` | no |
| [log\_format](#input\_log\_format) | Custom format for flow log records | `string` | `null` | no |
| [max\_aggregation\_interval](#input\_max\_aggregation\_interval) | The maximum interval of time during which a flow of packets is captured and aggregated into a flow log record. Valid Values: 60 seconds (1 minute) or 600 seconds (10 minutes) | `string` | `"600"` | no |
| [name\_prefix](#input\_name\_prefix) | A prefix used for naming resources. | `string` | n/a | yes |
| [retention\_in\_days](#input\_retention\_in\_days) | Specifies the number of days you want to retain log events in the specified log group. | `string` | `null` | no |
| [subnet\_id](#input\_subnet\_id) | Subnet ID to attach to. | `string` | `null` | no |
| [tags](#input\_tags) | Default tags attached to all resources. | `map(string)` | `{}` | no |
| [traffic\_type](#input\_traffic\_type) | The type of traffic to capture. Valid values: ACCEPT, REJECT, ALL. | `string` | `"ALL"` | no |
| [transit\_gateway\_attachment\_id](#input\_transit\_gateway\_attachment\_id) | Transit Gateway Attachment ID to attach to. | `string` | `null` | no |
| [transit\_gateway\_id](#input\_transit\_gateway\_id) | Transit Gateway ID to attach to. | `string` | `null` | no |
| [vpc\_id](#input\_vpc\_id) | VPC ID where resources will be created and flow logs enabled. | `string` | `null` | no |
## Outputs
| Name | Description |
|------|-------------|
| [flow\_logs\_cloudwatch\_group\_arn](#output\_flow\_logs\_cloudwatch\_group\_arn) | The ARN specifying the log group used by Flow Logs. |
| [flow\_logs\_id](#output\_flow\_logs\_id) | The Flow Log ID. |
| [flow\_logs\_role\_arn](#output\_flow\_logs\_role\_arn) | The ARN specifying the role used by Flow Logs. |
| [flow\_logs\_role\_id](#output\_flow\_logs\_role\_id) | The ID specifying the role used by Flow Logs. |
## License
See LICENSE file for full details.
## Pre-commit hooks
### Install dependencies
* [`pre-commit`](https://pre-commit.com/#install)
* [`terraform-docs`](https://github.com/segmentio/terraform-docs) required for `terraform_docs` hooks.
* [`TFLint`](https://github.com/terraform-linters/tflint) required for `terraform_tflint` hook.
#### MacOS
```bash
brew install pre-commit terraform-docs tflint
brew tap git-chglog/git-chglog
brew install git-chglog
```