-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide separate route tables for db/elasticache/redshift (#155)
* Provide separate route tables for db/elasticache/redshift * Added example for saperate routes * Updated PR with suggestions * Make redshift to use separate subnet route table also * More cleanup and updates * Fixed one more spelling mistake
- Loading branch information
1 parent
fb3b781
commit 78584e5
Showing
7 changed files
with
193 additions
and
4 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
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,33 @@ | ||
# VPC with separate private route tables | ||
|
||
Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup). | ||
|
||
There are public, private, database, ElastiCache, Redshift subnets, NAT Gateways created in each availability zone. **This example sets up separate private route for database, elasticache and redshift subnets.**. | ||
|
||
## 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 | | ||
|------|-------------| | ||
| database_subnets | List of IDs of database subnets | | ||
| elasticache_subnets | List of IDs of elasticache subnets | | ||
| nat_public_ips | NAT gateways | | ||
| private_subnets | Subnets | | ||
| public_subnets | List of IDs of public subnets | | ||
| redshift_subnets | List of IDs of elasticache subnets | | ||
| 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,31 @@ | ||
provider "aws" { | ||
region = "eu-west-1" | ||
} | ||
|
||
module "vpc" { | ||
source = "../../" | ||
|
||
name = "vpc-separate-private-route-tables" | ||
|
||
cidr = "10.10.0.0/16" | ||
|
||
azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"] | ||
private_subnets = ["10.10.1.0/24", "10.10.2.0/24", "10.10.3.0/24"] | ||
public_subnets = ["10.10.11.0/24", "10.10.12.0/24", "10.10.13.0/24"] | ||
database_subnets = ["10.10.21.0/24", "10.10.22.0/24", "10.10.23.0/24"] | ||
elasticache_subnets = ["10.10.31.0/24", "10.10.32.0/24", "10.10.33.0/24"] | ||
redshift_subnets = ["10.10.41.0/24", "10.10.42.0/24", "10.10.43.0/24"] | ||
|
||
create_database_subnet_route_table = true | ||
create_elasticache_subnet_route_table = true | ||
create_redshift_subnet_route_table = true | ||
|
||
single_nat_gateway = true | ||
enable_nat_gateway = true | ||
|
||
tags = { | ||
Owner = "user" | ||
Environment = "staging" | ||
Name = "separate-private-route-tables" | ||
} | ||
} |
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,37 @@ | ||
# VPC | ||
output "vpc_id" { | ||
description = "The ID of the VPC" | ||
value = "${module.vpc.vpc_id}" | ||
} | ||
|
||
# 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}"] | ||
} | ||
|
||
output "database_subnets" { | ||
description = "List of IDs of database subnets" | ||
value = ["${module.vpc.database_subnets}"] | ||
} | ||
|
||
output "elasticache_subnets" { | ||
description = "List of IDs of elasticache subnets" | ||
value = ["${module.vpc.elasticache_subnets}"] | ||
} | ||
|
||
output "redshift_subnets" { | ||
description = "List of IDs of elasticache subnets" | ||
value = ["${module.vpc.redshift_subnets}"] | ||
} | ||
|
||
# NAT gateways | ||
output "nat_public_ips" { | ||
description = "List of public Elastic IPs created for AWS NAT Gateway" | ||
value = ["${module.vpc.nat_public_ips}"] | ||
} |
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
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
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