From e2037feae3e0f9e3ea5d9425203d6ddbd1dfc756 Mon Sep 17 00:00:00 2001 From: Yurii Rochniak Date: Wed, 18 Jan 2023 14:39:20 +0100 Subject: [PATCH] Update the docs (#100) --- README.md | 14 +++--- examples/associated-cidrs/README.md | 45 +++++++++++++++++++ examples/module-depends-on/README.md | 2 +- examples/multi-account-multi-region/README.md | 2 +- .../multi-account-single-region/README.md | 2 +- .../single-account-multi-region/README.md | 2 +- .../README.md | 2 +- .../single-account-single-region/README.md | 2 +- 8 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 examples/associated-cidrs/README.md diff --git a/README.md b/README.md index d327f34..fe40236 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,14 @@ Glory to Ukraine! 🇺 --- ![terraform-aws-vpc-peering](https://github.com/grem11n/terraform-aws-vpc-peering/workflows/terraform-aws-vpc-peering/badge.svg) + --- This module configures VPC peering in different configurations. These types of resources are supported: -* [AWS VPC Peering Connection](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_peering_connection) + +* [AWS VPC Peering Connection](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_peering_connection) * [AWS VPC Peering Connection Accepter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_peering_connection_accepter) * [AWS VPC Peering Connection Options](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_peering_connection_options) \* * [AWS Route](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) @@ -29,7 +31,7 @@ These types of resources are supported: ## Important Notice * \* - There is a bug with applying VPC peering options currently. You can still specify and manage them with this module, but you will need to run `apply` twice. -* Version `v3.1.*` supports both Terraform `0.14` and `0.15.0`. However, it throws warnings regarding empty providers deprecation. Provider configuration was changed in Terraform `0.15.0`. Therefore, newer versions would likely be incompatible with Terraform `<=0.15`. So, if you need to use both Terraofmr `0.14` and `0.15` at the same time or you're in the process of migration, please, use `v3.1.*` of this module. +* Version `v3.1.*` supports both Terraform `0.14` and `0.15.0`. However, it throws warnings regarding empty providers deprecation. Provider configuration was changed in Terraform `0.15.0`. Therefore, newer versions would likely be incompatible with Terraform `<=0.15`. So, if you need to use both Terraform `0.14` and `0.15` at the same time or you're in the process of migration, please, use `v3.1.*` of this module. ## Features @@ -60,9 +62,10 @@ Sample configuration is located in [examples](https://github.com/grem11n/terrafo ### Simple Peering (single AWS account, same region) + **Notice**: You need to declare both providers even with single region peering. -``` +```hcl module "single_account_single_region" { source = "../../" @@ -85,7 +88,7 @@ module "single_account_single_region" { ## Changelog -Changelog is in the [CHANGELOG.md](CHANGELOG.md) +See the changelog on [the GitHub Releases page](https://github.com/grem11n/terraform-aws-vpc-peering/releases). ## Contribution @@ -109,4 +112,5 @@ Module managed by [Yurii Rochniak](https://github.com/grem11n) [About me](https://grem1.in) ## License -Apache 2 Licensed. See [LICENSE](https://github.com/grem11n/terraform-aws-vpc-peering/blob/master/LICENSE.md) for full details. + +Apache 2 License is applied. See [LICENSE](https://github.com/grem11n/terraform-aws-vpc-peering/blob/master/LICENSE) for full details. diff --git a/examples/associated-cidrs/README.md b/examples/associated-cidrs/README.md new file mode 100644 index 0000000..63fbbe5 --- /dev/null +++ b/examples/associated-cidrs/README.md @@ -0,0 +1,45 @@ +# Creating Routes for Additional CIDR Blocks + +This is an example of how to create routes for the [additional CIDR blocks of a VPC](https://docs.aws.amazon.com/vpc/latest/userguide/configure-your-vpc.html#vpc-cidr-blocks). + +There are specific additional variables that a user has to turn on in order to enable these routes: + +- `from_this_associated` +- `from_peer_associated` + +The reason is that if creating both VPCs and peerings in a single go, Terraform won't be able to calculate associated CIDR blocks. +See [this discussion comment](https://github.com/hashicorp/terraform/issues/28962#issuecomment-861596870). +Therefore, it may be impossible to create routes for additional CIDR blocks in one Terraform go in the combination with `depends_on` directive. +If this is your case, several Terraform runs may be required. + +## Sample Code + +```hcl +provider "aws" { + region = "eu-west-1" + access_key = var.aws_this_access_key + secret_key = var.aws_this_secret_key +} + +module "associated_cidrs" { + source = "../../" + + providers = { + aws.this = aws + aws.peer = aws + } + + this_vpc_id = var.this_vpc_id + peer_vpc_id = var.peer_vpc_id + + from_this_associated = true + from_peer_associated = true + + auto_accept_peering = true + + tags = { + Name = "tf-associated-cirds" + Environment = "Test" + } +} +``` diff --git a/examples/module-depends-on/README.md b/examples/module-depends-on/README.md index f29aa22..491117f 100644 --- a/examples/module-depends-on/README.md +++ b/examples/module-depends-on/README.md @@ -10,7 +10,7 @@ Configuration for VPC (subnets, route tables, etc.) is omitted. Notice, that you have to explicitly provide Route Tables IDs as variables to this module in order to make it work. -``` +```hcl module "module_depends_on" { source = "../../" diff --git a/examples/multi-account-multi-region/README.md b/examples/multi-account-multi-region/README.md index 3725988..bd52177 100644 --- a/examples/multi-account-multi-region/README.md +++ b/examples/multi-account-multi-region/README.md @@ -5,7 +5,7 @@ See [provider.tf](provider.tf) for more details. ## Sample Code -``` +```hcl module "multi_account_multi_region" { source = "../../" diff --git a/examples/multi-account-single-region/README.md b/examples/multi-account-single-region/README.md index 7d0a722..7f848d9 100644 --- a/examples/multi-account-single-region/README.md +++ b/examples/multi-account-single-region/README.md @@ -5,7 +5,7 @@ See [provider.tf](provider.tf) for details. ## Sample Code -``` +```hcl module "multi_account_single_region" { source = "../../" diff --git a/examples/single-account-multi-region/README.md b/examples/single-account-multi-region/README.md index bea5c76..8dcba98 100644 --- a/examples/single-account-multi-region/README.md +++ b/examples/single-account-multi-region/README.md @@ -4,7 +4,7 @@ This example creates a peering connection between VPCs in different regions, whi ## Sample Code -``` +```hcl provider "aws" { alias = "this" region = "eu-west-1" diff --git a/examples/single-account-single-region-with-options/README.md b/examples/single-account-single-region-with-options/README.md index a5e591b..29f8134 100644 --- a/examples/single-account-single-region-with-options/README.md +++ b/examples/single-account-single-region-with-options/README.md @@ -9,7 +9,7 @@ Configuration in this directory creates a peering connection between VPCs in a s ## Code Sample -``` +```hcl provider "aws" { region = "eu-west-1" } diff --git a/examples/single-account-single-region/README.md b/examples/single-account-single-region/README.md index 6942573..38cb496 100644 --- a/examples/single-account-single-region/README.md +++ b/examples/single-account-single-region/README.md @@ -6,7 +6,7 @@ This is a basic configuration example, which creates a peering connection betwee ## Code Sample -``` +```hcl provider "aws" { region = "eu-west-1" }