Skip to content

native-cube/terraform-aws-vpc-flow-logs

Repository files navigation

GitHub release (latest by date)

terraform-aws-vpc-flow-logs

Terraform module for enabling AWS VPC flow logs.

Usage

module "vpc-flow-logs" {
  source = "native-cube/vpc-flow-logs/aws"
  version = "~> 2.1.0"

  name_prefix = "native-cube-example"
  vpc_id      = "vpc-123456789"

  traffic_type = "ALL"

  tags = {
    Project = "native-cube"
  }
}

Examples

Requirements

Name Version
terraform >= 1.0.0
aws >= 3.0

Providers

Name Version
aws >= 3.0

Modules

No modules.

Resources

Name Type
aws_cloudwatch_log_group.flow_logs resource
aws_flow_log.flow_logs resource
aws_iam_role.flow_logs resource
aws_iam_policy_document.cloudwatch data source

Inputs

Name Description Type Default Required
cloudwatch_log_group_name Custom name used for cloudwatch log group string null no
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
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 A prefix used for naming resources. string n/a yes
retention_in_days Specifies the number of days you want to retain log events in the specified log group. string null no
subnet_id Subnet ID to attach to. string null no
tags Default tags attached to all resources. map(string) {} no
traffic_type The type of traffic to capture. Valid values: ACCEPT, REJECT, ALL. string "ALL" no
transit_gateway_attachment_id Transit Gateway Attachment ID to attach to. string null no
transit_gateway_id Transit Gateway ID to attach to. string null no
vpc_id VPC ID where resources will be created and flow logs enabled. string null no

Outputs

Name Description
flow_logs_cloudwatch_group_arn The ARN specifying the log group used by Flow Logs.
flow_logs_id The Flow Log ID.
flow_logs_role_arn The ARN specifying the role used by Flow Logs.
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

MacOS

brew install pre-commit terraform-docs tflint

brew tap git-chglog/git-chglog
brew install git-chglog