Skip to content

Latest commit

 

History

History
83 lines (65 loc) · 8.65 KB

File metadata and controls

83 lines (65 loc) · 8.65 KB

Terraform Module for AWS VPC

This module contains resource files and example variable definition files for creation of the Virtual Private Cloud (VPC) on AWS. The module can be used for creation of the pre-requisite resources for Cloudera Data Platform (CDP) Public Cloud. It is also possible to use this module to create a more generic VPC - this can be used for as a networking VPC in a private CDP environment.

Usage

The examples directory has example AWS VPCs for different scenarios:

  • ex01-cdp-vpc uses the minimum set of inputs to create a AWS VPC suitable for CDP Public Cloud.

  • ex02-network-vpc created a generic network VPC.

In each directory an example terraform.tfvars.sample values file is included to show input variable values.

Requirements

Name Version
terraform >= 1.3.0
aws >= 5.30

Providers

Name Version
aws >= 5.30

Modules

Name Source Version
vpc terraform-aws-modules/vpc/aws 5.8.1

Resources

Name Type
aws_availability_zones.zones_in_region data source
aws_subnets.vpc_subnets data source
aws_vpc.vpc data source

Inputs

Name Description Type Default Required
private_cidr_range Size of each private subnet. Only used when create_vpc is true. number n/a yes
public_cidr_range Size of each public subnet. Only used when create_vpc is true. number n/a yes
vpc_cidr VPC CIDR Block. Only used when create_vpc is true. string n/a yes
vpc_name Name of the VPC. Only used when create_vpc is true. string n/a yes
cdp_vpc Flag to indicate if the VPC is for a CDP environment. Only used when create_vpc is true. bool true no
create_vpc Flag to specify if the VPC should be created. Otherwise data sources will be used to lookup details of existing resources. bool true no
deployment_template Deployment Pattern to use for Cloud resources and CDP string null no
enable_dns_hostnames Enable DNS Hostname support for the VPC. Only used when create_vpc is true. bool true no
enable_dns_support Enable DNS support for the VPC. Only used when create_vpc is true. bool true no
enable_nat_gateway Enable NAT Gateway for VPC. Only used when create_vpc is true. bool null no
existing_private_subnet_ids List of existing private subnet ids. Required if create_vpc is false. list(any) null no
existing_public_subnet_ids List of existing public subnet ids. Required if create_vpc is false. list(any) null no
existing_vpc_id ID of existing VPC. Required if create_vpc is false. string null no
private_network_extensions Enable creation of resources for connectivity to CDP Control Plane (public subnet and NAT Gateway) for Private Deployment. Only relevant for private deployment template. Only used when create_vpc is true. bool null no
private_subnet_tags Extra tags to apply to Private Subnets. Only used when create_vpc is true. map(any) null no
public_subnet_tags Extra tags to apply to Private Subnets. Only used when create_vpc is true. map(any) null no
single_nat_gateway Use a single NAT Gateway for the VPC. Only used when create_vpc is true. bool null no
tags Tags applied to VPC resources. Only used when create_vpc is true. map(any) null no
vpc_private_inbound_acl_rules Private subnets inbound network ACLs. Exposes default value of VPC module variable to allow for overriding. Only used when create_vpc is true. list(map(string))
[
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
no
vpc_private_outbound_acl_rules Private subnets outbound network ACLs. Exposes default value of VPC module variable to allow for overriding. Only used when create_vpc is true. list(map(string))
[
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
no
vpc_public_inbound_acl_rules Inbound network ACLs for Public subnets. Exposes default value of VPC module variable to allow for overriding. Only used when create_vpc is true. list(map(string))
[
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
no
vpc_public_outbound_acl_rules Public subnets outbound network ACLs. Exposes default value of VPC module variable to allow for overriding. Only used when create_vpc is true. list(map(string))
[
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
no
vpc_public_subnets_map_public_ip_on_launch Auto-assign public IP on launch for instances created in Public Subnets. Exposes default value of VPC module variable to allow for overriding. Only used when create_vpc is true. bool true no

Outputs

Name Description
default_route_table The ID of the default route table
private_route_tables List of IDs of the private route tables
private_subnets List of IDs of private subnets
public_route_tables List of IDs of the public route tables
public_subnets List of IDs of public subnets
vpc_cidr_blocks CIDR Block Associations for the VPC
vpc_id The ID of the VPC
vpc_subnets Full list of subnets associated with the VPC