Skip to content

Commit

Permalink
fix: Added dependancies on Shared VPC attachment to work with VPC ser…
Browse files Browse the repository at this point in the history
…vice controls (#608)

* added time_sleep and dependancies on shared vpc attachment

* run fmt on core factory main.tf

* added vpc_service_control_attach_enabled conditional creation for time_sleep
  • Loading branch information
rm-paoloventriglia authored Jul 29, 2021
1 parent d31b2b0 commit 59b7b96
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/core_project_factory/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,19 @@ module "project_services" {
/******************************************
Shared VPC configuration
*****************************************/
resource "time_sleep" "wait_5_seconds" {
count = var.vpc_service_control_attach_enabled ? 1 : 0
depends_on = [google_access_context_manager_service_perimeter_resource.service_perimeter_attachment[0], google_project_service.enable_access_context_manager[0]]
create_duration = "5s"
}

resource "google_compute_shared_vpc_service_project" "shared_vpc_attachment" {
provider = google-beta

count = var.enable_shared_vpc_service_project ? 1 : 0
host_project = var.shared_vpc
service_project = google_project.main.project_id
depends_on = [module.project_services]
depends_on = [time_sleep.wait_5_seconds[0], module.project_services]
}

resource "google_compute_shared_vpc_host_project" "shared_vpc_host" {
Expand Down

0 comments on commit 59b7b96

Please sign in to comment.