Skip to content

Commit 23eaed1

Browse files
authored
Merge pull request #2 from terraform-google-modules/morgante/shared-vpc-host
Add shared VPC host variable
2 parents e7202bb + 5599922 commit 23eaed1

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,11 @@ resource "google_compute_subnetwork" "subnetwork" {
3939

4040
secondary_ip_range = "${var.secondary_ranges[lookup(var.subnets[count.index], "subnet_name")]}"
4141
}
42+
43+
/******************************************
44+
Shared VPC
45+
*****************************************/
46+
resource "google_compute_shared_vpc_host_project" "shared_vpc_host" {
47+
count = "${var.shared_vpc_host == "true" ? 1 : 0}"
48+
project = "${var.project_id}"
49+
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ variable "secondary_ranges" {
3333
type = "map"
3434
description = "Secondary ranges that will be used in some of the subnets"
3535
}
36+
37+
variable "shared_vpc_host" {
38+
type = "string"
39+
description = "Makes this project a Shared VPC host if 'true' (default 'false')"
40+
default = "false"
41+
}

0 commit comments

Comments
 (0)