ContinuousEngineeringProject / issues

This repository will contain the issues for the Continuous Engineering Project
1 stars 0 forks source link

create a GCP factory project #35

Open CVJT opened 2 years ago

CVJT commented 2 years ago

What would you like to be added

To create the GCP project for the factory, along with IAM access, Service Accounts, and API enablement

Why is this needed

To host the factory in GCP

Implementation

The terraform Project Factory module will take the following actions:

  1. Create a new GCP project using the project_name.
  2. If a shared VPC is specified, attach the new project to the svpc_host_project_id. It will also give the following users network access on the specified subnets:
    • The project's new default service account (see step 4)
    • The Google API service account for the project
    • The project controlling group specified in group_name
  3. Delete the default compute service account.
  4. Create a new default service account for the project.
    • Give it access to the shared VPC (to be able to launch instances).
  5. Attach the billing account (billing_account) to the project.
  6. Give the controlling group access to the project, with the group_role.
  7. Enable the required and specified APIs (activate_apis).
  8. Delete the default network.
  9. Enable usage report for GCE into central project bucket (target_usage_bucket), if provided.
  10. If specified, create the GCS bucket bucket_name and give the following accounts Storage Admin on it:
    • The controlling group (group_name).
    • The new default compute service account created for the project.
    • The Google APIs service account for the project.

The roles granted are specifically:

Shared VPC subnets and IAM permissions

A service project's access to shared VPC networks is controlled via the roles/compute.networkUser role and the location to where that role is assigned. If that role is assigned to the shared VPC host project, then the service project will have access to all shared VPC subnetworks. If that role is assigned to individual subnetworks, then the service project will have access to only the subnetworks on which that role was assigned. The logic for determining that location is as follows:

  1. If var.svpc_host_project_id and var.shared_vpc_subnets are not set then the compute.networkUser role is not assigned
  2. If var.svpc_host_project_id is set but no subnetworks are provided via var.shared_vpc_subnets then the compute.networkUser role is assigned at the host project and the service project will have access to all shared VPC subnetworks
  3. If var.svpc_host_project_id is set and var.shared_vpc_subnets contains an array of subnetworks then the compute.networkUser role is assigned to each subnetwork in the array