Skip to content

Commit 06c45ea

Browse files
committed
add example to test
1 parent 8c67e92 commit 06c45ea

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

examples/shared_vpc/main.tf

+23
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,29 @@ module "service-project-c" {
186186
grant_network_role = false
187187
}
188188

189+
/******************************************
190+
Fourth Service Project Creation
191+
To test shared_vpc_deletion_policy
192+
*****************************************/
193+
module "service-project-d" {
194+
source = "terraform-google-modules/project-factory/google//modules/svpc_service_project"
195+
version = "~> 15.0"
196+
197+
name = "d-${var.service_project_name}"
198+
random_project_id = false
199+
200+
org_id = var.organization_id
201+
folder_id = var.folder_id
202+
billing_account = var.billing_account
203+
204+
shared_vpc = module.host-project.project_id
205+
shared_vpc_subnets = module.vpc.subnets_self_links
206+
207+
svpc_deletion_policy = "ABANDON"
208+
209+
disable_services_on_destroy = false
210+
}
211+
189212
/******************************************
190213
Example dependency on service-project
191214
*****************************************/

modules/svpc_service_project/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ module "service-project" {
6464
| sa\_role | A role to give the default Service Account for the project (defaults to none) | `string` | `""` | no |
6565
| shared\_vpc | The ID of the host project which hosts the shared VPC | `string` | `""` | no |
6666
| shared\_vpc\_subnets | List of subnets fully qualified subnet IDs (ie. projects/$project\_id/regions/$region/subnetworks/$subnet\_id) | `list(string)` | `[]` | no |
67+
| svpc\_deletion\_policy | The deletion policy for the service project shared VPC. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: null, "ABANDON". | `string` | `null` | no |
6768
| usage\_bucket\_name | Name of a GCS bucket to store GCE usage reports in (optional) | `string` | `""` | no |
6869
| usage\_bucket\_prefix | Prefix in the GCS bucket to store GCE usage reports in (optional) | `string` | `""` | no |
6970

modules/svpc_service_project/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module "project-factory" {
3838
project_id = var.project_id
3939
shared_vpc = var.shared_vpc
4040
enable_shared_vpc_service_project = true
41+
shared_vpc_deletion_policy = var.svpc_deletion_policy
4142
grant_network_role = var.grant_network_role
4243
billing_account = var.billing_account
4344
folder_id = var.folder_id

modules/svpc_service_project/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,9 @@ variable "default_network_tier" {
228228
type = string
229229
default = ""
230230
}
231+
232+
variable "svpc_deletion_policy" {
233+
description = "The deletion policy for the service project shared VPC. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: null, \"ABANDON\"."
234+
type = string
235+
default = null
236+
}

0 commit comments

Comments
 (0)