Skip to content

Commit

Permalink
Docs for v3.0.0 release (#65)
Browse files Browse the repository at this point in the history
* Docs for v3.0.0 release

* Run Terratest against the latest Terraform version only
  • Loading branch information
grem11n committed Feb 15, 2021
1 parent 8f44f51 commit c9d3bfe
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 142 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/terratest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
strategy:
max-parallel: 1
matrix:
terraform: ['0.13.6', '0.14.6']
terraform: ['0.14.6']
steps:
- name: Set up Go
uses: actions/setup-go@v2
Expand Down
47 changes: 40 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,54 @@
Unreleased
v3.0.0
----
* Fixes `depends_on` issue ([#57](https://github.com/grem11n/terraform-aws-vpc-peering/issues/57))
* Added documentation regarding `depends_on` usage
* Run tests against Terraform 0.13 and 0.14
* Refactoring

* Tests for cross-account / cross-region peering configuration
* Mark variable `peer_account_id` for deprecation
v2.2.3
----
* Updated Terraform version and Go version for the tests
* Fixed [#48](https://github.com/grem11n/terraform-aws-vpc-peering/issues/48)
* Fixed [#52](https://github.com/grem11n/terraform-aws-vpc-peering/issues/52)

v2.1.0
v2.2.2
----
* Fix quoted lines, which were triggering Terraform deprecation notices [#47](https://github.com/grem11n/terraform-aws-vpc-peering/pull/47)

v2.2.1
----
* Updated tests

v1.3.1
----
* Added deprecation notice for Terraform 0.11
* Updated the tests

v2.2.0
----
**Requires AWS provider version >=2.31.0!**

* Deprecates DNS options workaround since [hashicorp/terraform-provider-aws#6730](https://github.com/hashicorp/terraform-provider-aws/issues/6730) is fixed

v1.3.0
----
**Requires AWS provider version >=2.31.0!**

* Deprecates DNS options workaround since [hashicorp/terraform-provider-aws#6730](https://github.com/hashicorp/terraform-provider-aws/issues/6730) is fixed

v2.1.1
----
* Implements change ([#35](https://github.com/grem11n/terraform-aws-vpc-peering/pull/35)), which fixes ([#32](https://github.com/grem11n/terraform-aws-vpc-peering/issues/32)) for Terraform version `>= 0.12`
* Migrate CI to GitHub Actions and tests refactoring

v2.1.0
----
* Fix workaround for inter-region peering. See: [this issue](https://github.com/terraform-providers/terraform-provider-aws/issues/6730)
* Tests for different peering scenarios
* Docs and examples updates

v1.2.0
----

* Create a test case for a single account, single region peering
* Add example configuration for a single account, single region peering, which is tested
* Updated README
Expand All @@ -23,7 +58,6 @@ v1.2.0

v1.1.0
----

* **Breaking change**: variable `owner_account_id` changed to `peer_account_id` for clarity. Please, update your configuration ([#13](https://github.com/grem11n/terraform-aws-vpc-peering/pull/13))
* **Breaking change**: variable `cross_region_peering` is deprecated due to refactoring.
* Updated README
Expand All @@ -33,5 +67,4 @@ v1.1.0

v1.0.0
----

* Added cross-region perring ([#11](https://github.com/grem11n/terraform-aws-vpc-peering/pull/11))
125 changes: 43 additions & 82 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,49 @@
AWS VPC Peering Connection Module
=================================
# AWS VPC Peering Connection Module

Terraform module, which creates a peering connection between two VPCs and adds routes to the local VPC.
Routes on the Peer VPC side should be configured separately.
![terraform-aws-vpc-peering](https://github.com/grem11n/terraform-aws-vpc-peering/workflows/terraform-aws-vpc-peering/badge.svg)
---

This module is designed to work with [VPC](https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/) module from the Terraform Registry
This module configures VPC peering in different configurations.

Important Notice
----
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 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)

HashiCorp has [anounced the deprecation of Terraform 0.11 support in Terraform providers](https://www.hashicorp.com/blog/deprecating-terraform-0-11-support-in-terraform-providers/).

What does it mean for this module? I won't do any active development for the `terraform011` branch. However, PRs are still welcome.
## Important Notice

In any case, this module is pretty much mature and covers all the functionality related to the VPC peering. Hence, it's Ok to use versions for Terraform 0.11, but I strongly suggest you to upgrade.
\* - 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.

Preamble
----
**Always make sure you pinned the module version!**
Please, be aware that any new code in `master` may intorduce some regressions. Moreover, sometimes I can easily miss some of them because I personally doen't use all the VPC peering features on daily basis.
## Features

Terraform versions / Contributions
----
This module configures VPC peering between two VPCs. Cross-account and cross-region configurations are supported as well.

Terraform 0.12. Pin module version to `~> v2.0`. Submit pull-requests to `master` branch.
You can also manage peering options, but you need to run `apply` twice to do that.

Terraform 0.11. Pin module version to `~> v1.0`. Submit pull-requests to `terraform011` branch.
## Terraform Versions

Changelog
----
Changelog is in the [CHANGELOG.md](CHANGELOG.md)
**Always make sure you pinned the module version!**

* For Terraform versions `>=0.13` use `v3.*` versions of this module
* For Terraform versions `>=0.12 <0.13` use `v2.*` versions of this module
* If you're still using Terraform `0.11`, you can use `v1.*` versions of this module

Note
----
## Usage

These types of resources are supported:
### Examples

* [Peering Connection](https://www.terraform.io/docs/providers/aws/d/vpc_peering_connection.html)
* [AWS Route](https://www.terraform.io/docs/providers/aws/r/route.html)
* [AWS VPC Peering Connection Accepter](https://www.terraform.io/docs/providers/aws/r/vpc_peering_accepter.html)
* [AWS VPC Peering Connection Options](https://www.terraform.io/docs/providers/aws/r/vpc_peering_options.html)
Sample configuration is located in [examples](examples/) directory.

Usage
-----
* [Single account, single region peering](examples/single-account-single-region/README.md)
* [Single account, single region peering with options defined](examples/single-account-single-region-with-options/README.md)
* [Single account, cross region peering](examples/single-account-multi-region/README.md)
* [Cross account, cross region peering](examples/multi-account-multi-region/README.md)
* [Using depends_on with this module](examples/module-depends-on/README.md)

### Examples
Sample configuration is located in [examples](examples/) directory.

### Single Region Peering
### Simple Peering (single AWS account, same region)
**Notice**: You need to declare both providers even with single region peering.

```
Expand All @@ -72,64 +67,30 @@ module "single_account_single_region" {
}
```

Usage with already created peering connection:
```hc1
module "vpc_single_region_peering" {
source = "./terraform-aws-vpc-peering"
providers = {
aws.this = aws
aws.peer = aws
}
peer_region = "eu-west-1"
this_vpc_id = "vpc-00000000"
peer_vpc_id = "vpc-11111111"
cross_region_peering = false
auto_accept_peering = true
peering_id = "pcx-00000000"
}
```

### Cross Region Peering / Cross Account Peering
## Changelog

In order to setup cross-region or cross-account peering connection, you must configure `providers` for Terraform. You can find an example [here](examples/multi-account-multi-region).
Changelog is in the [CHANGELOG.md](CHANGELOG.md)

[Medium post](https://medium.com/@bonya/terraform-managing-resources-in-multiple-aws-accounts-c13015b89fce), which might be useful.
## Contribution

```hc1
module "vpc_cross_region_peering" {
source = "github.com/grem11n/terraform-aws-vpc-peering?ref=cross-region-peering"
Your contribution to this module is more than welcome!

providers = {
aws.this = aws.src
aws.peer = aws.dst
}
If you have an idea on how to improve this theme or found a bug feel free to use [GitHub issues](https://github.com/grem11n/hugo-gentoo-theme/issues) to let me know.

peer_region = "us-east-1"
this_vpc_id = "vpc-00000000"
peer_vpc_id = "vpc-11111111"
cross_region_peering = true
auto_accept_peering = true
If you want to contribute to this theme, please, fork this repository and create a pull request. For recent versions of Terraform, open a PR against the `master` branch. For Terraform 0.12, please, open a PR against `terraform012` branch. For Terraform 0.11, please, open a PR against `terraform011` branch.

tags = {
Name = "my-peering-connection"
Environment = "prod"
}
}
```

Testing
----
## Testing

This module is tested with [Terratest](https://github.com/gruntwork-io/terratest)
You can find existing tests in the [test/](test/) directory.

Authors
-------
Tests require AWS credentials. Since GitHub actions don't share the keys with fork repositories (on purpose), don't mind if tests for your PR failed. I will see it anyways and run them on my own. Alternatively, you can always run tests for your forks with your AWS credentials.

## Authors

Module managed by [Yurii Rochniak](https://github.com/grem11n)

License
-------
Apache 2 Licensed. See LICENSE for full details.
[About me](https://grem1.in)

## License
Apache 2 Licensed. See [LICENSE](LICENSE.md) for full details.
39 changes: 39 additions & 0 deletions examples/module-depends-on/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Using depends_on With This Module

If you're using Terraform `>=0.13`, you [can use `depedns_on` meta-argument with modules as well](https://www.terraform.io/docs/language/meta-arguments/depends_on.html)

This example shows you, how to create both VPCs themselves and peering connection using this module and `depends_on` meta-argument.

## Sample Code

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.

```
module "module_depends_on" {
source = "../../"
depends_on = [
aws_route_table.this,
aws_route_table.peer,
]
providers = {
aws.this = aws
aws.peer = aws
}
this_vpc_id = aws_vpc.this.id
peer_vpc_id = aws_vpc.peer.id
this_rts_ids = aws_route_table.this.*.id
peer_rts_ids = aws_route_table.peer.*.id
auto_accept_peering = true
tags = {
Name = "tf-single-account-single-region"
Environment = "Test"
}
}
```
2 changes: 0 additions & 2 deletions examples/module-depends-on/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ module "module_depends_on" {
depends_on = [
aws_route_table.this,
aws_route_table.peer,
aws_subnet.this,
aws_subnet.peer,
]

providers = {
Expand Down
14 changes: 2 additions & 12 deletions examples/multi-account-multi-region/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Single Account Multi Region VPC Peering

This example creates a peering connection between VPCs in different regions, which are located in different AWS accounts.
This example creates a peering connection between VPCs in different regions which are also located in different AWS accounts.

## Sample Code

Expand All @@ -19,7 +19,7 @@ module "multi_account_multi_region" {
auto_accept_peering = true
tags = {
Name = "tf-single-account-multi-region"
Name = "tf-multi-account-multi-region"
Environment = "Test"
}
}
Expand All @@ -34,13 +34,3 @@ terraform init
terraform plan
terraform apply
```

## Testing

This configuration is tested with [Terratest](https://github.com/gruntwork-io/terratest).

You can find tests in [`test/`](../../test) directory.

## Note

Running the resources in AWS may cost money! Make sure to clean up afterwards. You can use `terraform destroy` to delete the resources spawned by this example.
20 changes: 10 additions & 10 deletions examples/single-account-multi-region/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ This example creates a peering connection between VPCs in different regions, whi
## Sample Code

```
provider "aws" {
alias = "this"
region = "us-east-1"
}
provider "aws" {
alias = "peer"
region = "us-east-2"
}
module "single_account_multi_region" {
source = "../../"
Expand Down Expand Up @@ -34,13 +44,3 @@ terraform init
terraform plan
terraform apply
```

## Testing

This configuration is tested with [Terratest](https://github.com/gruntwork-io/terratest).

You can find tests in [`test/`](../../test) directory.

## Note

Running the resources in AWS may cost money! Make sure to clean up afterwards. You can use `terraform destroy` to delete the resources spawned by this example.
4 changes: 0 additions & 4 deletions examples/single-account-multi-region/provider.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//provider "aws" {
// region = "us-east-1"
//}

provider "aws" {
alias = "this"
region = "us-east-1"
Expand Down
Loading

0 comments on commit c9d3bfe

Please sign in to comment.