시작하기 전에
- 실습에서는 정해진 기간 동안 Google Cloud 프로젝트와 리소스를 만듭니다.
- 실습에는 시간 제한이 있으며 일시중지 기능이 없습니다. 실습을 종료하면 처음부터 다시 시작해야 합니다.
- 화면 왼쪽 상단에서 실습 시작을 클릭하여 시작합니다.
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 guides you through creating a firewall rule in Google Cloud using Terraform. You will learn how to define a firewall rule resource, configure its properties, and apply it to your Google Cloud project. This lab assumes you have a basic understanding of Google Cloud and Terraform.
Before you begin, configure your Google Cloud project. This includes setting the project ID, region, and zone. Also, enable the IAM API.
Set your Project ID:
Set your default region to
Set your default zone to
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 (GCS).
Create a Cloud Storage bucket. Ensure the bucket name is globally unique and prefixed with your project ID:
Enable versioning on the GCS bucket:
Now, you will define the firewall rule using Terraform's configuration language.
Create a new directory for your Terraform configuration files.
Create a file named firewall.tf and add the following code to define a firewall rule that allows SSH traffic (port 22) to instances with the tag ssh-allowed.
Create a variables.tf file to define variables used in firewall.tf and main.tf.
Create an outputs.tf file to output the firewall rule name.
Now you will apply the Terraform configuration to create the firewall rule in your Google Cloud project.
Run terraform init to enable Terraform.
Run terraform plan to preview the changes Terraform will make.
Run terraform apply to apply the configuration and create the firewall rule.
Verify that the firewall rule has been created in the Google Cloud Console.
To avoid incurring unnecessary costs, destroy the resources created in this lab.
Run terraform destroy to remove the firewall rule.
You have successfully created and destroyed a firewall rule in Google Cloud using Terraform. You have learned how to define firewall rules as code, manage their properties, and apply them to your Google Cloud project. This approach enables you to automate and manage your infrastructure in a consistent and repeatable manner.
Manual Last Updated Jul 22, 2025
Lab Last Tested Jul 22, 2025
현재 이 콘텐츠를 이용할 수 없습니다
이용할 수 있게 되면 이메일로 알려드리겠습니다.
감사합니다
이용할 수 있게 되면 이메일로 알려드리겠습니다.
한 번에 실습 1개만 가능
모든 기존 실습을 종료하고 이 실습을 시작할지 확인하세요.