From 16bb612747a9e7745853030d9a4ae9d66e9b02ad Mon Sep 17 00:00:00 2001 From: Jesus Perez Rey Date: Mon, 5 Dec 2022 16:03:51 +0100 Subject: [PATCH] Add support to GPC shared VPCs. Signed-off-by: Jesus Perez Rey --- roles/common/defaults/main.yml | 1 + roles/platform/defaults/main.yml | 1 + roles/platform/tasks/setup_gcp_env.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml index e3412746..69d32d28 100644 --- a/roles/common/defaults/main.yml +++ b/roles/common/defaults/main.yml @@ -86,6 +86,7 @@ common__terraform_remote_state_bucket: "{{ globals.terraform.remote_state_bu common__terraform_remote_state_lock_table: "{{ globals.terraform.remote_state_lock_table | default('') }}" common__vpc_name: "{{ infra.vpc.name | default([common__namespace, common__vpc_name_suffix] | join('-')) }}" +common__vpc_project: "{{ infra.vpc.project_id | default(omit) }}" common__vpc_public_subnet_cidrs: "{{ infra.vpc.public_subnets | default(['10.10.0.0/19', '10.10.32.0/19', '10.10.64.0/19']) }}" common__vpc_private_subnet_cidrs: "{{ infra.vpc.private_subnets | default(['10.10.96.0/19', '10.10.128.0/19', '10.10.160.0/19']) }}" common__vpc_private_subnets_suffix: "{{ infra.vpc.public_subnets_suffix | default([common__vpc_subnet_suffix, common__private_suffix] | join('-')) }}" diff --git a/roles/platform/defaults/main.yml b/roles/platform/defaults/main.yml index 329c7762..69413cd2 100644 --- a/roles/platform/defaults/main.yml +++ b/roles/platform/defaults/main.yml @@ -48,6 +48,7 @@ plat__cdp_iam_resource_suffix: "{{ plat__cdp_iam_identities.resou plat__tags: "{{ common__tags }}" plat__env_name: "{{ common__env_name }}" plat__vpc_name: "{{ common__vpc_name }}" +plat__vpc_project: "{{ common__vpc_project }}" plat__storage_name: "{{ common__storage_name }}" plat__logs_path: "{{ common__logs_path }}" diff --git a/roles/platform/tasks/setup_gcp_env.yml b/roles/platform/tasks/setup_gcp_env.yml index bb2c9881..d638fe7c 100644 --- a/roles/platform/tasks/setup_gcp_env.yml +++ b/roles/platform/tasks/setup_gcp_env.yml @@ -26,6 +26,7 @@ log_location: "gs://{{ plat__gcp_storage_location_logs }}" log_identity: "{{ plat__gcp_log_identity_name }}@{{ plat__gcp_project }}.iam.gserviceaccount.com" vpc_id: "{{ plat__vpc_name }}" + vpc_project_id: "{{ plat__vpc_project }}" subnet_ids: - "{{ plat__gcp_subnet_id if plat__gcp_subnet_id else plat__gcp_subnets_discovered[0].name }}" # TODO - Check in validation_gcp.yml -- CDP on GCP only supports a single subnet deployment project: "{{ plat__gcp_project }}"