Let's automatically generate the infrastructure code of resources living on the Google Cloud Platform.
Access to the GCP console is required to run this tutorial.
Ensure the GCP CLI called gcloud is installed:
Initialize gcloud in order to authenticate your user, as well and setting the default region and zone:
Check the config at any time with:
Verify the presence of node and check the version:
Any version above 14 should be fine.
The GruCloud CLI called
gc can be installed globally with NPM:
As a sanity check, display the version with:
That's all for these requirements.
### Create new project
Select GCP and choose a project.
A few actions need to be performed prior to deploying the resources.
- Create the project
- Setup billing for that project
- Enable the API services
- Create a service account
- Create and save the credential file for this service account
- Update the IAM policy by binding roles to the service account
Don't worry, these preparations steps are fully automated:
Here we assume some resources are already deployed.
This command fetches the resources inventory and generated the code in resource.js.
Congratulation, the infrastructure code has been created automatically.
To destroy the infrastructure, use the destroy command: