-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsubnetwork.tf
30 lines (27 loc) · 1.19 KB
/
subnetwork.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/******************************************
Create subnetwork without secondary_range
*****************************************/
resource "google_compute_subnetwork" "basic" {
count = "${var.create_secondary_ranges ? 0 : 1}"
name = "${var.name}"
description = "${var.description != "" ? var.description : local.description}"
region = "${var.region}"
ip_cidr_range = "${var.ip_cidr_range}"
network = "${var.network}"
private_ip_google_access = true
enable_flow_logs = true
}
/******************************************
Create subnetwork with secondary_range
*****************************************/
resource "google_compute_subnetwork" "ranged" {
count = "${var.create_secondary_ranges ? 1 : 0}"
name = "${var.name}"
description = "${var.description != "" ? var.description : local.description}"
region = "${var.region}"
ip_cidr_range = "${var.ip_cidr_range}"
network = "${var.network}"
secondary_ip_range = "${var.secondary_ranges}"
private_ip_google_access = true
enable_flow_logs = true
}