Skip to content

avidhara/terraform-aws-vpc

Repository files navigation

Static security analysis for Terraform

Terraform Module AWS VPC

Use as a Module

module "vpc" {
  source  = "ionicloud/vpc/aws"
  cidr_block = "10.10.0.0/16"
}

Requirements

Name Version
terraform >= 0.12.24
aws >= 2.60

Providers

Name Version
aws >= 2.60

Modules

No modules.

Resources

Name Type
aws_cloudwatch_log_group.this resource
aws_default_network_acl.this resource
aws_default_security_group.this resource
aws_flow_log.this resource
aws_iam_role.this resource
aws_internet_gateway.this resource
aws_vpc.this resource
aws_vpc_dhcp_options.this resource
aws_vpc_dhcp_options_association.this resource

Inputs

Name Description Type Default Required
assign_generated_ipv6_cidr_block Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC bool false no
cidr_block (Required) The IPv4 CIDR block for the VPC. string n/a yes
create_igw Do you want to Create Internet Gateway bool true no
create_vpc Controls if VPC should be created (it affects almost all resources) bool true no
deliver_cross_account_role (Optional) ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts. string null no
destination_options (Optional) Describes the destination options for a flow log. More details below. any [] no
domain_name suffix domain name to use by default when resolving non Fully Qualified Domain Names string "ec2.internal" no
domain_name_servers ist of name servers to configure in /etc/resolv.conf list(string)
[
"AmazonProvidedDNS"
]
no
enable_dns_hostnames Should be true to enable DNS hostnames in the VPC bool false no
enable_dns_support Should be true to enable DNS support in the VPC bool true no
enable_flow_logs Do you want to enable vpc flow logs bool true no
enable_network_address_usage_metrics (Optional) Indicates whether Network Address Usage metrics are enabled for your VPC. Defaults to false. bool false no
eni_id (Optional) Elastic Network Interface ID to attach to string null no
iam_role_arn The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group string "" no
instance_tenancy A tenancy option for instances launched into the VPC string "default" no
ipv4_ipam_pool_id (Optional) The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. IPAM is a VPC feature that you can use to automate your IP address management workflows including assigning, tracking, troubleshooting, and auditing IP addresses across AWS Regions and accounts. Using IPAM you can monitor IP address usage throughout your AWS Organization. string null no
ipv4_netmask_length (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a ipv4_ipam_pool_id. string null no
ipv6_cidr_block (Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using ipv6_netmask_length. string null no
ipv6_cidr_block_network_border_group (Optional) By default when an IPv6 CIDR is assigned to a VPC a default ipv6_cidr_block_network_border_group will be set to the region of the VPC. This can be changed to restrict advertisement of public addresses to specific Network Border Groups such as LocalZones. string null no
ipv6_ipam_pool_id (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with assign_generated_ipv6_cidr_block. string null no
ipv6_netmask_length (Optional) Netmask length to request from IPAM Pool. Conflicts with ipv6_cidr_block. This can be omitted if IPAM pool as a allocation_default_netmask_length set. Valid values: 56. number null no
kms_key_id (Optional) 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. string null no
log_destination The ARN of the logging destination string "" no
log_destination_type The type of the logging destination. Valid values: cloud-watch-logs, s3. Default: cloud-watch-logs. string "cloud-watch-logs" no
log_format The fields to include in the flow log record, in the order in which they should appear. string "" no
log_retention_in_days Specifies the number of days you want to retain log events in the specified log group number 90 no
max_aggregation_interval (Optional) 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). Default: 600. number 600 no
name Name to be used on all the resources as identifier string "Example" no
netbios_name_servers (Optional) List of NETBIOS name servers. list(string) null no
netbios_node_type Optional) The NetBIOS node type (1, 2, 4, or 8). AWS recommends to specify 2 since broadcast and multicast are not supported in their network. For more information about these node types number 2 no
ntp_servers (Optional) List of NTP servers to configure. list(string) null no
skip_destroy (Optional) Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state. bool false no
subnet_id (Optional) Subnet ID to attach to string null no
tags Additional Tags to aws resources map(string) {} no
traffic_type The type of traffic to capture. Valid values: ACCEPT,REJECT, ALL string "ALL" no
transit_gateway_attachment_id (Optional) Transit Gateway Attachment ID to attach to string null no
transit_gateway_id (Optional) Transit Gateway ID to attach to string null no

Outputs

Name Description
arn Amazon Resource Name (ARN) of VPC
default_network_acl_id The ID of the network ACL created by default on VPC creation
default_route_table_id The ID of the route table created by default on VPC creation
default_security_group_id The ID of the security group created by default on VPC creation
flow_log_id The Flow Log ID
id ID of the VPC
igw_arn The ID of the Internet Gateway.
igw_id The ID of the Internet Gateway.
log_group_arn Amazon Resource Name (ARN) specifying the log group.
main_route_table_id The ID of the main route table associated with this VPC.
owner_id The ID of the AWS account that owns the VPC

To-Do

  • VPC Flow log support for s3