Context:
Will configure the terraform with GCP in this post.
Steps:
- Integrate terraform with GCP
- Enable the required GCP APIs
- Create a VPC and Subnet
Integrate terraform with GCP:
There are multiple ways to authenticate with GCP like gcloud auth or service account& key. Will use gcloud auth
in this post.
We would be using the below mentioned information in this post.
Terraform resources:
1. Terraform block
2. Google, google-beta Provider
3. API enable resource
4. Network, Subnetwork resources
GCP information:
1. ProjectId
2. Region
*Gcloud auth: *
Create the provider.tf with google provider and required version and run the gcloud auth login
.
Proceed for further steps to authenticate terraform with GCP.
Enable the required GCP APIs:
Will use the google_service_project
resource to enable the required iam, workstation apis.
Create a VPC and Subnet:
Use the mentioned google_compute_network
, google_compute_subnetwork
terraform resources to create the VPC and subnets in given gcp project.
Resources - References:
Final words:
Feel free to comment your queries here or at LinkedIn . Thanks.
Top comments (0)