From dfa42e2748415bd98c25d07817d3256fb00b98b8 Mon Sep 17 00:00:00 2001 From: Vadim Hleif Date: Thu, 19 Jul 2018 12:24:23 +0300 Subject: [PATCH] Migrate readme yaml (#5) --- .gitignore | 3 + Makefile | 6 +- README.md | 209 +++++++++++++++++++++++++++++++++------------- README.yaml | 194 ++++++++++++++++++++++++++++++++++++++++++ docs/targets.md | 9 ++ docs/terraform.md | 36 ++++++++ outputs.tf | 9 +- 7 files changed, 402 insertions(+), 64 deletions(-) create mode 100644 README.yaml create mode 100644 docs/targets.md create mode 100644 docs/terraform.md diff --git a/.gitignore b/.gitignore index a0dd221..2d530ee 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ .terraform .idea *.iml + +.build-harness +build-harness \ No newline at end of file diff --git a/Makefile b/Makefile index d002c7d..655f630 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ SHELL := /bin/bash +# List of targets the `readme` target should call before generating the readme +export README_DEPS ?= docs/targets.md docs/terraform.md + -include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness) +## Lint terraform code lint: - $(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate + $(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate \ No newline at end of file diff --git a/README.md b/README.md index ca83b5f..3a45ac2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -# terraform-aws-multi-az-subnets [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-multi-az-subnets.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-multi-az-subnets) + + +[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com) + +# terraform-aws-multi-az-subnets [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-multi-az-subnets.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-multi-az-subnets) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-multi-az-subnets.svg)](https://github.com/cloudposse/terraform-aws-multi-az-subnets/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com) + Terraform module for multi-AZ [`subnets`](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html) provisioning. @@ -11,6 +16,28 @@ The public subnets are routed to the Internet Gateway specified by `var.igw_id`. The private subnets are routed to the NAT Gateways provided in the `var.az_ngw_ids` map. +--- + +This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps. + + +It's 100% Open Source and licensed under the [APACHE2](LICENSE). + + + + + + + + +## Screenshots + + +![terraform-aws-multi-az-subnets](images/terraform-aws-multi-az-subnets.png) +*Example of `terraform apply` outputs* + + + ## Usage ```hcl @@ -62,42 +89,9 @@ module "private_subnets" { ``` -# Inputs - -| Name | Default | Description | Required | -|:------------------------------|:---------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:| -| `namespace` | `` | Namespace (_e.g._ `cp` or `cloudposse`) | Yes | -| `stage` | `` | Stage (_e.g._ `prod`, `dev`, `staging`) | Yes | -| `name` | `` | Application or solution name (_e.g._ `myapp`) | Yes | -| `delimiter` | `-` | Delimiter to use between `name`, `namespace`, `stage`, `attributes` | No | -| `attributes` | `[]` | Additional attributes (_e.g._ `policy` or `role`) | No | -| `tags` | `{}` | Additional tags (_e.g._ `map("BusinessUnit","XYZ")` | No | -| `max_subnets` | `16` | Maximum number of subnets that can be created. This variable is used for CIDR blocks calculation. MUST be greater than the length of `availability_zones` list | Yes | -| `availability_zones` | [] | List of Availability Zones (e.g. `["us-east-1a", "us-east-1b", "us-east-1c"]`) | Yes | -| `type` | `private` | Type of subnets to create (`private` or `public`) | Yes | -| `vpc_id` | `` | VPC ID where subnets are created (_e.g._ `vpc-aceb2723`) | Yes | -| `cidr_block` | `` | Base CIDR block which is divided into subnet CIDR blocks (_e.g._ `10.0.0.0/24`) | No | -| `igw_id` | `` | Only for public subnets. Internet Gateway ID which is used as a default route when creating public subnets (_e.g._ `igw-9c26a123`) | Yes | -| `public_network_acl_id` | `` | ID of Network ACL which is added to the public subnets. If empty, a new ACL will be created | No | -| `private_network_acl_id` | `` | ID of Network ACL which is added to the private subnets. If empty, a new ACL will be created | No | -| `public_network_acl_egress` | see [variables.tf](https://github.com/cloudposse/terraform-aws-multi-az-subnets/blob/master/variables.tf) | Egress rules which are added to the new Public Network ACL | No | -| `public_network_acl_ingress` | see [variables.tf](https://github.com/cloudposse/terraform-aws-multi-az-subnets/blob/master/variables.tf) | Ingress rules which are added to the new Public Network ACL | No | -| `private_network_acl_egress` | see [variables.tf](https://github.com/cloudposse/terraform-aws-multi-az-subnets/blob/master/variables.tf) | Egress rules which are added to the new Private Network ACL | No | -| `private_network_acl_ingress` | see [variables.tf](https://github.com/cloudposse/terraform-aws-multi-az-subnets/blob/master/variables.tf) | Ingress rules which are added to the new Private Network ACL | No | -| `enabled` | `true` | Set to `false` to prevent the module from creating any resources | No | -| `nat_gateway_enabled` | `true` | Flag to enable/disable NAT Gateways creation in public subnets | No | -| `az_ngw_ids` | {} | Map of AZ names to NAT Gateway IDs which are used as default routes when creating private subnets. Only for private subnets | No | -| `az_ngw_count` | 0 | Count of items in the `az_ngw_ids` map. Needs to be explicitly provided since Terraform currently can't use dynamic count on computed resources from different modules. https://github.com/hashicorp/terraform/issues/10857 | No | - -## Outputs - -| Name | Description | -|:--------------------------|:---------------------------------------------------------------| -| az_subnet_ids | Map of AZ names to subnet IDs | -| az_route_table_ids | Map of AZ names to Route Table IDs | -| az_ngw_ids | Map of AZ names to NAT Gateway IDs (only for public subnets) | +## Examples Given the following configuration @@ -172,21 +166,95 @@ for example: `public_az_subnet_ids["us-east-1a"]` `lookup(private_az_subnet_ids, "us-east-1b")` -
-## Example of `terraform apply` outputs -![terraform-aws-multi-az-subnets](images/terraform-aws-multi-az-subnets.png) -
+## Makefile Targets +``` +Available targets: + + help This help screen + help/all Display help for all targets + lint Lint terraform code + +``` + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| attributes | Additional attributes (e.g. `policy` or `role`) | list | `` | no | +| availability_zones | List of Availability Zones (e.g. `['us-east-1a', 'us-east-1b', 'us-east-1c']`) | list | `` | no | +| az_ngw_count | Count of items in the `az_ngw_ids` map. Needs to be explicitly provided since Terraform currently can't use dynamic count on computed resources from different modules. https://github.com/hashicorp/terraform/issues/10857 | string | `0` | no | +| az_ngw_ids | Only for private subnets. Map of AZ names to NAT Gateway IDs that are used as default routes when creating private subnets | map | `` | no | +| cidr_block | Base CIDR block which is divided into subnet CIDR blocks (e.g. `10.0.0.0/16`) | string | - | yes | +| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | string | `-` | no | +| enabled | Set to false to prevent the module from creating any resources | string | `true` | no | +| igw_id | Internet Gateway ID that is used as a default route when creating public subnets (e.g. `igw-9c26a123`) | string | `` | no | +| max_subnets | Maximum number of subnets that can be created. The variable is used for CIDR blocks calculation | string | `6` | no | +| name | Application or solution name | string | - | yes | +| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes | +| nat_gateway_enabled | Flag to enable/disable NAT Gateways creation in public subnets | string | `true` | no | +| private_network_acl_egress | Egress network ACL rules | list | `` | no | +| private_network_acl_id | Network ACL ID that is added to the private subnets. If empty, a new ACL will be created | string | `` | no | +| private_network_acl_ingress | Egress network ACL rules | list | `` | no | +| public_network_acl_egress | Egress network ACL rules | list | `` | no | +| public_network_acl_id | Network ACL ID that is added to the public subnets. If empty, a new ACL will be created | string | `` | no | +| public_network_acl_ingress | Egress network ACL rules | list | `` | no | +| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes | +| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`) | map | `` | no | +| type | Type of subnets to create (`private` or `public`) | string | `private` | no | +| vpc_id | VPC ID | string | - | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| az_ngw_ids | Map of AZ names to NAT Gateway IDs (only for public subnets) | +| az_route_table_ids | Map of AZ names to Route Table IDs | +| az_subnet_ids | Map of AZ names to subnet IDs | + + + + +## Related Projects + +Check out these related projects. + +- [terraform-aws-named-subnets](https://github.com/cloudposse/terraform-aws-named-subnets) - Terraform module for named subnets provisioning. +- [terraform-aws-dynamic-subnets](https://github.com/cloudposse/terraform-aws-dynamic-subnets) - Terraform module for public and private subnets provisioning in existing VPC +- [terraform-aws-vpc](https://github.com/cloudposse/terraform-aws-vpc) - Terraform Module that defines a VPC with public/private subnets across multiple AZs with Internet Gateways +- [terraform-aws-cloudwatch-flow-logs](https://github.com/cloudposse/terraform-aws-cloudwatch-flow-logs) - Terraform module for enabling flow logs for vpc and subnets. + + ## Help **Got a question?** -File a GitHub [issue](https://github.com/cloudposse/terraform-aws-multi-az-subnets/issues), send us an [email](mailto:hello@cloudposse.com) or reach out to us on [Gitter](https://gitter.im/cloudposse/). +File a GitHub [issue](https://github.com/cloudposse/terraform-aws-multi-az-subnets/issues), send us an [email][email] or join our [Slack Community][slack]. + +## Commerical Support + +Work directly with our team of DevOps experts via email, slack, and video conferencing. + +We provide *commercial support* for all of our [Open Source][github] projects. As a *Dedicated Support* customer, you have access to our team of subject matter experts at a fraction of the cost of a fulltime engineer. + +[![E-Mail](https://img.shields.io/badge/email-hello@cloudposse.com-blue.svg)](mailto:hello@cloudposse.com) + +- **Questions.** We'll use a Shared Slack channel between your team and ours. +- **Troubleshooting.** We'll help you triage why things aren't working. +- **Code Reviews.** We'll review your Pull Requests and provide constructive feedback. +- **Bug Fixes.** We'll rapidly work to fix any bugs in our projects. +- **Build New Terraform Modules.** We'll develop original modules to provision infrastructure. +- **Cloud Architecture.** We'll assist with your cloud strategy and design. +- **Implementation.** We'll provide hands on support to implement our reference architectures. + + +## Community Forum +Get access to our [Open Source Community Forum][slack] on Slack. It's **FREE** to join for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build *sweet* infrastructure. ## Contributing @@ -196,7 +264,7 @@ Please use the [issue tracker](https://github.com/cloudposse/terraform-aws-multi ### Developing -If you are interested in being a contributor and want to get involved in developing `terraform-aws-multi-az-subnets`, we would love to hear from you! Shoot us an [email](mailto:hello@cloudposse.com). +If you are interested in being a contributor and want to get involved in developing this project or [help out](https://github.com/orgs/cloudposse/projects/3) with our other projects, we would love to hear from you! Shoot us an [email](mailto:hello@cloudposse.com). In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. @@ -204,14 +272,20 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. 2. **Clone** the project to your own machine 3. **Commit** changes to your own branch 4. **Push** your work back up to your fork - 5. Submit a **Pull request** so that we can review your changes + 5. Submit a **Pull Request** so that we can review your changes -**NOTE:** Be sure to merge the latest from "upstream" before making a pull request! +**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request! -## License +## Copyright -[APACHE 2.0](LICENSE) © 2017-2018 [Cloud Posse, LLC](https://cloudposse.com) +Copyright © 2017-2018 [Cloud Posse, LLC](https://cloudposse.com) + + + +## License + +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) See [LICENSE](LICENSE) for full details. @@ -223,7 +297,7 @@ See [LICENSE](LICENSE) for full details. "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an @@ -233,31 +307,46 @@ See [LICENSE](LICENSE) for full details. under the License. -## About -`terraform-aws-multi-az-subnets` is maintained and funded by [Cloud Posse, LLC][website]. -![Cloud Posse](https://cloudposse.com/logo-300x69.png) -Like it? Please let us know at -We love [Open Source Software](https://github.com/cloudposse/)! -See [our other projects][community] -or [hire us][hire] to help build your next cloud platform. +## Trademarks + +All other trademarks referenced herein are the property of their respective owners. + +## About + +This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know at + +[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com) + +We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We love [Open Source Software](https://github.com/cloudposse/)! + +We offer paid support on all of our projects. + +Check out [our other projects][github], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation. + + [docs]: https://docs.cloudposse.com/ [website]: https://cloudposse.com/ - [community]: https://github.com/cloudposse/ + [github]: https://github.com/cloudposse/ + [jobs]: https://cloudposse.com/jobs/ [hire]: https://cloudposse.com/contact/ + [slack]: https://slack.cloudposse.com/ + [linkedin]: https://www.linkedin.com/company/cloudposse + [twitter]: https://twitter.com/cloudposse/ + [email]: mailto:hello@cloudposse.com ### Contributors -| [![Erik Osterman][erik_img]][erik_web]
[Erik Osterman][erik_web] | [![Andriy Knysh][andriy_img]][andriy_web]
[Andriy Knysh][andriy_web] | -|-------------------------------------------------------|------------------------------------------------------------------| +| [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]
[Andriy Knysh][aknysh_homepage] | +|---| + + [aknysh_homepage]: https://github.com/aknysh + [aknysh_avatar]: https://github.com/aknysh.png?size=150 + - [erik_img]: http://s.gravatar.com/avatar/88c480d4f73b813904e00a5695a454cb?s=144 - [erik_web]: https://github.com/osterman/ - [andriy_img]: https://avatars0.githubusercontent.com/u/7356997?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144 - [andriy_web]: https://github.com/aknysh/ diff --git a/README.yaml b/README.yaml new file mode 100644 index 0000000..251abd4 --- /dev/null +++ b/README.yaml @@ -0,0 +1,194 @@ +--- +# +# This is the canonical configuration for the `README.md` +# Run `make readme` to rebuild the `README.md` +# + +# Name of this project +name: terraform-aws-multi-az-subnets + +# Logo for this project +#logo: docs/logo.png + +# License of this project +license: "APACHE2" + +# Canonical GitHub repo +github_repo: cloudposse/terraform-aws-multi-az-subnets + +# Badges to display +badges: + - name: "Build Status" + image: "https://travis-ci.org/cloudposse/terraform-aws-multi-az-subnets.svg?branch=master" + url: "https://travis-ci.org/cloudposse/terraform-aws-multi-az-subnets" + - name: "Latest Release" + image: "https://img.shields.io/github/release/cloudposse/terraform-aws-multi-az-subnets.svg" + url: "https://github.com/cloudposse/terraform-aws-multi-az-subnets/releases/latest" + - name: "Slack Community" + image: "https://slack.cloudposse.com/badge.svg" + url: "https://slack.cloudposse.com" + +related: + - name: "terraform-aws-named-subnets" + description: "Terraform module for named subnets provisioning." + url: "https://github.com/cloudposse/terraform-aws-named-subnets" + - name: "terraform-aws-dynamic-subnets" + description: "Terraform module for public and private subnets provisioning in existing VPC" + url: "https://github.com/cloudposse/terraform-aws-dynamic-subnets" + - name: "terraform-aws-vpc" + description: "Terraform Module that defines a VPC with public/private subnets across multiple AZs with Internet Gateways" + url: "https://github.com/cloudposse/terraform-aws-vpc" + - name: "terraform-aws-cloudwatch-flow-logs" + description: "Terraform module for enabling flow logs for vpc and subnets." + url: "https://github.com/cloudposse/terraform-aws-cloudwatch-flow-logs" + +# Short description of this project +description: |- + Terraform module for multi-AZ [`subnets`](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html) provisioning. + + The module creates private and public subnets in the provided Availability Zones. + + The public subnets are routed to the Internet Gateway specified by `var.igw_id`. + + `nat_gateway_enabled` flag controls the creation of NAT Gateways in the public subnets. + + The private subnets are routed to the NAT Gateways provided in the `var.az_ngw_ids` map. + +# How to use this project +usage: |- + ```hcl + module "vpc" { + source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=master" + namespace = "${var.namespace}" + name = "vpc" + stage = "${var.stage}" + cidr_block = "${var.cidr_block}" + } + + locals { + public_cidr_block = "${cidrsubnet(module.vpc.vpc_cidr_block, 1, 0)}" + private_cidr_block = "${cidrsubnet(module.vpc.vpc_cidr_block, 1, 1)}" + } + + module "public_subnets" { + source = "git::https://github.com/cloudposse/terraform-aws-multi-az-subnets.git?ref=master" + namespace = "${var.namespace}" + stage = "${var.stage}" + name = "${var.name}" + availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c"] + vpc_id = "${module.vpc.vpc_id}" + cidr_block = "${local.public_cidr_block}" + type = "public" + igw_id = "${module.vpc.igw_id}" + nat_gateway_enabled = "true" + } + + module "private_subnets" { + source = "git::https://github.com/cloudposse/terraform-aws-multi-az-subnets.git?ref=master" + namespace = "${var.namespace}" + stage = "${var.stage}" + name = "${var.name}" + availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c"] + vpc_id = "${module.vpc.vpc_id}" + cidr_block = "${local.private_cidr_block}" + type = "private" + + # Map of AZ names to NAT Gateway IDs that was created in "public_subnets" module + az_ngw_ids = "${module.public_subnets.az_ngw_ids}" + + # Need to explicitly provide the count since Terraform currently can't use dynamic count on computed resources from different modules + # https://github.com/hashicorp/terraform/issues/10857 + # https://github.com/hashicorp/terraform/issues/12125 + # https://github.com/hashicorp/terraform/issues/4149 + az_ngw_count = 3 + } + ``` +examples: |- + Given the following configuration + + ```hcl + module "vpc" { + source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=master" + namespace = "${var.namespace}" + name = "vpc" + stage = "${var.stage}" + cidr_block = "${var.cidr_block}" + } + + locals { + public_cidr_block = "${cidrsubnet(module.vpc.vpc_cidr_block, 1, 0)}" + private_cidr_block = "${cidrsubnet(module.vpc.vpc_cidr_block, 1, 1)}" + } + + module "public_subnets" { + source = "git::https://github.com/cloudposse/terraform-aws-multi-az-subnets.git?ref=master" + namespace = "${var.namespace}" + stage = "${var.stage}" + name = "${var.name}" + availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c"] + vpc_id = "${module.vpc.vpc_id}" + cidr_block = "${local.public_cidr_block}" + type = "public" + igw_id = "${module.vpc.igw_id}" + nat_gateway_enabled = "true" + } + + module "private_subnets" { + source = "git::https://github.com/cloudposse/terraform-aws-multi-az-subnets.git?ref=master" + namespace = "${var.namespace}" + stage = "${var.stage}" + name = "${var.name}" + availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c"] + vpc_id = "${module.vpc.vpc_id}" + cidr_block = "${local.private_cidr_block}" + type = "private" + az_ngw_ids = "${module.public_subnets.az_ngw_ids}" + az_ngw_count = 3 + } + + output "private_az_subnet_ids" { + value = "${module.private_subnets.az_subnet_ids}" + } + + output "public_az_subnet_ids" { + value = "${module.public_subnets.az_subnet_ids}" + } + ``` + + the output Maps of AZ names to subnet IDs look like these + + ```hcl + public_az_subnet_ids = { + us-east-1a = subnet-ea58d78e + us-east-1b = subnet-556ee131 + us-east-1c = subnet-6f54db0b + } + private_az_subnet_ids = { + us-east-1a = subnet-376de253 + us-east-1b = subnet-9e53dcfa + us-east-1c = subnet-a86fe0cc + } + ``` + + and the created subnet IDs could be found by the AZ names using `map["key"]` or [`lookup(map, key, [default])`](https://www.terraform.io/docs/configuration/interpolation.html#lookup-map-key-default-), + + for example: + + `public_az_subnet_ids["us-east-1a"]` + + `lookup(private_az_subnet_ids, "us-east-1b")` +
+ +screenshots: + - name: "terraform-aws-multi-az-subnets" + description: "Example of `terraform apply` outputs" + url: "images/terraform-aws-multi-az-subnets.png" + +include: + - "docs/targets.md" + - "docs/terraform.md" + +# Contributors to this project +contributors: + - name: "Andriy Knysh" + github: "aknysh" \ No newline at end of file diff --git a/docs/targets.md b/docs/targets.md new file mode 100644 index 0000000..09c39cd --- /dev/null +++ b/docs/targets.md @@ -0,0 +1,9 @@ +## Makefile Targets +``` +Available targets: + + help This help screen + help/all Display help for all targets + lint Lint terraform code + +``` diff --git a/docs/terraform.md b/docs/terraform.md new file mode 100644 index 0000000..ae0d0f1 --- /dev/null +++ b/docs/terraform.md @@ -0,0 +1,36 @@ + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| attributes | Additional attributes (e.g. `policy` or `role`) | list | `` | no | +| availability_zones | List of Availability Zones (e.g. `['us-east-1a', 'us-east-1b', 'us-east-1c']`) | list | `` | no | +| az_ngw_count | Count of items in the `az_ngw_ids` map. Needs to be explicitly provided since Terraform currently can't use dynamic count on computed resources from different modules. https://github.com/hashicorp/terraform/issues/10857 | string | `0` | no | +| az_ngw_ids | Only for private subnets. Map of AZ names to NAT Gateway IDs that are used as default routes when creating private subnets | map | `` | no | +| cidr_block | Base CIDR block which is divided into subnet CIDR blocks (e.g. `10.0.0.0/16`) | string | - | yes | +| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | string | `-` | no | +| enabled | Set to false to prevent the module from creating any resources | string | `true` | no | +| igw_id | Internet Gateway ID that is used as a default route when creating public subnets (e.g. `igw-9c26a123`) | string | `` | no | +| max_subnets | Maximum number of subnets that can be created. The variable is used for CIDR blocks calculation | string | `6` | no | +| name | Application or solution name | string | - | yes | +| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes | +| nat_gateway_enabled | Flag to enable/disable NAT Gateways creation in public subnets | string | `true` | no | +| private_network_acl_egress | Egress network ACL rules | list | `` | no | +| private_network_acl_id | Network ACL ID that is added to the private subnets. If empty, a new ACL will be created | string | `` | no | +| private_network_acl_ingress | Egress network ACL rules | list | `` | no | +| public_network_acl_egress | Egress network ACL rules | list | `` | no | +| public_network_acl_id | Network ACL ID that is added to the public subnets. If empty, a new ACL will be created | string | `` | no | +| public_network_acl_ingress | Egress network ACL rules | list | `` | no | +| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes | +| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`) | map | `` | no | +| type | Type of subnets to create (`private` or `public`) | string | `private` | no | +| vpc_id | VPC ID | string | - | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| az_ngw_ids | Map of AZ names to NAT Gateway IDs (only for public subnets) | +| az_route_table_ids | Map of AZ names to Route Table IDs | +| az_subnet_ids | Map of AZ names to subnet IDs | + diff --git a/outputs.tf b/outputs.tf index a71808e..c05f280 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,11 +1,14 @@ output "az_subnet_ids" { - value = "${zipmap(var.availability_zones, matchkeys(coalescelist(aws_subnet.private.*.id, aws_subnet.public.*.id), coalescelist(aws_subnet.private.*.tags.AZ, aws_subnet.public.*.tags.AZ), var.availability_zones))}" + value = "${zipmap(var.availability_zones, matchkeys(coalescelist(aws_subnet.private.*.id, aws_subnet.public.*.id), coalescelist(aws_subnet.private.*.tags.AZ, aws_subnet.public.*.tags.AZ), var.availability_zones))}" + description = "Map of AZ names to subnet IDs" } output "az_route_table_ids" { - value = "${zipmap(var.availability_zones, matchkeys(coalescelist(aws_route_table.private.*.id, aws_route_table.public.*.id), coalescelist(aws_route_table.private.*.tags.AZ, aws_route_table.public.*.tags.AZ), var.availability_zones))}" + value = "${zipmap(var.availability_zones, matchkeys(coalescelist(aws_route_table.private.*.id, aws_route_table.public.*.id), coalescelist(aws_route_table.private.*.tags.AZ, aws_route_table.public.*.tags.AZ), var.availability_zones))}" + description = " Map of AZ names to Route Table IDs" } output "az_ngw_ids" { - value = "${zipmap(var.availability_zones, coalescelist(matchkeys(aws_nat_gateway.public.*.id, aws_nat_gateway.public.*.tags.AZ, var.availability_zones), local.dummy_az_ngw_ids))}" + value = "${zipmap(var.availability_zones, coalescelist(matchkeys(aws_nat_gateway.public.*.id, aws_nat_gateway.public.*.tags.AZ, var.availability_zones), local.dummy_az_ngw_ids))}" + description = "Map of AZ names to NAT Gateway IDs (only for public subnets)" }