Skip to content

Commit

Permalink
Update network peering docs, schema (#4982)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and rileykarson committed Nov 25, 2019
1 parent b278a0a commit c2e94bc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
20 changes: 11 additions & 9 deletions google/resource_compute_network_peering.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,39 @@ func resourceComputeNetworkPeering() *schema.Resource {
ForceNew: true,
ValidateFunc: validateGCPName,
},

"network": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateRegexp(peerNetworkLinkRegex),
DiffSuppressFunc: compareSelfLinkRelativePaths,
},

"peer_network": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateRegexp(peerNetworkLinkRegex),
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
// The API only accepts true as a value for exchange_subnet_routes or auto_create_routes (of which only one can be set in a valid request).
// Also, you can't set auto_create_routes if you use the networkPeering object. auto_create_routes is also removed
"auto_create_routes": {
Type: schema.TypeBool,
Optional: true,
Removed: "auto_create_routes has been removed because it's redundant and not user-configurable. It can safely be removed from your config",
ForceNew: true,
},

"state": {
Type: schema.TypeString,
Computed: true,
},

"state_details": {
Type: schema.TypeString,
Computed: true,
},

"auto_create_routes": {
Type: schema.TypeBool,
Optional: true,
Removed: "auto_create_routes has been removed because it's redundant and not user-configurable. It can safely be removed from your config",
ForceNew: true,
},
},
}
}
Expand Down Expand Up @@ -164,7 +167,6 @@ func findPeeringFromNetwork(network *computeBeta.Network, peeringName string) *c
}
func expandNetworkPeering(d *schema.ResourceData) *computeBeta.NetworkPeering {
return &computeBeta.NetworkPeering{
// auto_create_routes was replaced by exchange_subnet_routes in the network peering object
ExchangeSubnetRoutes: true,
Name: d.Get("name").(string),
Network: d.Get("peer_network").(string),
Expand Down
19 changes: 14 additions & 5 deletions website/docs/r/compute_network_peering.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ Manages a network peering within GCE. For more information see
and
[API](https://cloud.google.com/compute/docs/reference/latest/networks).

~> **Note:** Both network must create a peering with each other for the peering to be functional.
-> Both network must create a peering with each other for the peering
to be functional.

~> **Note:** Subnets IP ranges across peered VPC networks cannot overlap.
~> Subnets IP ranges across peered VPC networks cannot overlap.

## Example Usage

Expand Down Expand Up @@ -50,15 +51,23 @@ The following arguments are supported:

* `name` - (Required) Name of the peering.

* `network` - (Required) Resource link of the network to add a peering to.
* `network` - (Required) The primary network of the peering.

* `peer_network` - (Required) Resource link of the peer network.
* `peer_network` - (Required) The peer network in the peering. The peer network
may belong to a different project.

* `export_custom_routes` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
Whether to export the custom routes to the peer network. Defaults to `false`.

* `import_custom_routes` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
Whether to export the custom routes from the peer network. Defaults to `false`.

## Attributes Reference

In addition to the arguments listed above, the following computed attributes are
exported:

* `state` - State for the peering.
* `state` - State for the peering, either `ACTIVE` or `INACTIVE`. The peering is
`ACTIVE` when there's a matching configuration in the peer network.

* `state_details` - Details about the current state of the peering.

0 comments on commit c2e94bc

Please sign in to comment.