Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Associate Cloud Engineer practice bank has an additional 2,014 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
A cloud engineer is updating an existing Google Cloud infrastructure deployment using Terraform. The configuration includes several Compute Engine virtual machines, firewall rules, and Cloud Storage buckets.
Before executing the updates in the environment, the engineer wants to preview the exact proposed changes, verify which resources will be created, modified, or destroyed, and ensure there are no unintended disruptions to live resources.
Which Terraform command should the engineer run to generate and review this execution plan without making actual changes?
terraform apply IsThe terraform apply command executes the actions required to reach the desired state specified in the configuration files by calling Google Cloud APIs to provision, modify, or delete infrastructure.
terraform apply can show an execution plan interactively before asking for confirmation, its primary purpose is to enact infrastructure modifications rather than serve purely as a safe preview tool.-auto-approve), terraform apply immediately provisions changes without allowing prior review.terraform.tfstate) to record real-world resource identifiers and metadata.terraform apply directly without a standalone planning stage bypasses code review gates.The engineer were ready to actively provision or update the Google Cloud resources and persist the state mapping to storage.
In standard workflows, terraform apply is executed only after the execution plan generated by terraform plan has been inspected and approved.
terraform init IsThe terraform init command initializes a working directory containing Terraform configuration files. It downloads required provider plugins (such as the Google Cloud provider) and configures the backend for state storage.
terraform init does not inspect existing cloud infrastructure or generate a diff of proposed resource updates.backend "gcs").The engineer were cloning a repository or starting a new Terraform workspace and needed to prepare the directory and install providers before running any workflow commands.
terraform init is always the first command run in a fresh workspace, but it must be followed by terraform plan to evaluate resource changes.
terraform plan IsThe terraform plan command is a core execution workflow command in HashiCorp Terraform. It reads the current state of any existing remote infrastructure, compares that state against the declared configuration files (.tf), and generates a speculative execution plan detailing what actions Terraform will take when applied.

terraform plan explicitly lists which resources will be created (+), modified (~), or destroyed (-) before any actual cloud API calls are made.terraform plan does not mutate real-world infrastructure, allowing teams to catch syntax mismatches, unintended replacements, or destructive actions early in the deployment workflow.-out flag, ensuring the exact reviewed plan is later applied deterministically.terraform plan is the standard, purpose-built step in the Terraform workflow for inspecting proposed infrastructure adjustments prior to applying them. It fulfills the safety requirement with zero risk of executing accidental modifications on live Google Cloud environments.
terraform validate IsThe terraform validate command verifies the internal consistency and syntax of Terraform configuration files within a directory without accessing remote APIs or state data.
terraform validate only checks whether the code is syntactically correct and internally consistent; it does not produce an execution plan detailing resource changes.The engineer simply wanted to perform a fast, offline syntax and configuration validation check during local code authoring or in a pre-commit hook.
While terraform validate ensures that code is syntactically valid, terraform plan is required to project how that valid configuration impacts actual cloud resources.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated