Skip to content

Commit

Permalink
Update the docs (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
grem11n authored Jan 18, 2023
1 parent abb29df commit e2037fe
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 11 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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 = "../../"
Expand All @@ -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

Expand All @@ -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.
45 changes: 45 additions & 0 deletions examples/associated-cidrs/README.md
Original file line number Diff line number Diff line change
@@ -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"
}
}
```
2 changes: 1 addition & 1 deletion examples/module-depends-on/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "../../"
Expand Down
2 changes: 1 addition & 1 deletion examples/multi-account-multi-region/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ See [provider.tf](provider.tf) for more details.

## Sample Code

```
```hcl
module "multi_account_multi_region" {
source = "../../"
Expand Down
2 changes: 1 addition & 1 deletion examples/multi-account-single-region/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ See [provider.tf](provider.tf) for details.

## Sample Code

```
```hcl
module "multi_account_single_region" {
source = "../../"
Expand Down
2 changes: 1 addition & 1 deletion examples/single-account-multi-region/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/single-account-single-region/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down

0 comments on commit e2037fe

Please sign in to comment.