Courseiva
Knowledge + Practice
CertificationsVendorsCareer RoadmapsLabs & ToolsStudy GuidesGlossaryPractice Questions
C
Courseiva

Free IT certification practice questions with explained answers for CCNA, CompTIA, AWS, Azure, Google Cloud, and more.

Certification Practice Questions

CCNA practice questionsSecurity+ SY0-701 practice questionsAWS SAA-C03 practice questionsAZ-104 practice questionsAZ-900 practice questionsCLF-C02 practice questionsA+ Core 1 practice questionsGoogle Cloud ACE practice questionsCySA+ CS0-003 practice questionsNetwork+ N10-009 practice questions
View all certifications →

Product

CertificationsCertification PathsExam TopicsPractice TestsExam Dumps vs Practice TestsStudy HubComparisons

Company

AboutContactEditorial PolicyQuestion Writing PolicyTrust Center

Legal

Privacy PolicyTerms of Service

Courseiva is a free IT certification practice platform offering original exam-style practice questions, detailed explanations, topic-based practice, mock exams, readiness tracking, and study analytics for Cisco, CompTIA, Microsoft, AWS, and other technology certifications.

© 2026 Courseiva. Courseiva is operated by JTNetSolutions Ltd. All rights reserved.

Courseiva is an independent certification practice platform and is not affiliated with, endorsed by, or sponsored by Cisco, Microsoft, AWS, CompTIA, Google, ISC2, ISACA, or any other certification vendor. Vendor names and certification marks are used only to identify the exams learners are preparing for.

← Understand Terraform basics practice sets

TF-003 Understand Terraform basics • Complete Question Bank

TF-003 Understand Terraform basics — All Questions With Answers

Complete TF-003 Understand Terraform basics question bank — all 0 questions with answers and detailed explanations.

58
Questions
Free
No signup
Certifications/TF-003/Practice Test/Understand Terraform basics/All Questions
Question 1mediummultiple choice
Read the full Understand Terraform basics explanation →

A DevOps engineer is writing a Terraform configuration to provision an AWS EC2 instance. They want to ensure that the instance is replaced if the AMI ID changes, but not if the instance type changes. Which lifecycle meta-argument should be used?

Question 2easymultiple choice
Read the full Understand Terraform basics explanation →

A team is using Terraform to manage infrastructure across multiple environments (dev, staging, prod). They want to reuse the same root module configuration but with different variable values. Which approach is the most efficient?

Question 3hardmultiple choice
Read the full Understand Terraform basics explanation →

A Terraform configuration includes a module from the Terraform Registry. After running `terraform init`, the module is downloaded. However, a subsequent `terraform plan` fails with an error that a required provider is not installed, even though it is declared in the module. What is the most likely cause?

Question 4mediummultiple choice
Read the full Understand Terraform basics explanation →

An organization uses Terraform Cloud for remote state management. They have a workspace that uses the CLI-driven run workflow. A developer runs `terraform plan` locally and sees that the plan succeeds. However, when they push the same configuration to the version control system (VCS) connected to the workspace, the plan fails with a state lock error. What is the most likely reason?

Question 5hardmulti select
Read the full Understand Terraform basics explanation →

Which TWO of the following are valid ways to reference a resource attribute in Terraform?

Question 6easymultiple choice
Read the full NAT/PAT explanation →

Refer to the exhibit. A developer runs `terraform apply` and the operation succeeds. Later, they manually terminate the EC2 instance through the AWS console. What will happen when the developer runs `terraform apply` again?

Exhibit

Refer to the exhibit.
```hcl
resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"

  tags = {
    Name = "WebServer"
  }
}

resource "aws_eip" "ip" {
  instance = aws_instance.web.id
}
```
Question 7hardmultiple choice
Review the full subnetting walkthrough →

You are a platform engineer at a fintech company. Your team manages a multi-region application on AWS using Terraform. The infrastructure includes VPCs, subnets, EC2 instances, and an Application Load Balancer (ALB). The configuration uses modules from the Terraform Registry and remote state in S3 with DynamoDB locking.

Recently, after a colleague ran `terraform apply` in the us-east-1 region, the application experienced downtime because the ALB's target group was accidentally updated to point to instances in us-west-2 instead of us-east-1. The root cause was that the Terraform configuration for the ALB used a variable `target_region` which was hardcoded to us-west-2 in a `terraform.tfvars` file that was not intended for that workspace.

Your team wants to prevent such misconfigurations in the future. Which course of action would most effectively reduce the risk of using incorrect variable values across workspaces?

Question 8easymultiple choice
Read the full Understand Terraform basics explanation →

A developer is new to Terraform and wants to understand the core workflow. Which sequence of commands correctly represents the basic Terraform workflow?

Question 9mediummulti select
Read the full Understand Terraform basics explanation →

Which TWO of the following are true about Terraform state? (Choose two.)

Question 10hardmultiple choice
Read the full Understand Terraform basics explanation →

You are a DevOps engineer managing a multi-environment Terraform setup using workspaces. Your team has three workspaces: dev, staging, and prod. All infrastructure is defined in a single root module with environment-specific variable values stored in separate .tfvars files. Recently, a colleague accidentally ran terraform destroy in the prod workspace, which deleted critical production resources. You need to implement a safety mechanism to prevent accidental destruction of production resources in the future. The solution should not require changes to the Terraform provider or backend configuration. Which approach should you take?

Question 11mediummulti select
Read the full Understand Terraform basics explanation →

Which three of the following are core characteristics of Terraform's execution plan? (Choose three.)

Question 12mediummulti select
Read the full Understand Terraform basics explanation →

Which of the following are core concepts or behaviors of Terraform's execution model and state management? (Choose four.)

Question 13mediumdrag order
Read the full Understand Terraform basics explanation →

Drag and drop the steps to create and apply a Terraform plan in the correct order.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5
Question 14mediumdrag order
Read the full Understand Terraform basics explanation →

Drag and drop the steps to set up remote state with Terraform Cloud in the correct order.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5
Question 15mediummatching
Read the full Understand Terraform basics explanation →

Match each Terraform feature to its description.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Maps real-world resources to configuration

Plugin to interact with a specific cloud or service API

Container for multiple resources used together

Defines where state snapshots are stored

Executes scripts on local or remote machine during creation/destruction

Question 16mediummatching
Read the full Understand Terraform basics explanation →

Match each Terraform provisioner to its typical use case.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Copy files to the remote resource

Run a script on the machine running Terraform

Run a script on the remote resource

Configure resource using Chef

Configure resource using Puppet

Question 17easymultiple choice
Read the full Understand Terraform basics explanation →

A developer runs terraform apply to create an AWS EC2 instance using an AMI sourced from the aws_ami data source with most_recent = true. Immediately after apply completes, the developer runs terraform plan again. The plan shows that Terraform intends to replace the EC2 instance. What is the most likely cause?

Question 18mediummultiple choice
Read the full Understand Terraform basics explanation →

A team is using Terraform to manage infrastructure across multiple environments (dev, test, prod). They want to reuse the same configuration but vary resource configurations like instance size and number of instances. Which Terraform feature should they use?

Question 19hardmultiple choice
Study the full AAA explanation →

A company has a monolithic Terraform configuration that manages all infrastructure. As the infrastructure grows, plan and apply times become very long. They want to break the configuration into smaller, independent units to improve performance and reduce blast radius. Which approach should they take?

Question 20easymultiple choice
Read the full Understand Terraform basics explanation →

A developer is new to Terraform and wants to understand the purpose of the terraform init command. Which statement correctly describes its primary function?

Question 21mediummultiple choice
Read the full Understand Terraform basics explanation →

A developer accidentally deletes the local terraform.tfstate file. The backend is configured to store state remotely in an S3 bucket. What is the effect on Terraform operations?

Question 22hardmultiple choice
Read the full Understand Terraform basics explanation →

A team uses Terraform with a remote backend that stores state in Azure Storage. A developer runs terraform apply and receives an error: 'Error refreshing state: state data in Azure Blob does not have expected content.' What is the most likely cause?

Question 23easymultiple choice
Read the full Understand Terraform basics explanation →

A developer wants to use the output of one Terraform configuration as input to another. Which Terraform feature should they use?

Question 24mediummultiple choice
Read the full Understand Terraform basics explanation →

A Terraform configuration uses a module from the Terraform Registry. The module's documentation states it requires Terraform version >= 0.14. The team is using Terraform 0.12. What should the developer do to use this module?

Question 25hardmultiple choice
Read the full Understand Terraform basics explanation →

A developer runs terraform plan and sees a large number of resources will be destroyed. They suspect the state file is corrupted. They have a recent backup of the state file. Which command can help recover the previous state from the backup?

Question 26easymulti select
Read the full Understand Terraform basics explanation →

Which two of the following are correct statements about Terraform providers?

Question 27mediummulti select
Read the full Understand Terraform basics explanation →

Which three of the following are valid ways to pass variable values to a Terraform configuration?

Question 28hardmulti select
Read the full Understand Terraform basics explanation →

Which three of the following are true regarding Terraform state?

Question 29easymultiple choice
Read the full Understand Terraform basics explanation →

Refer to the exhibit. What will happen when terraform plan is run?

Exhibit

resource "aws_s3_bucket" "example" {}
Question 30mediummultiple choice
Read the full Understand Terraform basics explanation →

Refer to the exhibit. What does this output indicate?

Exhibit

Output of `terraform state list`:
aws_instance.web
Question 31hardmultiple choice
Read the full Understand Terraform basics explanation →

Refer to the exhibit. What is the most likely cause of this error?

Exhibit

Error: Could not satisfy version constraint for provider hashicorp/aws: required version >= 3.0, installed version 2.70
Question 32mediummultiple choice
Read the full Understand Terraform basics explanation →

A team uses Terraform to manage AWS resources. They want to ensure that a security group is created before an EC2 instance that references it. What is the best practice?

Question 33easymultiple choice
Read the full Understand Terraform basics explanation →

What file extension is commonly used for Terraform configuration files?

Question 34hardmultiple choice
Read the full Understand Terraform basics explanation →

A developer runs `terraform apply` and gets the error: 'Error: No configuration files'. What is the most likely cause?

Question 35mediummultiple choice
Read the full Understand Terraform basics explanation →

A company wants to use Terraform to create Azure resources. They have written a configuration file but when they run `terraform init`, they get a warning about an 'incomplete lock file'. What should they do first?

Question 36easymultiple choice
Read the full Understand Terraform basics explanation →

In Terraform, which command is used to format configuration files according to the HCL canonical style?

Question 37hardmultiple choice
Read the full Understand Terraform basics explanation →

A Terraform configuration uses `count` to create multiple EC2 instances. After adding a new variable for instance type, the user runs `terraform plan` and sees that all instances are marked for recreation. What is the most likely cause?

Question 38mediummultiple choice
Read the full Understand Terraform basics explanation →

An organization uses Terraform with multiple workspaces to manage different environments (dev, staging, prod). They want to ensure that sensitive variables for prod are not exposed in the plan output. What should they do?

Question 39easymultiple choice
Read the full Understand Terraform basics explanation →

Which of the following commands creates an execution plan that shows what resources will be created, updated, or destroyed?

Question 40hardmultiple choice
Read the full Understand Terraform basics explanation →

A team manages infrastructure with Terraform. They recently updated the provider version in the configuration from 2.0 to 3.0. After running `terraform init`, they get errors that some resource arguments are no longer valid. What is the best approach to resolve this?

Question 41mediummulti select
Read the full Understand Terraform basics explanation →

Which TWO of the following are valid variable types in Terraform? (Choose two.)

Question 42hardmulti select
Read the full Understand Terraform basics explanation →

Which TWO of the following are valid ways to pass variable values to a Terraform configuration? (Choose two.)

Question 43mediummulti select
Read the full Understand Terraform basics explanation →

Which THREE of the following are characteristics of Terraform state? (Choose three.)

Question 44hardmultiple choice
Read the full NAT/PAT explanation →

Your team uses Terraform to manage a multi-region AWS deployment consisting of over 500 resources. The state file is stored in an S3 backend with DynamoDB locking. Recently, one of your colleagues accidentally deleted the state file from S3 while trying to clean up old backups. Fortunately, you have a backup from two days ago. However, after restoring the backup, you notice that several recent changes, including two new EC2 instances and a security group, are missing from the state. The actual resources still exist in AWS. You need to bring the state back in sync with the real-world infrastructure without recreating these resources. What should you do?

Question 45easymultiple choice
Read the full Understand Terraform basics explanation →

A team is new to Terraform and wants to manage their cloud infrastructure. They have written configuration files but have not yet run any commands. What is the correct sequence of initial steps to deploy their infrastructure?

Question 46mediummultiple choice
Read the full Understand Terraform basics explanation →

A DevOps engineer is working on a Terraform project that manages resources across multiple AWS accounts. To reduce duplication and ensure consistency, they want to define common configurations like provider settings and variable definitions in a separate location that can be reused across root modules. What feature should they use?

Question 47hardmulti select
Read the full Understand Terraform basics explanation →

A company is using Terraform to manage secrets in AWS Secrets Manager. They want to ensure that sensitive values are not exposed in logs, the console, or plan output. Which two practices should they implement? (Choose two.)

Question 48easymultiple choice
Read the full Understand Terraform basics explanation →

A junior engineer cloned a Terraform repository from GitHub and ran terraform init inside the project directory. The command downloaded the required provider plugins successfully. Next, they ran terraform plan and received the following error: 'Error: No configuration files found in the current directory.' The engineer checked and confirmed that the main.tf file exists in the current directory. What is the most likely cause of this error?

Question 49mediummultiple choice
Read the full Understand Terraform basics explanation →

An organization uses Terraform Cloud to manage their infrastructure. They have a workspace configured with a VCS-backed workflow connected to their GitHub repository. They recently added a new AWS provider version requirement in their configuration. After committing and pushing the change, they notice that the plan in Terraform Cloud fails with an error indicating that the provider version is not found. However, the engineer can run the same configuration locally with terraform init and plan successfully. What is the most likely reason for the failure in Terraform Cloud?

Question 50hardmultiple choice
Read the full Understand Terraform basics explanation →

A platform team manages a large Terraform codebase with hundreds of resources across multiple environments (dev, staging, prod). They use terraform workspaces to manage environment-specific state files. Recently, an engineer made changes to the production workspace but forgot to switch from the dev workspace before applying. The apply was successful, but now the production resources are in an inconsistent state. The team wants to recover the production state to match the actual infrastructure. The previous state file for production was backed up in an S3 bucket before the accidental apply. What is the best course of action?

Question 51easymulti select
Read the full Understand Terraform basics explanation →

Which TWO of the following statements about Terraform state are correct? (Choose two.)

Question 52mediummultiple choice
Read the full Understand Terraform basics explanation →

Refer to the exhibit. Which change to the configuration would prevent this error in the future?

Exhibit

Error: creating EC2 Instance: InvalidParameterValue: Value (ami-0c55b159cbfafe1f0) for parameter ami is invalid. Expected: 'ami-...'.

  on main.tf line 22, in resource "aws_instance" "web":
  22:   ami = "ami-0c55b159cbfafe1f0"
Question 53hardmultiple choice
Read the full Understand Terraform basics explanation →

A company uses Terraform to manage infrastructure across dev, staging, and production environments. They use Terraform workspaces to separate state files. The backend is configured with an S3 bucket for state storage and a DynamoDB table for state locking. Recently, the team has grown from 2 to 10 developers, and they frequently encounter the error: 'Error acquiring the state lock' when running terraform apply in quick succession. The error message includes: 'Lock Info: ID: ... Operation: Apply. Who: user@company.com. Version: 1.0.0. Created: ...' The error occurs intermittently, especially during peak deployment times. The DynamoDB table is configured with 5 read and 5 write capacity units. The team's current workflow involves multiple developers running apply on different workspaces simultaneously. Which course of action should the team take to minimize state locking errors?

Question 54hardmultiple choice
Read the full Understand Terraform basics explanation →

Refer to the exhibit. A user runs terraform init and receives an error about state data content. The state file in S3 has not been manually modified. What is the most likely cause?

Exhibit

$ terraform init

Initializing the backend...

Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.

Error refreshing state: state data in S3 does not have the expected content.
This may be due to a bug. If you are sure the state file is valid, run:
terraform force-unlock <lock_id>
Question 55mediummultiple choice
Read the full Understand Terraform basics explanation →

Refer to the exhibit. A user applies this configuration and then runs 'terraform state list'. Which resource addresses would appear in the output?

Exhibit

resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"

  tags = {
    Name = "WebServer"
  }
}

resource "aws_eip" "web" {
  instance = aws_instance.web.id
}
Question 56hardmultiple choice
Read the full Understand Terraform basics explanation →

Refer to the exhibit. An engineer runs 'terraform plan' and receives an error: 'Error refreshing state: state data in S3 does not have the expected content.' The state file exists and is not corrupted. What is the most likely cause?

Exhibit

terraform {
  backend "s3" {
    bucket         = "my-terraform-state"
    key            = "prod/terraform.tfstate"
    region         = "us-east-1"
    dynamodb_table = "terraform-locks"
    encrypt        = true
  }
}

resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"
}
Question 57mediummultiple choice
Read the full Understand Terraform basics explanation →

Refer to the exhibit. A user runs 'terraform plan' and sees this output. However, when they run 'terraform apply', they get an error: 'Error creating EC2 instance: UnauthorizedOperation: You are not authorized to perform this operation.' The user's IAM permissions allow ec2:RunInstances. What is the most likely missing permission?

Exhibit

$ terraform plan

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_instance.web will be created
  + resource "aws_instance" "web" {
      + ami                          = "ami-0c55b159cbfafe1f0"
      + instance_type                = "t2.micro"
      + tags                         = {
          + "Name" = "WebServer"
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.
Question 58hardmultiple choice
Read the full Understand Terraform basics explanation →

Refer to the exhibit. A user applies this configuration. They then run 'terraform destroy' but the destroy fails with an error: 'Error deleting load balancer: DependencyViolation: The load balancer 'arn:aws:elasticloadbalancing:...' cannot be deleted because it is currently associated with another resource.' The user has not made any changes to the resources. What is the most likely cause?

Exhibit

resource "aws_lb" "frontend" {
  name               = "frontend-alb"
  internal           = false
  load_balancer_type = "application"
  security_groups    = [aws_security_group.alb.id]
  subnets            = ["subnet-12345678", "subnet-87654321"]
}

resource "aws_lb_listener" "frontend_http" {
  load_balancer_arn = aws_lb.frontend.arn
  port              = 80
  protocol          = "HTTP"

  default_action {
    type = "forward"
    target_group_arn = aws_lb_target_group.frontend.arn
  }
}

resource "aws_lb_target_group" "frontend" {
  name     = "frontend-tg"
  port     = 80
  protocol = "HTTP"
  vpc_id   = "vpc-12345678"
}

Practice tests

Scored 10-question sessions with instant feedback and explanations.

TF-003 Practice Test 1 — 10 Questions→TF-003 Practice Test 2 — 10 Questions→TF-003 Practice Test 3 — 10 Questions→TF-003 Practice Test 4 — 10 Questions→TF-003 Practice Test 5 — 10 Questions→TF-003 Practice Exam 1 — 20 Questions→TF-003 Practice Exam 2 — 20 Questions→TF-003 Practice Exam 3 — 20 Questions→TF-003 Practice Exam 4 — 20 Questions→Free TF-003 Practice Test 1 — 30 Questions→Free TF-003 Practice Test 2 — 30 Questions→Free TF-003 Practice Test 3 — 30 Questions→TF-003 Practice Questions 1 — 50 Questions→TF-003 Practice Questions 2 — 50 Questions→TF-003 Exam Simulation 1 — 100 Questions→

Practice by domain

Each domain maps to a weighted exam section. Focus on the domain where you are weakest.

Understand IaC conceptsUnderstand Terraform basicsUnderstand Terraform's purposeUse Terraform outside the core workflowInteract with Terraform modulesUse the core Terraform workflowImplement and maintain stateRead, generate and modify configuration

Practice by scenario

Filter questions by type — troubleshooting, exhibit, drag-and-drop, PBQ, ACLs, OSPF, and more.

Browse scenarios→

Continue studying

All Understand Terraform basics setsAll Understand Terraform basics questionsTF-003 Practice Hub