Commit 6eddcad7 authored by drewmullen's avatar drewmullen Committed by GitHub

feat: Add IPAM IPv4 support (#716)

parent a06dd176
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.72.1
rev: v1.75.0
hooks:
- id: terraform_fmt
- id: terraform_validate
......
......@@ -181,6 +181,54 @@ Sometimes it is handy to have public access to Redshift clusters (for example if
It is possible to integrate this VPC module with [terraform-aws-transit-gateway module](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway) which handles the creation of TGW resources and VPC attachments. See [complete example there](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway/tree/master/examples/complete).
## VPC CIDR from AWS IP Address Manager (IPAM)
It is possible to have your VPC CIDR assigned from an [AWS IPAM Pool](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool). However, In order to build subnets within this module Terraform must know subnet CIDRs to properly plan the amount of resources to build. Since CIDR is derived by IPAM by calling CreateVpc this is not possible within a module unless cidr is known ahead of time. You can get around this by "previewing" the CIDR and then using that as the subnet values.
_Note: Due to race conditions with `terraform plan`, it is not possible to use `ipv4_netmask_length` or a pools `allocation_default_netmask_length` within this module. You must explicitly set the CIDRs for a pool to use._
```hcl
# Find the pool RAM shared to your account
# Info on RAM sharing pools: https://docs.aws.amazon.com/vpc/latest/ipam/share-pool-ipam.html
data "aws_vpc_ipam_pool" "ipv4_example" {
filter {
name = "description"
values = ["*mypool*"]
}
filter {
name = "address-family"
values = ["ipv4"]
}
}
# Preview next CIDR from pool
data "aws_vpc_ipam_preview_next_cidr" "previewed_cidr" {
ipam_pool_id = data.aws_vpc_ipam_pool.ipv4_example.id
netmask_length = 24
}
data "aws_region" "current" {}
# Calculate subnet cidrs from previewed IPAM CIDR
locals {
partition = cidrsubnets(data.aws_vpc_ipam_preview_next_cidr.previewed_cidr.cidr, 2, 2)
private_subnets = cidrsubnets(local.partition[0], 2, 2)
public_subnets = cidrsubnets(local.partition[1], 2, 2)
azs = formatlist("${data.aws_region.current.name}%s", ["a", "b"])
}
module "vpc_cidr_from_ipam" {
source = "terraform-aws-modules/vpc/aws"
name = "vpc-cidr-from-ipam"
ipv4_ipam_pool_id = data.aws_vpc_ipam_pool.ipv4_example.id
azs = local.azs
cidr = data.aws_vpc_ipam_preview_next_cidr.previewed_cidr.cidr
private_subnets = local.private_subnets
public_subnets = local.public_subnets
}
```
## Examples
- [Simple VPC](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/simple-vpc)
......@@ -190,6 +238,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
- [Network ACL](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/network-acls)
- [VPC Flow Logs](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/vpc-flow-logs)
- [VPC with Outpost](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/outpost)
- [VPC CIDR from IPAM](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/ipam-vpc)
- [Manage Default VPC](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/manage-default-vpc)
- [Few tests and edge case examples](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/issues)
......@@ -205,13 +254,13 @@ Full contributing [guidelines are covered here](.github/contributing.md).
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.63 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
## Providers
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.63 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.73 |
## Modules
......@@ -306,7 +355,7 @@ No modules.
| <a name="input_amazon_side_asn"></a> [amazon\_side\_asn](#input\_amazon\_side\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN. | `string` | `"64512"` | no |
| <a name="input_assign_ipv6_address_on_creation"></a> [assign\_ipv6\_address\_on\_creation](#input\_assign\_ipv6\_address\_on\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\_public\_ip\_on\_launch | `bool` | `false` | no |
| <a name="input_azs"></a> [azs](#input\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |
| <a name="input_cidr"></a> [cidr](#input\_cidr) | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden | `string` | `"0.0.0.0/0"` | no |
| <a name="input_cidr"></a> [cidr](#input\_cidr) | (Optional) The IPv4 CIDR block for the VPC. | `string` | `"0.0.0.0/0"` | no |
| <a name="input_create_database_internet_gateway_route"></a> [create\_database\_internet\_gateway\_route](#input\_create\_database\_internet\_gateway\_route) | Controls if an internet gateway route for public database access should be created | `bool` | `false` | no |
| <a name="input_create_database_nat_gateway_route"></a> [create\_database\_nat\_gateway\_route](#input\_create\_database\_nat\_gateway\_route) | Controls if a nat gateway route should be created to give internet access to the database subnets | `bool` | `false` | no |
| <a name="input_create_database_subnet_group"></a> [create\_database\_subnet\_group](#input\_create\_database\_subnet\_group) | Controls if database subnet group should be created (n.b. database\_subnets must also be set) | `bool` | `true` | no |
......@@ -405,6 +454,7 @@ No modules.
| <a name="input_intra_subnet_suffix"></a> [intra\_subnet\_suffix](#input\_intra\_subnet\_suffix) | Suffix to append to intra subnets name | `string` | `"intra"` | no |
| <a name="input_intra_subnet_tags"></a> [intra\_subnet\_tags](#input\_intra\_subnet\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |
| <a name="input_intra_subnets"></a> [intra\_subnets](#input\_intra\_subnets) | A list of intra subnets | `list(string)` | `[]` | no |
| <a name="input_ipv4_ipam_pool_id"></a> [ipv4\_ipam\_pool\_id](#input\_ipv4\_ipam\_pool\_id) | (Optional) The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. | `string` | `null` | no |
| <a name="input_manage_default_network_acl"></a> [manage\_default\_network\_acl](#input\_manage\_default\_network\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |
| <a name="input_manage_default_route_table"></a> [manage\_default\_route\_table](#input\_manage\_default\_route\_table) | Should be true to manage default route table | `bool` | `false` | no |
| <a name="input_manage_default_security_group"></a> [manage\_default\_security\_group](#input\_manage\_default\_security\_group) | Should be true to adopt and manage default security group | `bool` | `false` | no |
......@@ -560,7 +610,7 @@ No modules.
| <a name="output_public_subnets_ipv6_cidr_blocks"></a> [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC |
| <a name="output_redshift_network_acl_arn"></a> [redshift\_network\_acl\_arn](#output\_redshift\_network\_acl\_arn) | ARN of the redshift network ACL |
| <a name="output_redshift_network_acl_id"></a> [redshift\_network\_acl\_id](#output\_redshift\_network\_acl\_id) | ID of the redshift network ACL |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshidt route table association |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshift route table association |
| <a name="output_redshift_route_table_association_ids"></a> [redshift\_route\_table\_association\_ids](#output\_redshift\_route\_table\_association\_ids) | List of IDs of the redshift route table association |
| <a name="output_redshift_route_table_ids"></a> [redshift\_route\_table\_ids](#output\_redshift\_route\_table\_ids) | List of IDs of redshift route tables |
| <a name="output_redshift_subnet_arns"></a> [redshift\_subnet\_arns](#output\_redshift\_subnet\_arns) | List of ARNs of redshift subnets |
......
......@@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.63 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
## Providers
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.63 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.73 |
## Modules
......@@ -136,7 +136,7 @@ No inputs.
| <a name="output_public_subnets_ipv6_cidr_blocks"></a> [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC |
| <a name="output_redshift_network_acl_arn"></a> [redshift\_network\_acl\_arn](#output\_redshift\_network\_acl\_arn) | ARN of the redshift network ACL |
| <a name="output_redshift_network_acl_id"></a> [redshift\_network\_acl\_id](#output\_redshift\_network\_acl\_id) | ID of the redshift network ACL |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshidt route table association |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshift route table association |
| <a name="output_redshift_route_table_association_ids"></a> [redshift\_route\_table\_association\_ids](#output\_redshift\_route\_table\_association\_ids) | List of IDs of the redshift route table association |
| <a name="output_redshift_route_table_ids"></a> [redshift\_route\_table\_ids](#output\_redshift\_route\_table\_ids) | List of IDs of redshift route tables |
| <a name="output_redshift_subnet_arns"></a> [redshift\_subnet\_arns](#output\_redshift\_subnet\_arns) | List of ARNs of redshift subnets |
......
provider "aws" {
region = "eu-west-1"
region = local.region
}
locals {
name = "complete-example"
name = "ex-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"
tags = {
Owner = "user"
Environment = "staging"
Name = "complete"
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
}
......
......@@ -314,7 +314,7 @@ output "redshift_route_table_association_ids" {
}
output "redshift_public_route_table_association_ids" {
description = "List of IDs of the public redshidt route table association"
description = "List of IDs of the public redshift route table association"
value = module.vpc.redshift_public_route_table_association_ids
}
......
......@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.63"
version = ">= 3.73"
}
}
}
# VPC with IPAM pool
Configuration in this directory creates set of VPC resources using the CIDR provided by an IPAM pool.
Note: Due to the nature of vending CIDR blocks from an IPAM pool, the IPAM pool must exist prior to creating a VPC using one of the CIDRs from the pool.
## Usage
To run this example you need to execute:
```bash
$ terraform init
$ terraform plan
$ terraform apply -target=aws_vpc_ipam_preview_next_cidr.this # CIDR pool must exist before assigning CIDR from pool
$ terraform apply
```
To destroy this example you can execute:
```bash
$ terraform destroy -target=module.vpc # destroy VPC that uses the IPAM pool CIDR first
$ terraform destroy
```
Note that this example may create resources which can cost money (AWS Elastic IP, for example). Run `terraform destroy` when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
## Providers
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.73 |
## Modules
| Name | Source | Version |
|------|--------|---------|
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ../.. | n/a |
## Resources
| Name | Type |
|------|------|
| [aws_vpc_ipam.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam) | resource |
| [aws_vpc_ipam_pool.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool) | resource |
| [aws_vpc_ipam_pool_cidr.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool_cidr) | resource |
| [aws_vpc_ipam_preview_next_cidr.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_preview_next_cidr) | resource |
## Inputs
No inputs.
## Outputs
| Name | Description |
|------|-------------|
| <a name="output_cgw_arns"></a> [cgw\_arns](#output\_cgw\_arns) | List of ARNs of Customer Gateway |
| <a name="output_cgw_ids"></a> [cgw\_ids](#output\_cgw\_ids) | List of IDs of Customer Gateway |
| <a name="output_database_internet_gateway_route_id"></a> [database\_internet\_gateway\_route\_id](#output\_database\_internet\_gateway\_route\_id) | ID of the database internet gateway route |
| <a name="output_database_ipv6_egress_route_id"></a> [database\_ipv6\_egress\_route\_id](#output\_database\_ipv6\_egress\_route\_id) | ID of the database IPv6 egress route |
| <a name="output_database_nat_gateway_route_ids"></a> [database\_nat\_gateway\_route\_ids](#output\_database\_nat\_gateway\_route\_ids) | List of IDs of the database nat gateway route |
| <a name="output_database_network_acl_arn"></a> [database\_network\_acl\_arn](#output\_database\_network\_acl\_arn) | ARN of the database network ACL |
| <a name="output_database_network_acl_id"></a> [database\_network\_acl\_id](#output\_database\_network\_acl\_id) | ID of the database network ACL |
| <a name="output_database_route_table_association_ids"></a> [database\_route\_table\_association\_ids](#output\_database\_route\_table\_association\_ids) | List of IDs of the database route table association |
| <a name="output_database_route_table_ids"></a> [database\_route\_table\_ids](#output\_database\_route\_table\_ids) | List of IDs of database route tables |
| <a name="output_database_subnet_arns"></a> [database\_subnet\_arns](#output\_database\_subnet\_arns) | List of ARNs of database subnets |
| <a name="output_database_subnet_group"></a> [database\_subnet\_group](#output\_database\_subnet\_group) | ID of database subnet group |
| <a name="output_database_subnet_group_name"></a> [database\_subnet\_group\_name](#output\_database\_subnet\_group\_name) | Name of database subnet group |
| <a name="output_database_subnets"></a> [database\_subnets](#output\_database\_subnets) | List of IDs of database subnets |
| <a name="output_database_subnets_cidr_blocks"></a> [database\_subnets\_cidr\_blocks](#output\_database\_subnets\_cidr\_blocks) | List of cidr\_blocks of database subnets |
| <a name="output_database_subnets_ipv6_cidr_blocks"></a> [database\_subnets\_ipv6\_cidr\_blocks](#output\_database\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of database subnets in an IPv6 enabled VPC |
| <a name="output_default_network_acl_id"></a> [default\_network\_acl\_id](#output\_default\_network\_acl\_id) | The ID of the default network ACL |
| <a name="output_default_route_table_id"></a> [default\_route\_table\_id](#output\_default\_route\_table\_id) | The ID of the default route table |
| <a name="output_default_security_group_id"></a> [default\_security\_group\_id](#output\_default\_security\_group\_id) | The ID of the security group created by default on VPC creation |
| <a name="output_default_vpc_arn"></a> [default\_vpc\_arn](#output\_default\_vpc\_arn) | The ARN of the Default VPC |
| <a name="output_default_vpc_cidr_block"></a> [default\_vpc\_cidr\_block](#output\_default\_vpc\_cidr\_block) | The CIDR block of the Default VPC |
| <a name="output_default_vpc_default_network_acl_id"></a> [default\_vpc\_default\_network\_acl\_id](#output\_default\_vpc\_default\_network\_acl\_id) | The ID of the default network ACL of the Default VPC |
| <a name="output_default_vpc_default_route_table_id"></a> [default\_vpc\_default\_route\_table\_id](#output\_default\_vpc\_default\_route\_table\_id) | The ID of the default route table of the Default VPC |
| <a name="output_default_vpc_default_security_group_id"></a> [default\_vpc\_default\_security\_group\_id](#output\_default\_vpc\_default\_security\_group\_id) | The ID of the security group created by default on Default VPC creation |
| <a name="output_default_vpc_enable_dns_hostnames"></a> [default\_vpc\_enable\_dns\_hostnames](#output\_default\_vpc\_enable\_dns\_hostnames) | Whether or not the Default VPC has DNS hostname support |
| <a name="output_default_vpc_enable_dns_support"></a> [default\_vpc\_enable\_dns\_support](#output\_default\_vpc\_enable\_dns\_support) | Whether or not the Default VPC has DNS support |
| <a name="output_default_vpc_id"></a> [default\_vpc\_id](#output\_default\_vpc\_id) | The ID of the Default VPC |
| <a name="output_default_vpc_instance_tenancy"></a> [default\_vpc\_instance\_tenancy](#output\_default\_vpc\_instance\_tenancy) | Tenancy of instances spin up within Default VPC |
| <a name="output_default_vpc_main_route_table_id"></a> [default\_vpc\_main\_route\_table\_id](#output\_default\_vpc\_main\_route\_table\_id) | The ID of the main route table associated with the Default VPC |
| <a name="output_dhcp_options_id"></a> [dhcp\_options\_id](#output\_dhcp\_options\_id) | The ID of the DHCP options |
| <a name="output_egress_only_internet_gateway_id"></a> [egress\_only\_internet\_gateway\_id](#output\_egress\_only\_internet\_gateway\_id) | The ID of the egress only Internet Gateway |
| <a name="output_elasticache_network_acl_arn"></a> [elasticache\_network\_acl\_arn](#output\_elasticache\_network\_acl\_arn) | ARN of the elasticache network ACL |
| <a name="output_elasticache_network_acl_id"></a> [elasticache\_network\_acl\_id](#output\_elasticache\_network\_acl\_id) | ID of the elasticache network ACL |
| <a name="output_elasticache_route_table_association_ids"></a> [elasticache\_route\_table\_association\_ids](#output\_elasticache\_route\_table\_association\_ids) | List of IDs of the elasticache route table association |
| <a name="output_elasticache_route_table_ids"></a> [elasticache\_route\_table\_ids](#output\_elasticache\_route\_table\_ids) | List of IDs of elasticache route tables |
| <a name="output_elasticache_subnet_arns"></a> [elasticache\_subnet\_arns](#output\_elasticache\_subnet\_arns) | List of ARNs of elasticache subnets |
| <a name="output_elasticache_subnet_group"></a> [elasticache\_subnet\_group](#output\_elasticache\_subnet\_group) | ID of elasticache subnet group |
| <a name="output_elasticache_subnet_group_name"></a> [elasticache\_subnet\_group\_name](#output\_elasticache\_subnet\_group\_name) | Name of elasticache subnet group |
| <a name="output_elasticache_subnets"></a> [elasticache\_subnets](#output\_elasticache\_subnets) | List of IDs of elasticache subnets |
| <a name="output_elasticache_subnets_cidr_blocks"></a> [elasticache\_subnets\_cidr\_blocks](#output\_elasticache\_subnets\_cidr\_blocks) | List of cidr\_blocks of elasticache subnets |
| <a name="output_elasticache_subnets_ipv6_cidr_blocks"></a> [elasticache\_subnets\_ipv6\_cidr\_blocks](#output\_elasticache\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of elasticache subnets in an IPv6 enabled VPC |
| <a name="output_igw_arn"></a> [igw\_arn](#output\_igw\_arn) | The ARN of the Internet Gateway |
| <a name="output_igw_id"></a> [igw\_id](#output\_igw\_id) | The ID of the Internet Gateway |
| <a name="output_intra_network_acl_arn"></a> [intra\_network\_acl\_arn](#output\_intra\_network\_acl\_arn) | ARN of the intra network ACL |
| <a name="output_intra_network_acl_id"></a> [intra\_network\_acl\_id](#output\_intra\_network\_acl\_id) | ID of the intra network ACL |
| <a name="output_intra_route_table_association_ids"></a> [intra\_route\_table\_association\_ids](#output\_intra\_route\_table\_association\_ids) | List of IDs of the intra route table association |
| <a name="output_intra_route_table_ids"></a> [intra\_route\_table\_ids](#output\_intra\_route\_table\_ids) | List of IDs of intra route tables |
| <a name="output_intra_subnet_arns"></a> [intra\_subnet\_arns](#output\_intra\_subnet\_arns) | List of ARNs of intra subnets |
| <a name="output_intra_subnets"></a> [intra\_subnets](#output\_intra\_subnets) | List of IDs of intra subnets |
| <a name="output_intra_subnets_cidr_blocks"></a> [intra\_subnets\_cidr\_blocks](#output\_intra\_subnets\_cidr\_blocks) | List of cidr\_blocks of intra subnets |
| <a name="output_intra_subnets_ipv6_cidr_blocks"></a> [intra\_subnets\_ipv6\_cidr\_blocks](#output\_intra\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of intra subnets in an IPv6 enabled VPC |
| <a name="output_nat_ids"></a> [nat\_ids](#output\_nat\_ids) | List of allocation ID of Elastic IPs created for AWS NAT Gateway |
| <a name="output_nat_public_ips"></a> [nat\_public\_ips](#output\_nat\_public\_ips) | List of public Elastic IPs created for AWS NAT Gateway |
| <a name="output_natgw_ids"></a> [natgw\_ids](#output\_natgw\_ids) | List of NAT Gateway IDs |
| <a name="output_outpost_network_acl_arn"></a> [outpost\_network\_acl\_arn](#output\_outpost\_network\_acl\_arn) | ARN of the outpost network ACL |
| <a name="output_outpost_network_acl_id"></a> [outpost\_network\_acl\_id](#output\_outpost\_network\_acl\_id) | ID of the outpost network ACL |
| <a name="output_outpost_subnet_arns"></a> [outpost\_subnet\_arns](#output\_outpost\_subnet\_arns) | List of ARNs of outpost subnets |
| <a name="output_outpost_subnets"></a> [outpost\_subnets](#output\_outpost\_subnets) | List of IDs of outpost subnets |
| <a name="output_outpost_subnets_cidr_blocks"></a> [outpost\_subnets\_cidr\_blocks](#output\_outpost\_subnets\_cidr\_blocks) | List of cidr\_blocks of outpost subnets |
| <a name="output_outpost_subnets_ipv6_cidr_blocks"></a> [outpost\_subnets\_ipv6\_cidr\_blocks](#output\_outpost\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of outpost subnets in an IPv6 enabled VPC |
| <a name="output_private_ipv6_egress_route_ids"></a> [private\_ipv6\_egress\_route\_ids](#output\_private\_ipv6\_egress\_route\_ids) | List of IDs of the ipv6 egress route |
| <a name="output_private_nat_gateway_route_ids"></a> [private\_nat\_gateway\_route\_ids](#output\_private\_nat\_gateway\_route\_ids) | List of IDs of the private nat gateway route |
| <a name="output_private_network_acl_arn"></a> [private\_network\_acl\_arn](#output\_private\_network\_acl\_arn) | ARN of the private network ACL |
| <a name="output_private_network_acl_id"></a> [private\_network\_acl\_id](#output\_private\_network\_acl\_id) | ID of the private network ACL |
| <a name="output_private_route_table_association_ids"></a> [private\_route\_table\_association\_ids](#output\_private\_route\_table\_association\_ids) | List of IDs of the private route table association |
| <a name="output_private_route_table_ids"></a> [private\_route\_table\_ids](#output\_private\_route\_table\_ids) | List of IDs of private route tables |
| <a name="output_private_subnet_arns"></a> [private\_subnet\_arns](#output\_private\_subnet\_arns) | List of ARNs of private subnets |
| <a name="output_private_subnets"></a> [private\_subnets](#output\_private\_subnets) | List of IDs of private subnets |
| <a name="output_private_subnets_cidr_blocks"></a> [private\_subnets\_cidr\_blocks](#output\_private\_subnets\_cidr\_blocks) | List of cidr\_blocks of private subnets |
| <a name="output_private_subnets_ipv6_cidr_blocks"></a> [private\_subnets\_ipv6\_cidr\_blocks](#output\_private\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of private subnets in an IPv6 enabled VPC |
| <a name="output_public_internet_gateway_ipv6_route_id"></a> [public\_internet\_gateway\_ipv6\_route\_id](#output\_public\_internet\_gateway\_ipv6\_route\_id) | ID of the IPv6 internet gateway route |
| <a name="output_public_internet_gateway_route_id"></a> [public\_internet\_gateway\_route\_id](#output\_public\_internet\_gateway\_route\_id) | ID of the internet gateway route |
| <a name="output_public_network_acl_arn"></a> [public\_network\_acl\_arn](#output\_public\_network\_acl\_arn) | ARN of the public network ACL |
| <a name="output_public_network_acl_id"></a> [public\_network\_acl\_id](#output\_public\_network\_acl\_id) | ID of the public network ACL |
| <a name="output_public_route_table_association_ids"></a> [public\_route\_table\_association\_ids](#output\_public\_route\_table\_association\_ids) | List of IDs of the public route table association |
| <a name="output_public_route_table_ids"></a> [public\_route\_table\_ids](#output\_public\_route\_table\_ids) | List of IDs of public route tables |
| <a name="output_public_subnet_arns"></a> [public\_subnet\_arns](#output\_public\_subnet\_arns) | List of ARNs of public subnets |
| <a name="output_public_subnets"></a> [public\_subnets](#output\_public\_subnets) | List of IDs of public subnets |
| <a name="output_public_subnets_cidr_blocks"></a> [public\_subnets\_cidr\_blocks](#output\_public\_subnets\_cidr\_blocks) | List of cidr\_blocks of public subnets |
| <a name="output_public_subnets_ipv6_cidr_blocks"></a> [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC |
| <a name="output_redshift_network_acl_arn"></a> [redshift\_network\_acl\_arn](#output\_redshift\_network\_acl\_arn) | ARN of the redshift network ACL |
| <a name="output_redshift_network_acl_id"></a> [redshift\_network\_acl\_id](#output\_redshift\_network\_acl\_id) | ID of the redshift network ACL |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshift route table association |
| <a name="output_redshift_route_table_association_ids"></a> [redshift\_route\_table\_association\_ids](#output\_redshift\_route\_table\_association\_ids) | List of IDs of the redshift route table association |
| <a name="output_redshift_route_table_ids"></a> [redshift\_route\_table\_ids](#output\_redshift\_route\_table\_ids) | List of IDs of redshift route tables |
| <a name="output_redshift_subnet_arns"></a> [redshift\_subnet\_arns](#output\_redshift\_subnet\_arns) | List of ARNs of redshift subnets |
| <a name="output_redshift_subnet_group"></a> [redshift\_subnet\_group](#output\_redshift\_subnet\_group) | ID of redshift subnet group |
| <a name="output_redshift_subnets"></a> [redshift\_subnets](#output\_redshift\_subnets) | List of IDs of redshift subnets |
| <a name="output_redshift_subnets_cidr_blocks"></a> [redshift\_subnets\_cidr\_blocks](#output\_redshift\_subnets\_cidr\_blocks) | List of cidr\_blocks of redshift subnets |
| <a name="output_redshift_subnets_ipv6_cidr_blocks"></a> [redshift\_subnets\_ipv6\_cidr\_blocks](#output\_redshift\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of redshift subnets in an IPv6 enabled VPC |
| <a name="output_this_customer_gateway"></a> [this\_customer\_gateway](#output\_this\_customer\_gateway) | Map of Customer Gateway attributes |
| <a name="output_vgw_arn"></a> [vgw\_arn](#output\_vgw\_arn) | The ARN of the VPN Gateway |
| <a name="output_vgw_id"></a> [vgw\_id](#output\_vgw\_id) | The ID of the VPN Gateway |
| <a name="output_vpc_arn"></a> [vpc\_arn](#output\_vpc\_arn) | The ARN of the VPC |
| <a name="output_vpc_cidr_block"></a> [vpc\_cidr\_block](#output\_vpc\_cidr\_block) | The CIDR block of the VPC |
| <a name="output_vpc_enable_dns_hostnames"></a> [vpc\_enable\_dns\_hostnames](#output\_vpc\_enable\_dns\_hostnames) | Whether or not the VPC has DNS hostname support |
| <a name="output_vpc_enable_dns_support"></a> [vpc\_enable\_dns\_support](#output\_vpc\_enable\_dns\_support) | Whether or not the VPC has DNS support |
| <a name="output_vpc_flow_log_cloudwatch_iam_role_arn"></a> [vpc\_flow\_log\_cloudwatch\_iam\_role\_arn](#output\_vpc\_flow\_log\_cloudwatch\_iam\_role\_arn) | The ARN of the IAM role used when pushing logs to Cloudwatch log group |
| <a name="output_vpc_flow_log_destination_arn"></a> [vpc\_flow\_log\_destination\_arn](#output\_vpc\_flow\_log\_destination\_arn) | The ARN of the destination for VPC Flow Logs |
| <a name="output_vpc_flow_log_destination_type"></a> [vpc\_flow\_log\_destination\_type](#output\_vpc\_flow\_log\_destination\_type) | The type of the destination for VPC Flow Logs |
| <a name="output_vpc_flow_log_id"></a> [vpc\_flow\_log\_id](#output\_vpc\_flow\_log\_id) | The ID of the Flow Log resource |
| <a name="output_vpc_id"></a> [vpc\_id](#output\_vpc\_id) | The ID of the VPC |
| <a name="output_vpc_instance_tenancy"></a> [vpc\_instance\_tenancy](#output\_vpc\_instance\_tenancy) | Tenancy of instances spin up within VPC |
| <a name="output_vpc_ipv6_association_id"></a> [vpc\_ipv6\_association\_id](#output\_vpc\_ipv6\_association\_id) | The association ID for the IPv6 CIDR block |
| <a name="output_vpc_ipv6_cidr_block"></a> [vpc\_ipv6\_cidr\_block](#output\_vpc\_ipv6\_cidr\_block) | The IPv6 CIDR block |
| <a name="output_vpc_main_route_table_id"></a> [vpc\_main\_route\_table\_id](#output\_vpc\_main\_route\_table\_id) | The ID of the main route table associated with this VPC |
| <a name="output_vpc_owner_id"></a> [vpc\_owner\_id](#output\_vpc\_owner\_id) | The ID of the AWS account that owns the VPC |
| <a name="output_vpc_secondary_cidr_blocks"></a> [vpc\_secondary\_cidr\_blocks](#output\_vpc\_secondary\_cidr\_blocks) | List of secondary CIDR blocks of the VPC |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
provider "aws" {
region = local.region
}
locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"
partition = cidrsubnets(aws_vpc_ipam_preview_next_cidr.this.cidr, 2, 2)
tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
}
################################################################################
# VPC Module
################################################################################
module "vpc" {
source = "../.."
name = local.name
private_subnets = cidrsubnets(local.partition[0], 2, 2)
public_subnets = cidrsubnets(local.partition[1], 2, 2)
ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id
azs = ["${local.region}a", "${local.region}b"]
cidr = aws_vpc_ipam_preview_next_cidr.this.cidr
tags = local.tags
}
################################################################################
# Supporting Resources
################################################################################
/*
NOTES ON IPAM USAGE:
In order to build subnets with your VPC Terraform must know subnet CIDRs to properly plan # of resources to build.
Since CIDR is derived by IPAM by calling CreateVpc this is not possible within a module unless cidr is known ahead of time.
We can get around this by "previewing" the CIDR and then using that as the subnet values.
In the example above we use `cidrsubnets()` to calculate a public and private "partitions" (group of cidrs) then calculate the specific
CIDRs for each subnet type.
For an explanation on prolonged delete times on IPAM pools see 2nd
*note* in terraform docs: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool_cidr
*/
resource "aws_vpc_ipam" "this" {
operating_regions {
region_name = local.region
}
}
resource "aws_vpc_ipam_pool" "this" {
address_family = "ipv4"
ipam_scope_id = aws_vpc_ipam.this.private_default_scope_id
locale = local.region
allocation_default_netmask_length = 24
}
resource "aws_vpc_ipam_pool_cidr" "this" {
ipam_pool_id = aws_vpc_ipam_pool.this.id
cidr = "10.0.0.0/16"
}
resource "aws_vpc_ipam_preview_next_cidr" "this" {
ipam_pool_id = aws_vpc_ipam_pool.this.id
netmask_length = 20
depends_on = [
aws_vpc_ipam_pool_cidr.this
]
}
output "vpc_id" {
description = "The ID of the VPC"
value = module.vpc.vpc_id
}
output "vpc_arn" {
description = "The ARN of the VPC"
value = module.vpc.vpc_arn
}
output "vpc_cidr_block" {
description = "The CIDR block of the VPC"
value = module.vpc.vpc_cidr_block
}
output "default_security_group_id" {
description = "The ID of the security group created by default on VPC creation"
value = module.vpc.default_security_group_id
}
output "default_network_acl_id" {
description = "The ID of the default network ACL"
value = module.vpc.default_network_acl_id
}
output "default_route_table_id" {
description = "The ID of the default route table"
value = module.vpc.default_route_table_id
}
output "vpc_instance_tenancy" {
description = "Tenancy of instances spin up within VPC"
value = module.vpc.vpc_instance_tenancy
}
output "vpc_enable_dns_support" {
description = "Whether or not the VPC has DNS support"
value = module.vpc.vpc_enable_dns_support
}
output "vpc_enable_dns_hostnames" {
description = "Whether or not the VPC has DNS hostname support"
value = module.vpc.vpc_enable_dns_hostnames
}
output "vpc_main_route_table_id" {
description = "The ID of the main route table associated with this VPC"
value = module.vpc.vpc_main_route_table_id
}
output "vpc_ipv6_association_id" {
description = "The association ID for the IPv6 CIDR block"
value = module.vpc.vpc_ipv6_association_id
}
output "vpc_ipv6_cidr_block" {
description = "The IPv6 CIDR block"
value = module.vpc.vpc_ipv6_cidr_block
}
output "vpc_secondary_cidr_blocks" {
description = "List of secondary CIDR blocks of the VPC"
value = module.vpc.vpc_secondary_cidr_blocks
}
output "vpc_owner_id" {
description = "The ID of the AWS account that owns the VPC"
value = module.vpc.vpc_owner_id
}
output "private_subnets" {
description = "List of IDs of private subnets"
value = module.vpc.private_subnets
}
output "private_subnet_arns" {
description = "List of ARNs of private subnets"
value = module.vpc.private_subnet_arns
}
output "private_subnets_cidr_blocks" {
description = "List of cidr_blocks of private subnets"
value = module.vpc.private_subnets_cidr_blocks
}
output "private_subnets_ipv6_cidr_blocks" {
description = "List of IPv6 cidr_blocks of private subnets in an IPv6 enabled VPC"
value = module.vpc.private_subnets_ipv6_cidr_blocks
}
output "public_subnets" {
description = "List of IDs of public subnets"
value = module.vpc.public_subnets
}
output "public_subnet_arns" {
description = "List of ARNs of public subnets"
value = module.vpc.public_subnet_arns
}
output "public_subnets_cidr_blocks" {
description = "List of cidr_blocks of public subnets"
value = module.vpc.public_subnets_cidr_blocks
}
output "public_subnets_ipv6_cidr_blocks" {
description = "List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC"
value = module.vpc.public_subnets_ipv6_cidr_blocks
}
output "outpost_subnets" {
description = "List of IDs of outpost subnets"
value = module.vpc.outpost_subnets
}
output "outpost_subnet_arns" {
description = "List of ARNs of outpost subnets"
value = module.vpc.outpost_subnet_arns
}
output "outpost_subnets_cidr_blocks" {
description = "List of cidr_blocks of outpost subnets"
value = module.vpc.outpost_subnets_cidr_blocks
}
output "outpost_subnets_ipv6_cidr_blocks" {
description = "List of IPv6 cidr_blocks of outpost subnets in an IPv6 enabled VPC"
value = module.vpc.outpost_subnets_ipv6_cidr_blocks
}
output "database_subnets" {
description = "List of IDs of database subnets"
value = module.vpc.database_subnets
}
output "database_subnet_arns" {
description = "List of ARNs of database subnets"
value = module.vpc.database_subnet_arns
}
output "database_subnets_cidr_blocks" {
description = "List of cidr_blocks of database subnets"
value = module.vpc.database_subnets_cidr_blocks
}
output "database_subnets_ipv6_cidr_blocks" {
description = "List of IPv6 cidr_blocks of database subnets in an IPv6 enabled VPC"
value = module.vpc.database_subnets_ipv6_cidr_blocks
}
output "database_subnet_group" {
description = "ID of database subnet group"
value = module.vpc.database_subnet_group
}
output "database_subnet_group_name" {
description = "Name of database subnet group"
value = module.vpc.database_subnet_group_name
}
output "redshift_subnets" {
description = "List of IDs of redshift subnets"
value = module.vpc.redshift_subnets
}
output "redshift_subnet_arns" {
description = "List of ARNs of redshift subnets"
value = module.vpc.redshift_subnet_arns
}
output "redshift_subnets_cidr_blocks" {
description = "List of cidr_blocks of redshift subnets"
value = module.vpc.redshift_subnets_cidr_blocks
}
output "redshift_subnets_ipv6_cidr_blocks" {
description = "List of IPv6 cidr_blocks of redshift subnets in an IPv6 enabled VPC"
value = module.vpc.redshift_subnets_ipv6_cidr_blocks
}
output "redshift_subnet_group" {
description = "ID of redshift subnet group"
value = module.vpc.redshift_subnet_group
}
output "elasticache_subnets" {
description = "List of IDs of elasticache subnets"
value = module.vpc.elasticache_subnets
}
output "elasticache_subnet_arns" {
description = "List of ARNs of elasticache subnets"
value = module.vpc.elasticache_subnet_arns
}
output "elasticache_subnets_cidr_blocks" {
description = "List of cidr_blocks of elasticache subnets"
value = module.vpc.elasticache_subnets_cidr_blocks
}
output "elasticache_subnets_ipv6_cidr_blocks" {
description = "List of IPv6 cidr_blocks of elasticache subnets in an IPv6 enabled VPC"
value = module.vpc.elasticache_subnets_ipv6_cidr_blocks
}
output "intra_subnets" {
description = "List of IDs of intra subnets"
value = module.vpc.intra_subnets
}
output "intra_subnet_arns" {
description = "List of ARNs of intra subnets"
value = module.vpc.intra_subnet_arns
}
output "intra_subnets_cidr_blocks" {
description = "List of cidr_blocks of intra subnets"
value = module.vpc.intra_subnets_cidr_blocks
}
output "intra_subnets_ipv6_cidr_blocks" {
description = "List of IPv6 cidr_blocks of intra subnets in an IPv6 enabled VPC"
value = module.vpc.intra_subnets_ipv6_cidr_blocks
}
output "elasticache_subnet_group" {
description = "ID of elasticache subnet group"
value = module.vpc.elasticache_subnet_group
}
output "elasticache_subnet_group_name" {
description = "Name of elasticache subnet group"
value = module.vpc.elasticache_subnet_group_name
}
output "public_route_table_ids" {
description = "List of IDs of public route tables"
value = module.vpc.public_route_table_ids
}
output "private_route_table_ids" {
description = "List of IDs of private route tables"
value = module.vpc.private_route_table_ids
}
output "database_route_table_ids" {
description = "List of IDs of database route tables"
value = module.vpc.database_route_table_ids
}
output "redshift_route_table_ids" {
description = "List of IDs of redshift route tables"
value = module.vpc.redshift_route_table_ids
}
output "elasticache_route_table_ids" {
description = "List of IDs of elasticache route tables"
value = module.vpc.elasticache_route_table_ids
}
output "intra_route_table_ids" {
description = "List of IDs of intra route tables"
value = module.vpc.intra_route_table_ids
}
output "public_internet_gateway_route_id" {
description = "ID of the internet gateway route"
value = module.vpc.public_internet_gateway_route_id
}
output "public_internet_gateway_ipv6_route_id" {
description = "ID of the IPv6 internet gateway route"
value = module.vpc.public_internet_gateway_ipv6_route_id
}
output "database_internet_gateway_route_id" {
description = "ID of the database internet gateway route"
value = module.vpc.database_internet_gateway_route_id
}
output "database_nat_gateway_route_ids" {
description = "List of IDs of the database nat gateway route"
value = module.vpc.database_nat_gateway_route_ids
}
output "database_ipv6_egress_route_id" {
description = "ID of the database IPv6 egress route"
value = module.vpc.database_ipv6_egress_route_id
}
output "private_nat_gateway_route_ids" {
description = "List of IDs of the private nat gateway route"
value = module.vpc.private_nat_gateway_route_ids
}
output "private_ipv6_egress_route_ids" {
description = "List of IDs of the ipv6 egress route"
value = module.vpc.private_ipv6_egress_route_ids
}
output "private_route_table_association_ids" {
description = "List of IDs of the private route table association"
value = module.vpc.private_route_table_association_ids
}
output "database_route_table_association_ids" {
description = "List of IDs of the database route table association"
value = module.vpc.database_route_table_association_ids
}
output "redshift_route_table_association_ids" {
description = "List of IDs of the redshift route table association"
value = module.vpc.redshift_route_table_association_ids
}
output "redshift_public_route_table_association_ids" {
description = "List of IDs of the public redshift route table association"
value = module.vpc.redshift_public_route_table_association_ids
}
output "elasticache_route_table_association_ids" {
description = "List of IDs of the elasticache route table association"
value = module.vpc.elasticache_route_table_association_ids
}
output "intra_route_table_association_ids" {
description = "List of IDs of the intra route table association"
value = module.vpc.intra_route_table_association_ids
}
output "public_route_table_association_ids" {
description = "List of IDs of the public route table association"
value = module.vpc.public_route_table_association_ids
}
output "dhcp_options_id" {
description = "The ID of the DHCP options"
value = module.vpc.dhcp_options_id
}
output "nat_ids" {
description = "List of allocation ID of Elastic IPs created for AWS NAT Gateway"
value = module.vpc.nat_ids
}
output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway"
value = module.vpc.nat_public_ips
}
output "natgw_ids" {
description = "List of NAT Gateway IDs"
value = module.vpc.natgw_ids
}
output "igw_id" {
description = "The ID of the Internet Gateway"
value = module.vpc.igw_id
}
output "igw_arn" {
description = "The ARN of the Internet Gateway"
value = module.vpc.igw_arn
}
output "egress_only_internet_gateway_id" {
description = "The ID of the egress only Internet Gateway"
value = module.vpc.egress_only_internet_gateway_id
}
output "cgw_ids" {
description = "List of IDs of Customer Gateway"
value = module.vpc.cgw_ids
}
output "cgw_arns" {
description = "List of ARNs of Customer Gateway"
value = module.vpc.cgw_arns
}
output "this_customer_gateway" {
description = "Map of Customer Gateway attributes"
value = module.vpc.this_customer_gateway
}
output "vgw_id" {
description = "The ID of the VPN Gateway"
value = module.vpc.vgw_id
}
output "vgw_arn" {
description = "The ARN of the VPN Gateway"
value = module.vpc.vgw_arn
}
output "default_vpc_id" {
description = "The ID of the Default VPC"
value = module.vpc.default_vpc_id
}
output "default_vpc_arn" {
description = "The ARN of the Default VPC"
value = module.vpc.default_vpc_arn
}
output "default_vpc_cidr_block" {
description = "The CIDR block of the Default VPC"
value = module.vpc.default_vpc_cidr_block
}
output "default_vpc_default_security_group_id" {
description = "The ID of the security group created by default on Default VPC creation"
value = module.vpc.default_vpc_default_security_group_id
}
output "default_vpc_default_network_acl_id" {
description = "The ID of the default network ACL of the Default VPC"
value = module.vpc.default_vpc_default_network_acl_id
}
output "default_vpc_default_route_table_id" {
description = "The ID of the default route table of the Default VPC"
value = module.vpc.default_vpc_default_route_table_id
}
output "default_vpc_instance_tenancy" {
description = "Tenancy of instances spin up within Default VPC"
value = module.vpc.default_vpc_instance_tenancy
}
output "default_vpc_enable_dns_support" {
description = "Whether or not the Default VPC has DNS support"
value = module.vpc.default_vpc_enable_dns_support
}
output "default_vpc_enable_dns_hostnames" {
description = "Whether or not the Default VPC has DNS hostname support"
value = module.vpc.default_vpc_enable_dns_hostnames
}
output "default_vpc_main_route_table_id" {
description = "The ID of the main route table associated with the Default VPC"
value = module.vpc.default_vpc_main_route_table_id
}
output "public_network_acl_id" {
description = "ID of the public network ACL"
value = module.vpc.public_network_acl_id
}
output "public_network_acl_arn" {
description = "ARN of the public network ACL"
value = module.vpc.public_network_acl_arn
}
output "private_network_acl_id" {
description = "ID of the private network ACL"
value = module.vpc.private_network_acl_id
}
output "private_network_acl_arn" {
description = "ARN of the private network ACL"
value = module.vpc.private_network_acl_arn
}
output "outpost_network_acl_id" {
description = "ID of the outpost network ACL"
value = module.vpc.outpost_network_acl_id
}
output "outpost_network_acl_arn" {
description = "ARN of the outpost network ACL"
value = module.vpc.outpost_network_acl_arn
}
output "intra_network_acl_id" {
description = "ID of the intra network ACL"
value = module.vpc.intra_network_acl_id
}
output "intra_network_acl_arn" {
description = "ARN of the intra network ACL"
value = module.vpc.intra_network_acl_arn
}
output "database_network_acl_id" {
description = "ID of the database network ACL"
value = module.vpc.database_network_acl_id
}
output "database_network_acl_arn" {
description = "ARN of the database network ACL"
value = module.vpc.database_network_acl_arn
}
output "redshift_network_acl_id" {
description = "ID of the redshift network ACL"
value = module.vpc.redshift_network_acl_id
}
output "redshift_network_acl_arn" {
description = "ARN of the redshift network ACL"
value = module.vpc.redshift_network_acl_arn
}
output "elasticache_network_acl_id" {
description = "ID of the elasticache network ACL"
value = module.vpc.elasticache_network_acl_id
}
output "elasticache_network_acl_arn" {
description = "ARN of the elasticache network ACL"
value = module.vpc.elasticache_network_acl_arn
}
# VPC flow log
output "vpc_flow_log_id" {
description = "The ID of the Flow Log resource"
value = module.vpc.vpc_flow_log_id
}
output "vpc_flow_log_destination_arn" {
description = "The ARN of the destination for VPC Flow Logs"
value = module.vpc.vpc_flow_log_destination_arn
}
output "vpc_flow_log_destination_type" {
description = "The type of the destination for VPC Flow Logs"
value = module.vpc.vpc_flow_log_destination_type
}
output "vpc_flow_log_cloudwatch_iam_role_arn" {
description = "The ARN of the IAM role used when pushing logs to Cloudwatch log group"
value = module.vpc.vpc_flow_log_cloudwatch_iam_role_arn
}
terraform {
required_version = ">= 0.13.1"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.73"
}
}
}
......@@ -20,7 +20,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.63 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
## Providers
......@@ -125,7 +125,7 @@ No inputs.
| <a name="output_public_subnets_ipv6_cidr_blocks"></a> [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC |
| <a name="output_redshift_network_acl_arn"></a> [redshift\_network\_acl\_arn](#output\_redshift\_network\_acl\_arn) | ARN of the redshift network ACL |
| <a name="output_redshift_network_acl_id"></a> [redshift\_network\_acl\_id](#output\_redshift\_network\_acl\_id) | ID of the redshift network ACL |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshidt route table association |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshift route table association |
| <a name="output_redshift_route_table_association_ids"></a> [redshift\_route\_table\_association\_ids](#output\_redshift\_route\_table\_association\_ids) | List of IDs of the redshift route table association |
| <a name="output_redshift_route_table_ids"></a> [redshift\_route\_table\_ids](#output\_redshift\_route\_table\_ids) | List of IDs of redshift route tables |
| <a name="output_redshift_subnet_arns"></a> [redshift\_subnet\_arns](#output\_redshift\_subnet\_arns) | List of ARNs of redshift subnets |
......
......@@ -3,7 +3,14 @@ provider "aws" {
}
locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"
tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
}
################################################################################
......@@ -35,8 +42,5 @@ module "vpc" {
private_subnet_ipv6_prefixes = [2, 3]
database_subnet_ipv6_prefixes = [4, 5]
tags = {
Owner = "user"
Environment = "dev"
}
tags = local.tags
}
......@@ -314,7 +314,7 @@ output "redshift_route_table_association_ids" {
}
output "redshift_public_route_table_association_ids" {
description = "List of IDs of the public redshidt route table association"
description = "List of IDs of the public redshift route table association"
value = module.vpc.redshift_public_route_table_association_ids
}
......
......@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.63"
version = ">= 3.73"
}
}
}
......@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.63 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
## Providers
......
......@@ -3,7 +3,14 @@ provider "aws" {
}
locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"
tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
}
################################################################################
......@@ -24,10 +31,10 @@ module "vpc_issue_44" {
create_database_subnet_group = true
enable_nat_gateway = true
tags = {
tags = merge({
Issue = "44"
Name = "asymmetrical"
}
}, local.tags)
}
################################################################################
......@@ -50,10 +57,10 @@ module "vpc_issue_46" {
enable_dns_hostnames = true
enable_nat_gateway = false
tags = {
tags = merge({
Issue = "46"
Name = "no-private-subnets"
}
}, local.tags)
}
################################################################################
......@@ -73,8 +80,8 @@ module "vpc_issue_108" {
single_nat_gateway = true
enable_nat_gateway = true
tags = {
tags = merge({
Issue = "108"
Name = "route-already-exists"
}
}, local.tags)
}
......@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.63"
version = ">= 3.73"
}
}
}
......@@ -22,7 +22,7 @@ Run `terraform destroy` when you don't need these resources.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.63 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
## Providers
......@@ -127,7 +127,7 @@ No inputs.
| <a name="output_public_subnets_ipv6_cidr_blocks"></a> [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC |
| <a name="output_redshift_network_acl_arn"></a> [redshift\_network\_acl\_arn](#output\_redshift\_network\_acl\_arn) | ARN of the redshift network ACL |
| <a name="output_redshift_network_acl_id"></a> [redshift\_network\_acl\_id](#output\_redshift\_network\_acl\_id) | ID of the redshift network ACL |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshidt route table association |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshift route table association |
| <a name="output_redshift_route_table_association_ids"></a> [redshift\_route\_table\_association\_ids](#output\_redshift\_route\_table\_association\_ids) | List of IDs of the redshift route table association |
| <a name="output_redshift_route_table_ids"></a> [redshift\_route\_table\_ids](#output\_redshift\_route\_table\_ids) | List of IDs of redshift route tables |
| <a name="output_redshift_subnet_arns"></a> [redshift\_subnet\_arns](#output\_redshift\_subnet\_arns) | List of ARNs of redshift subnets |
......
......@@ -3,7 +3,14 @@ provider "aws" {
}
locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"
tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
}
################################################################################
......@@ -18,4 +25,6 @@ module "vpc" {
manage_default_vpc = true
default_vpc_name = "default"
default_vpc_enable_dns_hostnames = true
tags = local.tags
}
......@@ -314,7 +314,7 @@ output "redshift_route_table_association_ids" {
}
output "redshift_public_route_table_association_ids" {
description = "List of IDs of the public redshidt route table association"
description = "List of IDs of the public redshift route table association"
value = module.vpc.redshift_public_route_table_association_ids
}
......
......@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.63"
version = ">= 3.73"
}
}
}
......@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.63 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
## Providers
......@@ -129,7 +129,7 @@ No inputs.
| <a name="output_public_subnets_ipv6_cidr_blocks"></a> [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC |
| <a name="output_redshift_network_acl_arn"></a> [redshift\_network\_acl\_arn](#output\_redshift\_network\_acl\_arn) | ARN of the redshift network ACL |
| <a name="output_redshift_network_acl_id"></a> [redshift\_network\_acl\_id](#output\_redshift\_network\_acl\_id) | ID of the redshift network ACL |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshidt route table association |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshift route table association |
| <a name="output_redshift_route_table_association_ids"></a> [redshift\_route\_table\_association\_ids](#output\_redshift\_route\_table\_association\_ids) | List of IDs of the redshift route table association |
| <a name="output_redshift_route_table_ids"></a> [redshift\_route\_table\_ids](#output\_redshift\_route\_table\_ids) | List of IDs of redshift route tables |
| <a name="output_redshift_subnet_arns"></a> [redshift\_subnet\_arns](#output\_redshift\_subnet\_arns) | List of ARNs of redshift subnets |
......
......@@ -3,8 +3,15 @@ provider "aws" {
}
locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"
tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
network_acls = {
default_inbound = [
{
......@@ -162,7 +169,7 @@ locals {
module "vpc" {
source = "../../"
name = "network-acls-example"
name = local.name
cidr = "10.0.0.0/16"
azs = ["${local.region}a", "${local.region}b", "${local.region}c"]
......@@ -189,10 +196,7 @@ module "vpc" {
Name = "overridden-name-public"
}
tags = {
Owner = "user"
Environment = "dev"
}
tags = local.tags
vpc_tags = {
Name = "vpc-name"
......
......@@ -314,7 +314,7 @@ output "redshift_route_table_association_ids" {
}
output "redshift_public_route_table_association_ids" {
description = "List of IDs of the public redshidt route table association"
description = "List of IDs of the public redshift route table association"
value = module.vpc.redshift_public_route_table_association_ids
}
......
......@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.63"
version = ">= 3.73"
}
}
}
......@@ -24,13 +24,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.63 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
## Providers
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.63 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.73 |
## Modules
......@@ -134,7 +134,7 @@ No inputs.
| <a name="output_public_subnets_ipv6_cidr_blocks"></a> [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC |
| <a name="output_redshift_network_acl_arn"></a> [redshift\_network\_acl\_arn](#output\_redshift\_network\_acl\_arn) | ARN of the redshift network ACL |
| <a name="output_redshift_network_acl_id"></a> [redshift\_network\_acl\_id](#output\_redshift\_network\_acl\_id) | ID of the redshift network ACL |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshidt route table association |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshift route table association |
| <a name="output_redshift_route_table_association_ids"></a> [redshift\_route\_table\_association\_ids](#output\_redshift\_route\_table\_association\_ids) | List of IDs of the redshift route table association |
| <a name="output_redshift_route_table_ids"></a> [redshift\_route\_table\_ids](#output\_redshift\_route\_table\_ids) | List of IDs of redshift route tables |
| <a name="output_redshift_subnet_arns"></a> [redshift\_subnet\_arns](#output\_redshift\_subnet\_arns) | List of ARNs of redshift subnets |
......
......@@ -7,8 +7,15 @@ provider "aws" {
}
locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"
tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
network_acls = {
outpost_inbound = [
{
......@@ -122,7 +129,7 @@ data "aws_availability_zones" "available" {}
module "vpc" {
source = "../../"
name = "outpost-example"
name = local.name
cidr = "10.0.0.0/16"
azs = [
......@@ -152,8 +159,5 @@ module "vpc" {
outpost_inbound_acl_rules = local.network_acls["outpost_inbound"]
outpost_outbound_acl_rules = local.network_acls["outpost_outbound"]
tags = {
Owner = "user"
Environment = "dev"
}
tags = local.tags
}
......@@ -314,7 +314,7 @@ output "redshift_route_table_association_ids" {
}
output "redshift_public_route_table_association_ids" {
description = "List of IDs of the public redshidt route table association"
description = "List of IDs of the public redshift route table association"
value = module.vpc.redshift_public_route_table_association_ids
}
......
......@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.63"
version = ">= 3.73"
}
}
}
......@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.63 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
## Providers
......@@ -127,7 +127,7 @@ No inputs.
| <a name="output_public_subnets_ipv6_cidr_blocks"></a> [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC |
| <a name="output_redshift_network_acl_arn"></a> [redshift\_network\_acl\_arn](#output\_redshift\_network\_acl\_arn) | ARN of the redshift network ACL |
| <a name="output_redshift_network_acl_id"></a> [redshift\_network\_acl\_id](#output\_redshift\_network\_acl\_id) | ID of the redshift network ACL |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshidt route table association |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshift route table association |
| <a name="output_redshift_route_table_association_ids"></a> [redshift\_route\_table\_association\_ids](#output\_redshift\_route\_table\_association\_ids) | List of IDs of the redshift route table association |
| <a name="output_redshift_route_table_ids"></a> [redshift\_route\_table\_ids](#output\_redshift\_route\_table\_ids) | List of IDs of redshift route tables |
| <a name="output_redshift_subnet_arns"></a> [redshift\_subnet\_arns](#output\_redshift\_subnet\_arns) | List of ARNs of redshift subnets |
......
......@@ -3,7 +3,14 @@ provider "aws" {
}
locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"
tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
}
################################################################################
......@@ -13,7 +20,7 @@ locals {
module "vpc" {
source = "../../"
name = "secondary-cidr-blocks-example"
name = local.name
cidr = "10.0.0.0/16"
secondary_cidr_blocks = ["10.1.0.0/16", "10.2.0.0/16"]
......@@ -31,10 +38,7 @@ module "vpc" {
Name = "overridden-name-public"
}
tags = {
Owner = "user"
Environment = "dev"
}
tags = local.tags
vpc_tags = {
Name = "vpc-name"
......
......@@ -314,7 +314,7 @@ output "redshift_route_table_association_ids" {
}
output "redshift_public_route_table_association_ids" {
description = "List of IDs of the public redshidt route table association"
description = "List of IDs of the public redshift route table association"
value = module.vpc.redshift_public_route_table_association_ids
}
......
......@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.63"
version = ">= 3.73"
}
}
}
......@@ -26,7 +26,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.63 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
## Providers
......@@ -131,7 +131,7 @@ No inputs.
| <a name="output_public_subnets_ipv6_cidr_blocks"></a> [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC |
| <a name="output_redshift_network_acl_arn"></a> [redshift\_network\_acl\_arn](#output\_redshift\_network\_acl\_arn) | ARN of the redshift network ACL |
| <a name="output_redshift_network_acl_id"></a> [redshift\_network\_acl\_id](#output\_redshift\_network\_acl\_id) | ID of the redshift network ACL |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshidt route table association |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshift route table association |
| <a name="output_redshift_route_table_association_ids"></a> [redshift\_route\_table\_association\_ids](#output\_redshift\_route\_table\_association\_ids) | List of IDs of the redshift route table association |
| <a name="output_redshift_route_table_ids"></a> [redshift\_route\_table\_ids](#output\_redshift\_route\_table\_ids) | List of IDs of redshift route tables |
| <a name="output_redshift_subnet_arns"></a> [redshift\_subnet\_arns](#output\_redshift\_subnet\_arns) | List of ARNs of redshift subnets |
......
......@@ -3,7 +3,14 @@ provider "aws" {
}
locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"
tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
}
################################################################################
......@@ -13,7 +20,7 @@ locals {
module "vpc" {
source = "../../"
name = "simple-example"
name = local.name
cidr = "10.0.0.0/16"
azs = ["${local.region}a", "${local.region}b", "${local.region}c"]
......@@ -29,10 +36,7 @@ module "vpc" {
Name = "overridden-name-public"
}
tags = {
Owner = "user"
Environment = "dev"
}
tags = local.tags
vpc_tags = {
Name = "vpc-name"
......
......@@ -314,7 +314,7 @@ output "redshift_route_table_association_ids" {
}
output "redshift_public_route_table_association_ids" {
description = "List of IDs of the public redshidt route table association"
description = "List of IDs of the public redshift route table association"
value = module.vpc.redshift_public_route_table_association_ids
}
......
......@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.63"
version = ">= 3.73"
}
}
}
......@@ -3,8 +3,15 @@ provider "aws" {
}
locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"
tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
s3_bucket_name = "vpc-flow-logs-to-s3-${random_pet.this.id}"
cloudwatch_log_group_name = "vpc-flow-logs-to-cloudwatch-${random_pet.this.id}"
}
......@@ -16,7 +23,7 @@ locals {
module "vpc_with_flow_logs_s3_bucket" {
source = "../../"
name = "vpc-flow-logs-s3-bucket"
name = local.name
cidr = "10.30.0.0/16"
azs = ["${local.region}a"]
......@@ -26,15 +33,13 @@ module "vpc_with_flow_logs_s3_bucket" {
flow_log_destination_type = "s3"
flow_log_destination_arn = module.s3_bucket.s3_bucket_arn
vpc_flow_log_tags = {
Name = "vpc-flow-logs-s3-bucket"
}
vpc_flow_log_tags = local.tags
}
module "vpc_with_flow_logs_s3_bucket_parquet" {
source = "../../"
name = "vpc-flow-logs-s3-bucket"
name = "${local.name}-parquet"
cidr = "10.30.0.0/16"
azs = ["${local.region}a"]
......@@ -45,16 +50,14 @@ module "vpc_with_flow_logs_s3_bucket_parquet" {
flow_log_destination_arn = module.s3_bucket.s3_bucket_arn
flow_log_file_format = "parquet"
vpc_flow_log_tags = {
Name = "vpc-flow-logs-s3-bucket"
}
vpc_flow_log_tags = local.tags
}
# CloudWatch Log Group and IAM role created automatically
module "vpc_with_flow_logs_cloudwatch_logs_default" {
source = "../../"
name = "vpc-flow-logs-cloudwatch-logs-default"
name = "${local.name}-cloudwatch-logs-default"
cidr = "10.10.0.0/16"
azs = ["${local.region}a"]
......@@ -66,16 +69,14 @@ module "vpc_with_flow_logs_cloudwatch_logs_default" {
create_flow_log_cloudwatch_iam_role = true
flow_log_max_aggregation_interval = 60
vpc_flow_log_tags = {
Name = "vpc-flow-logs-cloudwatch-logs-default"
}
vpc_flow_log_tags = local.tags
}
# CloudWatch Log Group and IAM role created separately
module "vpc_with_flow_logs_cloudwatch_logs" {
source = "../../"
name = "vpc-flow-logs-cloudwatch-logs"
name = "${local.name}-cloudwatch-logs"
cidr = "10.20.0.0/16"
azs = ["${local.region}a"]
......@@ -86,9 +87,7 @@ module "vpc_with_flow_logs_cloudwatch_logs" {
flow_log_destination_arn = aws_cloudwatch_log_group.flow_log.arn
flow_log_cloudwatch_iam_role_arn = aws_iam_role.vpc_flow_log_cloudwatch.arn
vpc_flow_log_tags = {
Name = "vpc-flow-logs-cloudwatch-logs"
}
vpc_flow_log_tags = local.tags
}
################################################################################
......@@ -108,9 +107,7 @@ module "s3_bucket" {
policy = data.aws_iam_policy_document.flow_log_s3.json
force_destroy = true
tags = {
Name = "vpc-flow-logs-s3-bucket"
}
tags = local.tags
}
data "aws_iam_policy_document" "flow_log_s3" {
......
......@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.63 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
## Providers
......@@ -127,7 +127,7 @@ No inputs.
| <a name="output_public_subnets_ipv6_cidr_blocks"></a> [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC |
| <a name="output_redshift_network_acl_arn"></a> [redshift\_network\_acl\_arn](#output\_redshift\_network\_acl\_arn) | ARN of the redshift network ACL |
| <a name="output_redshift_network_acl_id"></a> [redshift\_network\_acl\_id](#output\_redshift\_network\_acl\_id) | ID of the redshift network ACL |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshidt route table association |
| <a name="output_redshift_public_route_table_association_ids"></a> [redshift\_public\_route\_table\_association\_ids](#output\_redshift\_public\_route\_table\_association\_ids) | List of IDs of the public redshift route table association |
| <a name="output_redshift_route_table_association_ids"></a> [redshift\_route\_table\_association\_ids](#output\_redshift\_route\_table\_association\_ids) | List of IDs of the redshift route table association |
| <a name="output_redshift_route_table_ids"></a> [redshift\_route\_table\_ids](#output\_redshift\_route\_table\_ids) | List of IDs of redshift route tables |
| <a name="output_redshift_subnet_arns"></a> [redshift\_subnet\_arns](#output\_redshift\_subnet\_arns) | List of ARNs of redshift subnets |
......
......@@ -3,7 +3,14 @@ provider "aws" {
}
locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"
tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
}
################################################################################
......@@ -13,7 +20,7 @@ locals {
module "vpc" {
source = "../../"
name = "vpc-separate-private-route-tables"
name = local.name
cidr = "10.10.0.0/16"
......@@ -31,9 +38,5 @@ module "vpc" {
single_nat_gateway = true
enable_nat_gateway = true
tags = {
Owner = "user"
Environment = "staging"
Name = "separate-private-route-tables"
}
tags = local.tags
}
......@@ -314,7 +314,7 @@ output "redshift_route_table_association_ids" {
}
output "redshift_public_route_table_association_ids" {
description = "List of IDs of the public redshidt route table association"
description = "List of IDs of the public redshift route table association"
value = module.vpc.redshift_public_route_table_association_ids
}
......
......@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.63"
version = ">= 3.73"
}
}
}
......@@ -21,6 +21,8 @@ resource "aws_vpc" "this" {
count = local.create_vpc ? 1 : 0
cidr_block = var.cidr
ipv4_ipam_pool_id = var.ipv4_ipam_pool_id
instance_tenancy = var.instance_tenancy
enable_dns_hostnames = var.enable_dns_hostnames
enable_dns_support = var.enable_dns_support
......
......@@ -314,7 +314,7 @@ output "redshift_route_table_association_ids" {
}
output "redshift_public_route_table_association_ids" {
description = "List of IDs of the public redshidt route table association"
description = "List of IDs of the public redshift route table association"
value = aws_route_table_association.redshift_public[*].id
}
......
......@@ -11,7 +11,7 @@ variable "name" {
}
variable "cidr" {
description = "The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden"
description = "(Optional) The IPv4 CIDR block for the VPC."
type = string
default = "0.0.0.0/0"
}
......@@ -1190,6 +1190,12 @@ variable "flow_log_per_hour_partition" {
default = false
}
variable "ipv4_ipam_pool_id" {
description = "(Optional) The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR."
type = string
default = null
}
variable "putin_khuylo" {
description = "Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!"
type = bool
......
......@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.63"
version = ">= 3.73"
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment