forked from terraform-aws-modules/terraform-aws-vpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the wonderful examples from matthiasr's PR located at terraform-a…
…ws-modules#162 all credit goes to them for this wonderful example
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Simple VPC with secondary CIDR blocks | ||
Configuration in this directory creates set of VPC resources across multiple CIDR blocks. | ||
There is a public and private subnet created per availability zone in addition to single NAT Gateway shared between all 3 availability zones. | ||
## Usage | ||
To run this example you need to execute: | ||
```bash | ||
$ terraform init | ||
$ terraform plan | ||
$ terraform apply | ||
``` | ||
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 --> | ||
## Outputs | ||
| Name | Description | | ||
|------|-------------| | ||
| nat_public_ips | NAT gateways | | ||
| private_subnets | Subnets | | ||
| public_subnets | List of IDs of public subnets | | ||
| vpc_cidr_block | CIDR blocks | | ||
| vpc_secondary_cidr_blocks | Secondary CIDR blocks | | ||
| vpc_id | VPC | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
provider "aws" { | ||
region = "eu-west-1" | ||
} | ||
module "vpc" { | ||
source = "../../" | ||
name = "secondary-cidr-blocks-example" | ||
cidr = "10.0.0.0/16" | ||
secondary_cidrs = ["10.1.0.0/16", "10.2.0.0/16"] | ||
azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"] | ||
private_subnets = ["10.0.1.0/24", "10.1.2.0/24", "10.2.3.0/24"] | ||
public_subnets = ["10.0.101.0/24", "10.1.102.0/24", "10.2.103.0/24"] | ||
assign_generated_ipv6_cidr_block = true | ||
enable_nat_gateway = true | ||
single_nat_gateway = true | ||
public_subnet_tags = { | ||
Name = "overridden-name-public" | ||
} | ||
tags = { | ||
Owner = "user" | ||
Environment = "dev" | ||
} | ||
vpc_tags = { | ||
Name = "vpc-name" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# VPC | ||
output "vpc_id" { | ||
description = "The ID of the VPC" | ||
value = "${module.vpc.vpc_id}" | ||
} | ||
# CIDR blocks | ||
output "vpc_cidr_block" { | ||
description = "The CIDR block of the VPC" | ||
value = ["${module.vpc.vpc_cidr_block}"] | ||
} | ||
output "vpc_secondary_cidr_blocks" { | ||
description = "Secondary CIDR blocks of the VPC" | ||
value = ["${module.vpc.vpc_secondary_cidr_blocks}"] | ||
} | ||
|
||
# Subnets | ||
output "private_subnets" { | ||
description = "List of IDs of private subnets" | ||
value = ["${module.vpc.private_subnets}"] | ||
} | ||
output "public_subnets" { | ||
description = "List of IDs of public subnets" | ||
value = ["${module.vpc.public_subnets}"] | ||
} | ||
# NAT gateways | ||
output "nat_public_ips" { | ||
description = "List of public Elastic IPs created for AWS NAT Gateway" | ||
value = ["${module.vpc.nat_public_ips}"] | ||
} |