|
| 1 | +[](https://github.com/native-cube/terraform-aws-vpc-flow-logs/releases/latest) |
| 2 | + |
1 | 3 | # terraform-aws-vpc-flow-logs |
2 | 4 | Terraform module for enabling AWS VPC flow logs. |
| 5 | + |
| 6 | +## Usage |
| 7 | + |
| 8 | +```hcl |
| 9 | +module "vpc-flow-logs" { |
| 10 | + source = "native-cube/vpc-flow-logs/aws" |
| 11 | + version = "~> 1.0.0" |
| 12 | +
|
| 13 | + name_prefix = "native-cube-example" |
| 14 | + vpc_id = "vpc-123456789" |
| 15 | +
|
| 16 | + traffic_type = "ALL" |
| 17 | +
|
| 18 | + tags = { |
| 19 | + Project = "native-cube" |
| 20 | + } |
| 21 | +} |
| 22 | +``` |
| 23 | + |
| 24 | +## Examples |
| 25 | + |
| 26 | +* [VPC flow logs](https://github.com/native-cube/terraform-aws-vpc-flow-logs/tree/master/examples/core) |
| 27 | + |
| 28 | +<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
| 29 | +## Requirements |
| 30 | + |
| 31 | +| Name | Version | |
| 32 | +|------|---------| |
| 33 | +| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 | |
| 34 | +| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.0 | |
| 35 | + |
| 36 | +## Providers |
| 37 | + |
| 38 | +| Name | Version | |
| 39 | +|------|---------| |
| 40 | +| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.0 | |
| 41 | + |
| 42 | +## Modules |
| 43 | + |
| 44 | +No modules. |
| 45 | + |
| 46 | +## Resources |
| 47 | + |
| 48 | +| Name | Type | |
| 49 | +|------|------| |
| 50 | +| [aws_cloudwatch_log_group.vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource | |
| 51 | +| [aws_flow_log.vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/flow_log) | resource | |
| 52 | +| [aws_iam_role.vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | |
| 53 | +| [aws_iam_policy_document.cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | |
| 54 | + |
| 55 | +## Inputs |
| 56 | + |
| 57 | +| Name | Description | Type | Default | Required | |
| 58 | +|------|-------------|------|---------|:--------:| |
| 59 | +| <a name="input_kms_key_id"></a> [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 | |
| 60 | +| <a name="input_max_aggregation_interval"></a> [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 | |
| 61 | +| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | A prefix used for naming resources. | `string` | n/a | yes | |
| 62 | +| <a name="input_retention_in_days"></a> [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 | |
| 63 | +| <a name="input_tags"></a> [tags](#input\_tags) | Default tags attached to all resources. | `map(string)` | `{}` | no | |
| 64 | +| <a name="input_traffic_type"></a> [traffic\_type](#input\_traffic\_type) | The type of traffic to capture. Valid values: ACCEPT, REJECT, ALL. | `string` | `"ALL"` | no | |
| 65 | +| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC ID where resources will be created and flow logs enabled. | `string` | n/a | yes | |
| 66 | + |
| 67 | +## Outputs |
| 68 | + |
| 69 | +| Name | Description | |
| 70 | +|------|-------------| |
| 71 | +| <a name="output_vpc_flow_logs_cloudwatch_group_arn"></a> [vpc\_flow\_logs\_cloudwatch\_group\_arn](#output\_vpc\_flow\_logs\_cloudwatch\_group\_arn) | The ARN specifying the log group used by Flow Logs. | |
| 72 | +| <a name="output_vpc_flow_logs_id"></a> [vpc\_flow\_logs\_id](#output\_vpc\_flow\_logs\_id) | The Flow Log ID. | |
| 73 | +| <a name="output_vpc_flow_logs_role_arn"></a> [vpc\_flow\_logs\_role\_arn](#output\_vpc\_flow\_logs\_role\_arn) | The ARN specifying the role used by Flow Logs. | |
| 74 | +| <a name="output_vpc_flow_logs_role_id"></a> [vpc\_flow\_logs\_role\_id](#output\_vpc\_flow\_logs\_role\_id) | The ID specifying the role used by Flow Logs. | |
| 75 | +<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
| 76 | + |
| 77 | +## License |
| 78 | + |
| 79 | +See LICENSE file for full details. |
| 80 | + |
| 81 | +## Pre-commit hooks |
| 82 | + |
| 83 | +### Install dependencies |
| 84 | + |
| 85 | +* [`pre-commit`](https://pre-commit.com/#install) |
| 86 | +* [`terraform-docs`](https://github.com/segmentio/terraform-docs) required for `terraform_docs` hooks. |
| 87 | +* [`TFLint`](https://github.com/terraform-linters/tflint) required for `terraform_tflint` hook. |
| 88 | + |
| 89 | +#### MacOS |
| 90 | + |
| 91 | +```bash |
| 92 | +brew install pre-commit terraform-docs tflint |
| 93 | + |
| 94 | +brew tap git-chglog/git-chglog |
| 95 | +brew install git-chglog |
| 96 | +``` |
0 commit comments