Use the tf-mod-aws-vpc
Terraform module to provision a VPC with Internet Gateway.
Project: %!s() : [%!s()] | [%!s()]
The module provisions the following resources:
- An AWS VPC with default security group.
- A default AWS Internet Gateway (IGW) associated with the VPC created.
IMPORTANT: The master
branch is used in source
just as an example. In your code, do not pin to master
because there may be breaking changes between releases.
Instead pin to the release tag (e.g. ?ref=tags/x.y.z
) of one of our latest releases.
The below values shown in the usage of this module are purely representative, please replace desired values as required.
module "tf-mod-aws-vpc" {
source = "git::https://github.com:Callumccr/tf-mod-aws-vpc.git?ref=master"
enabled = true
aws_account_id = "12345678910"
aws_region = "eu-west-1"
cidr_block = "10.0.0.0/16"
tags = {
"ABC" = "XYZ"
}
}
Simple and advanced examples of this project.
module "tf-mod-aws-vpc" {
source = "git::https://github.com:Callumccr/tf-mod-aws-vpc.git?ref=master"
enabled = true
aws_account_id = "12345678910"
aws_region = "eu-west-1"
cidr_block = "10.0.0.0/16"
tags = {
"ABC" = "XYZ"
}
}
module "tf-mod-aws-subnets" {
source = "git::https://github.com:Callumccr/tf-mod-aws-subnets.git?ref=master"
enabled = true
aws_region = "eu-west-1"
vpc_id = module.tf-mod-aws-vpc.vpc_id
igw_id = module.tf-mod-aws-vpc.igw_id
cidr_block = module.tf-mod-aws-vpc.cidr_block
availability_zones = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
nat_gateway_enabled = true
nat_instance_enabled = false
map_public_ip_on_launch = true
tags = {
"ABC" = "XYZ"
}
}
Name | Version |
---|---|
aws | ~> 2.0 >= 2.7.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
cidr_block | CIDR for the VPC | string |
n/a | yes |
allow_all_egress | (Optional) - Whether to allow ALL egress (0.0.0.0/0) | bool |
true |
no |
allow_all_ingress | (Optional) - Whether to allow ALL egress (0.0.0.0/0) | bool |
true |
no |
attributes | (Optional) - Additional attributes (e.g. 1 ) |
list(string) |
[] |
no |
aws_account_id | The AWS account id of the provider being deployed to (e.g. 12345678). Autoloaded from account.tfvars | string |
"" |
no |
aws_assume_role_arn | (Optional) - ARN of the IAM role when optionally connecting to AWS via assumed role. Autoloaded from account.tfvars. | string |
"" |
no |
aws_assume_role_external_id | (Optional) - The external ID to use when making the AssumeRole call. | string |
"" |
no |
aws_assume_role_session_name | (Optional) - The session name to use when making the AssumeRole call. | string |
"" |
no |
aws_region | The AWS region (e.g. ap-southeast-2). Autoloaded from region.tfvars. | string |
"" |
no |
delimiter | (Optional) - Delimiter to be used between namespace , environment , stage , name and attributes |
string |
"-" |
no |
enable_classiclink | A boolean flag to enable/disable ClassicLink for the VPC | bool |
false |
no |
enable_classiclink_dns_support | A boolean flag to enable/disable ClassicLink DNS Support for the VPC | bool |
false |
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 |
enabled | (Optional). A Switch that decides whether to create the module. Default is true | bool |
true |
no |
environment | (Optional) - Environment, e.g. 'dev', 'qa', 'staging', 'prod' | string |
"" |
no |
instance_tenancy | A tenancy option for instances launched into the VPC | string |
"default" |
no |
name | (Optional) - Solution name, e.g. 'vault', 'consul', 'keycloak', 'k8s', or 'baseline' | string |
"" |
no |
namespace | (Optional) - Namespace, which could be your abbreviated product team, e.g. 'rci', 'mi', 'hp', or 'core' | string |
"" |
no |
tags | (Optional) - Additional tags | map(string) |
{} |
no |
Name | Description |
---|---|
cidr_block | The CIDR block of the 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 |
igw_id | The ID of the Internet Gateway |
ipv6_association_id | The association ID for the IPv6 CIDR block |
ipv6_cidr_block | The IPv6 CIDR block |
main_route_table_id | The ID of the main route table associated with this VPC |
security_group_arn | The ARN of the security group |
security_group_id | The ID of the security group |
vpc_id | The ID of the VPC |
You can find more Terraform Modules by vising the link.
Additionally, check out these other related, and maintained projects.
- %!s() - %!s()
For additional context, refer to some of these links.
- cloudposse/terraform-aws-vpc - Unmodified upstream provided for this module
Got a question? We got answers.
File a Github issue, or message us on Slack
Callum Robertson |
---|