GCP project creation within Aliz was not always a standardized process. As we grew we realized that the number of our GCP projects grew as well to a level that is hard to manually manage and control. We wanted to introduce automation, enforce organization standards and implement an approval process for creating new GCP projects - and this tool was born.
- Implements a project creation approval workflow through Github pull requests
- Once a project creation request gets approved, the tool creates the necessary GCP resources:
- GCP project with the proper metadata & billing configuration
- Budget with proper notification setup
- Creates nightly reports in CSV format to GCS (see the details here)
- Create a dedicated GCP project that will host the resources needed by the tool:
- Create dedicated service account. This service account is going to be used by the tool, so you need to grant the following roles:
- Billing Account Costs Manager (
roles/billing.costsManager
) - Project Billing Manager (
roles/billing.projectManager
) - Project Creator (
roles/resourcemanager.projectCreator
) - Project IAM Admin (
roles/resourcemanager.projectIamAdmin
) - Browser (
roles/browser
)
- Billing Account Costs Manager (
- Create a GCS bucket that is going to hold the terraform state file
- Optionally create a dedicated GCS bucket for the CSV reports
- Enable the following APIs in the project:
- Compute Engine API (
compute.googleapis.com
) - Cloud Resource Manager API (
cloudresourcemanager.googleapis.com
) - Cloud Billing API (
cloudbilling.googleapis.com
) - Cloud Billing Budget API (
billingbudgets.googleapis.com
)
- Compute Engine API (
- Create dedicated service account. This service account is going to be used by the tool, so you need to grant the following roles:
- Fork this repository
- Configure the terraform project as described here
- Configure the CICD pipeline as described here
- Create your own template JSON and YAML files in
projects/templates
directory to support your users
As a requestor, follow the following steps:
- Create your project request prepared in a JSON or YAML file under the
projects/all_projects
directory. To get started, pick one of the templates with an absolute minimum configuration from theprojects/templates
directory. For a detailed description of the configuration structure, scroll down a bit more! - Push this to a feature branch
- Create a PR
- Check if the CICD pipeline gave green light and fix the problems if there's any
- Fix the changes requested by the approvers
- Once your branch gets merged, the deloyment will be performed in a few minutes.
- Check if the CICD workflow was successful on the branch. If not, ignore, otherwise proceed!
- Open the CICD workflow
tf_plan
job's details in CircleCI. Check if the changes make sense. On a request for a new project you have to see- a new GCP project
- a new budget for the new project
- one or more project ownership IAM bindings
- and no change in other resources
- Once everything is fine, approve and merge the PR
- The CICD pipeline on the
master
branch will apply the terraform configuration - After applying the configuration the contents of the report is going to be updated
Directory | Docs | Purpose |
---|---|---|
.circleci |
docs | Contains the CICD pipeline implementation |
projects |
docs | Contains the project configuration JSON or YAML files |
scripts |
docs | Contains shell and python scripts used for automation |
terraform |
docs | Contains the terraform project |
- If you are looking for a more advanced solution please have a look at our Platform: https://aliz.ai/product-landing-page/
- If you are looking for ready-made blueprints what you can checkout and adjust the code to your needs: https://aliz.ai/blueprints/