varunviky7 / terraform-aws-vpc

Terraform Module will create the VPC, Subnets, Route Table, NACL, VPC Endpoints

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

terraform-aws-vpc

Lint Status LICENSE

This module creates the basic and advance network resources for a region.

The following resources will be created:

  • Virtual Private Cloud (VPC)
  • VPC Flow Logs
  • AWS Cloudwatch log groups
  • Subnets
    • Public
    • Private
    • Database
  • Internet Gateway
  • Nat Gateway
  • Route tables for the Public, Private, Database subnets
  • Associate all Route Tables created to the correct subnet
  • Database Subnet group - Provides an RDS DB subnet group resources without Internet
  • Adding routes in Route Table for VPC Peering

Usages

module "vpc_main" {
  source      = "git::https://github.com/tothenew/terraform-aws-vpc.git?ref=v0.2.0"
  cidr_block  = "10.1.0.0/16"
  subnet_bits = 8
}

Requirements

Name Version
terraform >= 1.3.0

Providers

Name Version
aws n/a

Modules

Name Source Version
subnet_advance ./modules/subnets-module-advance n/a
subnet_simple ./modules/subnets-module-simple n/a
vpc_endpoint git::https://github.com/tothenew/terraform-aws-vpc-endpoint.git v0.1.0
vpc_main ./modules/vpc n/a

Resources

Name Type
aws_cloudwatch_log_group.flow_log resource
aws_flow_log.flow_log resource
aws_iam_policy.vpc_flow_log_cloudwatch resource
aws_iam_role.vpc_flow_log_cloudwatch resource
aws_iam_role_policy_attachment.vpc_flow_log_cloudwatch resource
aws_vpc_ipv4_cidr_block_association.secondary_cidr_blocks resource
aws_availability_zones.available data source
aws_iam_policy_document.flow_log_cloudwatch_assume_role data source
aws_iam_policy_document.vpc_flow_log_cloudwatch data source
aws_region.current data source

Inputs

Name Description Type Default Required
additional_subnet_group Subnet details having zone and cidr address
map(object({
is_public = bool
nat_gateway = bool
details = list(object({
availability_zone = string
cidr_address = string
}))
}))
{} no
cidr_block IPV4 range for VPC Creation string "10.20.0.0/20" no
common_tags A map to add common tags to all the resources map(string) {} no
create_peering_routes True/False value need to create Peering Route or not, Default to false bool false no
create_vpc_endpoint Create all VPC Endpoint bool false no
default_tags A map to add common tags to all the resources map(string)
{
"CreatedBy": "Terraform",
"Scope": "VPC"
}
no
enable_dns_hostnames A boolean flag to enable/disable DNS hostnames in the VPC bool true no
enable_dns_support A boolean flag to enable/disable DNS support in the VPC bool true no
enable_flow_log Whether or not to enable VPC Flow Logs bool false no
flow_log_cloudwatch_log_group_retention_in_days Specifies the number of days you want to retain log events in the specified log group for VPC flow logs. number 7 no
flow_log_destination_type Type of flow log destination. Can be s3 or cloud-watch-logs. string "cloud-watch-logs" no
flow_log_log_format The fields to include in the flow log record, in the order in which they should appear. string null no
flow_log_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 or 600 seconds. number 600 no
flow_log_traffic_type The type of traffic to capture. Valid values: ACCEPT, REJECT, ALL. string "ALL" no
max_subnet_az Maximum number of Subnets per Availability Zone number 2 no
name A string value to describe prefix of all the resources string "" no
routes Route details having destination and target address
map(object({
peering = map(string)
}))
{} no
secondary_cidr_blocks List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool list(string) [] no
subnet Subnet details having zone and cidr address
map(object({
is_public = bool
nat_gateway = bool
details = list(object({
availability_zone = string
cidr_address = string
}))
}))
{} no
subnet_bits Number Bits required for creating Subnets number 8 no
subnet_group Subnets group divided into public, private and database
map(object({
is_public = bool
nat_gateway = bool
}))
{
"database": {
"is_public": false,
"nat_gateway": false
},
"private": {
"is_public": false,
"nat_gateway": true
},
"public": {
"is_public": true,
"nat_gateway": false
}
}
no

Outputs

Name Description
eip_id n/a
internet_gateway_id n/a
route_table_id n/a
subnet_cidr n/a
subnet_details_cidr n/a
subnet_details_id n/a
subnet_ids n/a
vpc_cidr n/a
vpc_id n/a

Authors

Module managed by TO THE NEW Pvt. Ltd.

License

Apache 2 Licensed. See LICENSE for full details.

About

Terraform Module will create the VPC, Subnets, Route Table, NACL, VPC Endpoints


Languages

Language:HCL 100.0%