Easy Terraform Associate practice questions
Direct recall — confirm you know the core facts and definitions. 12 easy questions available — no sign-up, always free.
A developer runs 'terraform destroy' to tear down a temporary test environment. Later that day, they need the exact same environment back. The configuration files (.tf) and provider lock file are all still present in the working directory, and 'terraform init' has already been run. Which single command will recreate the entire environment as defined in the configuration?
A developer has finished editing a Terraform configuration and wants to provision the infrastructure. They have not saved a plan file. Which single command will show the proposed changes and, after interactive approval, create the resources?
A new engineer clones your Terraform repository containing several .tf files that reference the AWS provider. They immediately run 'terraform plan' and receive an error stating the provider is not installed and that they must run another command first. Which command must they run before 'terraform plan' will succeed, and why?
A junior engineer has finished writing a new Terraform configuration that adds several resources and modifies an existing security group. Before making any changes to the live environment, they want to review exactly what Terraform intends to create, update, or delete so the team can approve the changes during a code review. Which command should they run to produce this preview without altering any real infrastructure?
You have written a reusable module named "network" that creates a VPC. The module defines an output named "vpc_id". In the root configuration, you want to pass this VPC ID into a resource that creates a security group. Which expression correctly references the module's output?
You have provisioned an AWS EC2 instance in your root Terraform configuration. After running 'terraform apply', a teammate asks how they can quickly see the instance's public IP address on the command line without inspecting state or logging into the AWS console. What should you add to your configuration to surface this value automatically at the end of each apply?
You inherited a Terraform configuration with a large state file and need to locate the exact resource address of a specific EC2 instance before running a targeted operation. You want to see all resource addresses currently tracked in state without querying the cloud provider or modifying anything. Which command should you run?
A developer spun up a temporary demo environment using Terraform for a week-long product showcase. Now that the event is over, they want to tear down every resource that Terraform provisioned for this configuration to avoid ongoing cloud charges, while keeping the configuration files intact for future reuse. Which command should they run?
A developer has just cloned a Terraform repository containing a main.tf that references the AWS and Random providers in its required_providers block. They attempt to run 'terraform plan' immediately but receive an error indicating the required providers are not installed. Which command should they run to download and install the provider plugins into the working directory?
A platform engineer is troubleshooting an intermittent failure during 'terraform apply' and wants the most detailed internal logging Terraform can produce, including provider RPC calls and core graph operations. Which value should they assign to the TF_LOG environment variable to get the highest verbosity?
You are writing a Terraform configuration and want to declare an input that lets operators optionally override the instance size, but defaults to "t3.micro" when no value is supplied. You add the following to variables.tf: variable "instance_type" { type = string default = "t3.micro" } During 'terraform plan', no value is passed for this variable on the command line, in a .tfvars file, or via an environment variable. What happens?
You are working on a project that uses multiple CLI workspaces to isolate state for dev, staging, and prod. Before running an apply, you want to confirm which workspace is currently active so you don't accidentally modify the wrong environment's state. Which command shows all existing workspaces and marks the one currently selected with an asterisk?