This module allows creation of a [VPC Network Peering](https://cloud.google.com/vpc/docs/vpc-peering) between two networks.
The resources created/managed by this module are:
- one network peering from `local network` to `peer network`
- one network peering from `peer network` to `local network`
## Usage
Basic usage of this module is as follows:
```hcl
module "peering" {
source = "modules/net-vpc-peering"
prefix = "name-prefix"
local_network = "<FIRSTNETWORKSELFLINK>"
peer_network = "<SECONDNETWORKSELFLINK>"
}
```
If you need to create more than one peering for the same VPC Network `(A -> B, A -> C)` you have to use output from the first module as a dependency for the second one to keep order of peering creation (It is not currently possible to create more than one peering connection for a VPC Network at the same time).
```hcl
module "peering-a-b" {
source = "modules/net-vpc-peering"
prefix = "name-prefix"
local_network = "<ANETWORKSELFLINK>"
peer_network = "<BNETWORKSELFLINK>"
}
module "peering-a-c" {
source = "modules/net-vpc-peering"
prefix = "name-prefix"
local_network = "<ANETWORKSELFLINK>"
peer_network = "<CNETWORKSELFLINK>"
module_depends_on = [module.peering-a-b.complete]
}
```
<!-- BEGIN TFDOC -->
## Variables
| name | description | type | required | default |
|---|---|:---: |:---:|:---:|
| local_network | Resource link of the network to add a peering to. | <codetitle="">string</code> | ✓ | |
| peer_network | Resource link of the peer network. | <codetitle="">string</code> | ✓ | |
| *export_local_custom_routes* | Export custom routes to peer network from local network. | <codetitle="">bool</code> | | <codetitle="">false</code> |
| *export_peer_custom_routes* | Export custom routes to local network from peer network. | <codetitle="">bool</code> | | <codetitle="">false</code> |
| *module_depends_on* | List of modules or resources this module depends on. | <codetitle="">list</code> | | <codetitle="">[]</code> |
| *peer_create_peering* | Create the peering on the remote side. If false, only the peering from this network to the remote network is created. | <codetitle="">bool</code> | | <codetitle="">true</code> |
| *prefix* | Name prefix for the network peerings. | <codetitle="">string</code> | | <codetitle="">network-peering</code> |