Skip to content

Commit cd6655c

Browse files
chore: Added VPC peering example (#283)
* Added basic firewall rule example * Regenerated docs * Fixes for output description and regenerated docs * Added basic firewall rule example * Regenerated docs * Fixes for output description and regenerated docs * Added comment about replacing project ID * Added VPC peering example * Moved files to correct directory and removed extraneous content from outputs * Updated README * Pinned basic VPC peering example to a version
1 parent 494b98d commit cd6655c

File tree

5 files changed

+120
-0
lines changed

5 files changed

+120
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# VPC network peering
2+
3+
This example configures VPC network peering.
4+
5+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
6+
## Inputs
7+
8+
| Name | Description | Type | Default | Required |
9+
|------|-------------|------|---------|:--------:|
10+
| local\_network | Self link to the local network. | `string` | n/a | yes |
11+
| peer\_network | Self link to the peer network. | `string` | n/a | yes |
12+
13+
## Outputs
14+
15+
| Name | Description |
16+
|------|-------------|
17+
| local\_network | The local network peering information |
18+
19+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/basic_vpc_peering/main.tf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Copyright 2019 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
18+
provider "null" {
19+
version = "~> 2.1"
20+
}
21+
22+
provider "google" {
23+
version = "~> 3.45.0"
24+
}
25+
26+
# [START vpc_peering_create]
27+
module "peering1" {
28+
source = "terraform-google-modules/network/google//modules/network-peering"
29+
version = "~> 3.2.1"
30+
local_network = var.local_network # Replace with self link to VPC network "foobar" in quotes
31+
peer_network = var.peer_network # Replace with self link to VPC network "other" in quotes
32+
}
33+
# [END vpc_peering_create]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Copyright 2019 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
18+
output "local_network" {
19+
value = module.peering1.local_network_peering
20+
description = "The local network peering information"
21+
}
22+
23+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Copyright 2019 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
variable "local_network" {
18+
description = "Self link to the local network."
19+
type = string
20+
}
21+
22+
variable "peer_network" {
23+
description = "Self link to the peer network."
24+
type = string
25+
}
26+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright 2019 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
terraform {
18+
required_version = ">=0.12.6"
19+
}

0 commit comments

Comments
 (0)