File tree 3 files changed +15
-4
lines changed
3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,17 @@ data "google_compute_network" "network" {
21
21
project = " ${ var . network_project == " " ? var . project : var . network_project } "
22
22
}
23
23
24
+ data "google_compute_subnetwork" "network" {
25
+ name = " ${ var . subnetwork } "
26
+ project = " ${ var . network_project == " " ? var . project : var . network_project } "
27
+ }
28
+
24
29
resource "google_compute_forwarding_rule" "default" {
25
30
project = " ${ var . project } "
26
31
name = " ${ var . name } "
27
32
region = " ${ var . region } "
28
33
network = " ${ data . google_compute_network . network . self_link } "
34
+ subnetwork = " ${ data . google_compute_subnetwork . network . self_link } "
29
35
load_balancing_scheme = " INTERNAL"
30
36
backend_service = " ${ google_compute_region_backend_service . default . self_link } "
31
37
ip_address = " ${ var . ip_address } "
Original file line number Diff line number Diff line change 13
13
* See the License for the specific language governing permissions and
14
14
* limitations under the License.
15
15
*/
16
-
16
+
17
17
output ip_address {
18
18
description = " The internal IP assigned to the regional fowarding rule."
19
19
value = " ${ google_compute_forwarding_rule . default . ip_address } "
Original file line number Diff line number Diff line change 13
13
* See the License for the specific language governing permissions and
14
14
* limitations under the License.
15
15
*/
16
-
16
+
17
17
variable project {
18
18
description = " The project to deploy to, if not set the default provider project is used."
19
19
default = " "
@@ -29,9 +29,14 @@ variable network {
29
29
default = " default"
30
30
}
31
31
32
+ variable subnetwork {
33
+ description = " Name of the subnetwork to create resources in."
34
+ default = " default"
35
+ }
36
+
32
37
variable network_project {
33
38
description = " Name of the project for the network. Useful for shared VPC. Default is var.project."
34
- default = " "
39
+ default = " "
35
40
}
36
41
37
42
variable name {
@@ -74,5 +79,5 @@ variable ip_address {
74
79
75
80
variable ip_protocol {
76
81
description = " The IP protocol for the backend and frontend forwarding rule. TCP or UDP."
77
- default = " TCP"
82
+ default = " TCP"
78
83
}
You can’t perform that action at this time.
0 commit comments