Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.99.0
rev: v1.99.5
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ No modules.
| <a name="input_redshift_subnet_suffix"></a> [redshift\_subnet\_suffix](#input\_redshift\_subnet\_suffix) | Suffix to append to redshift subnets name | `string` | `"redshift"` | no |
| <a name="input_redshift_subnet_tags"></a> [redshift\_subnet\_tags](#input\_redshift\_subnet\_tags) | Additional tags for the redshift subnets | `map(string)` | `{}` | no |
| <a name="input_redshift_subnets"></a> [redshift\_subnets](#input\_redshift\_subnets) | A list of redshift subnets inside the VPC | `list(string)` | `[]` | no |
| <a name="input_region"></a> [region](#input\_region) | Region where the resource(s) will be managed. Defaults to the region set in the provider configuration | `string` | `null` | no |
| <a name="input_reuse_nat_ips"></a> [reuse\_nat\_ips](#input\_reuse\_nat\_ips) | Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external\_nat\_ip\_ids' variable | `bool` | `false` | no |
| <a name="input_secondary_cidr_blocks"></a> [secondary\_cidr\_blocks](#input\_secondary\_cidr\_blocks) | List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool | `list(string)` | `[]` | no |
| <a name="input_single_nat_gateway"></a> [single\_nat\_gateway](#input\_single\_nat\_gateway) | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` | `false` | no |
Expand Down
156 changes: 156 additions & 0 deletions examples/simple-regions/README.md

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions examples/simple-regions/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
provider "aws" {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need an example for this


locals {
name = "ex-${basename(path.cwd)}"

regions = toset([
"us-east-1",
"eu-west-1",
"eu-central-1",
])

vpc_cidrs = {
"us-east-1" = "10.0.0.0/16"
"eu-west-1" = "10.1.0.0/16"
"eu-central-1" = "10.2.0.0/16"
}
azs = { for k, v in local.vpc_cidrs :
k => slice(data.aws_availability_zones.available[k].names, 0, 3)
}

tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
}

data "aws_availability_zones" "available" {
for_each = local.regions
region = each.value

state = "available"
}

################################################################################
# VPC Module
################################################################################

module "vpc" {
source = "../../"

for_each = local.regions
region = each.value

name = local.name
cidr = local.vpc_cidrs[each.value]

azs = local.azs[each.value]
private_subnets = [for k, v in local.azs[each.value] :
cidrsubnet(local.vpc_cidrs[each.value], 4, k)
]

tags = local.tags
}
Loading