Using a GCS backend in GCP
If you use Terraform to provision a resource on GCP, like for Azure and AWS, we need to store the Terraform state in the backend.
In this recipe, we will learn how to store a Terraform state file in a GCP storage bucket.
Let’s get started!
Getting ready
There are no specific requirements to complete this recipe.
In this recipe, we will create a GCP storage bucket manually in the GCP dashboard and we will configure the Terraform block to use this GCP storage bucket as a state backend.
To create a GCP bucket, perform these steps:
- Log in to your GCP console.
- Go to the left menu and navigate to Cloud Storage > Buckets.
Figure 9.20: GCP Buckets menu
- Click on the CREATE button.
Figure 9.21: GCP bucket CREATE button
- Fill in the form with the bucket name (here the bucket name is given as example, choose another unique name).
Figure 9.22: GCP –...