
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Solve Task One
/ 100
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
When you are connected, you are already authenticated, and the project is set to your PROJECT_ID. The output contains a line that declares the PROJECT_ID for this session:
gcloud
is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Click Authorize.
Your output should now look like this:
Output:
Output:
Example output:
gcloud
, in Google Cloud, refer to the gcloud CLI overview guide.
This lab demonstrates how to create a Google Cloud Storage bucket using Terraform. You will define the bucket resource in a Terraform configuration file, initialize Terraform, and apply the configuration to create the bucket in your Google Cloud project. This lab assumes you have a basic familiarity with Google Cloud and Terraform concepts.
Before you begin, configure the Google Cloud SDK to interact with your Google Cloud project.
Set your Project ID:
Set your default region:
Set your default zone:
Terraform uses a state file to track the resources it manages. For collaboration and persistence, it's best to store this state file in a remote backend like Google Cloud Storage.
Create the Cloud Storage bucket:
Enable versioning on the GCS bucket:
Now, define the Terraform configuration to create the resource.
Create a new directory for your Terraform configuration files.
Create main.tf
with the following content:
Initialize Terraform in the directory containing your main.tf
file.
Run the terraform init
command:
Plan the changes. This shows you what Terraform will do before it makes any actual changes.
Run the terraform apply
command:
Verify that the bucket was created successfully in your Google Cloud project.
Enter the following command to validate the bucket has been created:
To avoid incurring unnecessary charges, you can destroy the resources created by Terraform.
Run the terraform destroy
command:
You have successfully created a Google Cloud Storage bucket using Terraform and stored the Terraform state in a Cloud Storage bucket. This lab demonstrated the basic workflow of defining infrastructure as code using Terraform.
Manual Last Updated Jul 22, 2025
Lab Last Tested Jul 22, 2025
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one