Complete the code to specify the backend type for Google Cloud Storage in Terraform.
terraform {
backend "[1]" {
bucket = "my-terraform-state"
prefix = "terraform/state"
}
}The backend type for Google Cloud Storage in Terraform is gcs. This tells Terraform to store state files in a GCS bucket.
Complete the code to specify the GCS bucket name in the backend configuration.
terraform {
backend "gcs" {
bucket = "[1]"
prefix = "terraform/state"
}
}The bucket name should match the actual GCS bucket where Terraform state is stored. Here, 'my-terraform-state' is used as an example bucket name.
Fix the error in the backend configuration by completing the missing prefix value.
terraform {
backend "gcs" {
bucket = "my-terraform-state"
prefix = "[1]"
}
}The prefix defines the folder path inside the bucket where the state files are stored. 'terraform/state' is a common and clear prefix.
Fill both blanks to configure the backend with project and credentials file.
terraform {
backend "gcs" {
bucket = "my-terraform-state"
prefix = "terraform/state"
project = "[1]"
credentials = "[2]"
}
}The project is your Google Cloud project ID, and credentials is the path to your service account JSON file for authentication.
Fill all three blanks to complete the backend configuration with bucket, prefix, and project.
terraform {
backend "gcs" {
bucket = "[1]"
prefix = "[2]"
project = "[3]"
}
}The bucket is the GCS bucket name, prefix is the folder path inside the bucket, and project is the Google Cloud project ID.