diff --git a/blueprints/serverless/cloud-run-corporate/main.tf b/blueprints/serverless/cloud-run-corporate/main.tf index 36896f965..cf016012d 100644 --- a/blueprints/serverless/cloud-run-corporate/main.tf +++ b/blueprints/serverless/cloud-run-corporate/main.tf @@ -79,6 +79,24 @@ module "project_prj1" { skip_delete = true } +# Service Project 1 +module "project_svc1" { + source = "../../../modules/project" + count = var.prj_svc1_id != null ? 1 : 0 + name = var.prj_svc1_id + project_create = var.prj_svc1_create != null + billing_account = try(var.prj_svc1_create.billing_account_id, null) + parent = try(var.prj_svc1_create.parent, null) + shared_vpc_service_config = { + host_project = module.project_main.project_id + } + services = [ + "compute.googleapis.com", + "dns.googleapis.com" + ] + skip_delete = true +} + ############################################################################### # Cloud Run # ############################################################################### @@ -280,6 +298,20 @@ module "vm_test_prj1" { tags = ["ssh"] } +module "vm_test_svc1" { + source = "../../../modules/compute-vm" + count = length(module.project_svc1) + project_id = module.project_svc1[0].project_id + zone = "${var.region}-b" + name = "vm-test-svc1" + instance_type = "e2-micro" + network_interfaces = [{ + network = module.vpc_main.self_link + subnetwork = module.vpc_main.subnet_self_links["${var.region}/subnet-main"] + }] + tags = ["ssh"] +} + ############################################################################### # DNS # ############################################################################### diff --git a/blueprints/serverless/cloud-run-corporate/variables.tf b/blueprints/serverless/cloud-run-corporate/variables.tf index f6bd1b885..d1496e8f9 100644 --- a/blueprints/serverless/cloud-run-corporate/variables.tf +++ b/blueprints/serverless/cloud-run-corporate/variables.tf @@ -103,6 +103,21 @@ variable "prj_prj1_id" { default = null } +variable "prj_svc1_create" { + description = "Parameters for the creation of service project 1." + type = object({ + billing_account_id = string + parent = string + }) + default = null +} + +variable "prj_svc1_id" { + description = "Service Project 1 ID." + type = string + default = null +} + variable "region" { description = "Cloud region where resource will be deployed." type = string