How to Onboard a GCP Linked Project (Assessment+Governance)
Overview
This section guides you through how to onboard a Google Cloud Platform (GCP) Linked Project into CoreStack.
Pre-onboarding
There are certain prerequisites that need to be set up in your GCP project before it can be onboarded into CoreStack.
- We need to onboard a GCP Billing account before proceeding to onboard the Linked project.
- All the costs will be fetched from the billing account and the metadata sync for all the projects linked to this billing account will take 24 hours to be completed.
Note:
- The sync of the cost data will take 24 hours to reflect in CoreStack.
- We will be able to onboard the linked project account only after the sync is completed.
Perform the following steps to onboard GCP Linked Project - Assessment+Governance:
- Sign in to the GCP console: https://console.cloud.google.com.
- Sign in to your organization’s cloud account with a user ID and a password.
- Click the icon for Command Line Interface as shown in the image below.
- On the Cloud Shell Terminal screen, clone the GitHub repository by running the below command in a specific folder.
git clone https://github.com/corestacklabs/Onboarding_Templates.git
The repo is now downloaded.
Before starting, collect the following details that will be prompted when run.sh is executed:
- Project ID
- The service account email that is created during the onboarding of billing account.
- Role ID (optional)
Perform the following steps to onboard a GCP linked project account with Terraform:
To get the project ID, click the dropdown on the left of the Search box.
In the ID section, select the project ID and copy it.
To get the email ID for the service account, navigate to the IAM section and search for the service account by name: for example, “$serviceaccount_abcd@$project_id.iam.gserviceaccount.com”. Copy the email ID.
The Role ID will only be requested if you enter ‘No’ for the “Assign predefined role” condition. Since it requires user input, make sure to follow the regular expression rules: "^[a-zA-Z0-9_\\.]{3,64}$"
Executing Terraform in the Cloud Shell console
Open the cloud console and navigate to the following directory:
cd Onboarding_Templates/GCP/Assesment+gov-module-proj/core
Run this command in the directory: chmod +x run.sh
. This will execute the script.
Run the command: sh run.sh
Type either yes or no when prompted for the pre-check condition of whether you have the necessary permissions or not.
If you type no, the script will terminate with exit code 0.
If you type yes, it will ask for further input: the project ID and service account email ID.
Type yes or no when prompted to provide the GCP predefined roles.
If you type yes:
The Terraform template will take all the pre-defined roles as shown in the screenshot below.
Check the terminal for all the provisioning steps that will be executed by Terraform.
Return to the CoreStack portal and continue with the onboarding process.
If you type no:
When the prompt asks for the assigned custom role, type the role ID in this format: ^[a-zA-Z0-9_\\.]{3,64}$
This role is configured as the least permission required by CoreStack to function.
Check the Terraform execution flow in the terminal.
Return to the CoreStack portal and continue with the onboarding process.
Onboarding in the CoreStack portal
At this point, you can switch to the CoreStack web portal to continue the onboarding process.
- In the CoreStack portal, click ADD NEW > Single Account > Start New.
The CHOOSE A CLOUD TO START screen displays.
- In the Public Cloud setion, click to select GCP and click GET STARTED.
- In the Access Type section, click to select Assessment +Governance.
- Perform the following:
a. In the Account Type section, click to select Linked Project Account.
b. In the Authentication Protocol field, click to select Service Account, and then click NEXT.
- Perform the following on the AUTHENTICATE YOUR ACCOUNT CREDENTIALS screen:
a. In the Hierarchy Scope field, click to select Project.
b. In the Project ID box, type the project ID. Refer to step 2 for where to find the project ID.
c. Click Upload and select the JSON file to be uploaded.
d. Click VALIDATE.
This completes the onboarding of a GCP linked project account with Terraform.
Updated 4 months ago