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.

← Implement and maintain state practice sets

TF-003 Implement and maintain state • Complete Question Bank

TF-003 Implement and maintain state — All Questions With Answers

Complete TF-003 Implement and maintain state question bank — all 0 questions with answers and detailed explanations.

73
Questions
Free
No signup
Certifications/TF-003/Practice Test/Implement and maintain state/All Questions
Question 1mediummultiple choice
Read the full Implement and maintain state explanation →

A team is using a remote backend in Terraform Cloud. After a failed apply, the state file is locked. The team lead wants to unlock the state immediately. What should be done?

Question 2hardmultiple choice
Read the full Implement and maintain state explanation →

An organization uses Terraform with AWS S3 backend and DynamoDB for state locking. During a plan, you receive an error: 'Error acquiring the state lock'. The lock information in DynamoDB shows a lock from a previous session that crashed. What is the most appropriate next step?

Question 3easymultiple choice
Read the full Implement and maintain state explanation →

A developer is working on a Terraform configuration that manages a single resource. They want to import an existing AWS EC2 instance into state. Which command should they use?

Question 4mediummultiple choice
Read the full Implement and maintain state explanation →

A team uses Terraform Cloud workspaces to manage multiple environments. They notice that the state file for the production workspace is stored in a different backend than the development workspace. Which Terraform feature allows different workspaces to use different backends?

Question 5hardmultiple choice
Read the full Implement and maintain state explanation →

After running terraform apply, you see the error: 'Error: Error loading state: state snapshot was created by Terraform v0.12.0, but this is Terraform v1.2.0'. What should you do to resolve this?

Question 6easymultiple choice
Read the full Implement and maintain state explanation →

A user wants to remove a specific resource from Terraform state without destroying the actual infrastructure. Which command should they use?

Question 7mediummultiple choice
Read the full Implement and maintain state explanation →

A company uses Terraform to manage infrastructure across multiple AWS accounts. They want to use a single S3 bucket to store state files for all accounts, but ensure that state files are isolated per account. What is the best approach?

Question 8mediummulti select
Read the full Implement and maintain state explanation →

Which TWO of the following are valid methods to share data between Terraform configurations?

Question 9hardmulti select
Read the full Implement and maintain state explanation →

Which THREE of the following are best practices for managing Terraform state?

Question 10mediummulti select
Read the full Implement and maintain state explanation →

Which TWO of the following are true about Terraform workspaces?

Question 11hardmultiple choice
Read the full Implement and maintain state explanation →

You are a DevOps engineer at a company that uses Terraform to manage infrastructure in AWS. The team recently adopted Terraform Cloud for remote state management and collaboration. They have a single workspace named 'production' that manages all production resources. Currently, the state file is stored in Terraform Cloud's default backend. The team wants to implement a disaster recovery strategy where they can restore the state file if Terraform Cloud experiences an outage. They also want to ensure that state file backups are taken automatically before every apply. Which approach should they recommend?

Question 12mediummultiple choice
Read the full Implement and maintain state explanation →

A team manages infrastructure with Terraform and uses a remote backend in an S3 bucket. After a recent state migration, a developer runs 'terraform plan' and gets an error: 'Error: Error loading state: NoSuchKey: The specified key does not exist.' The developer confirms that the state file exists in the bucket. What is the most likely cause?

Question 13hardmultiple choice
Read the full Implement and maintain state explanation →

An organization uses Terraform with the AzureRM backend. The team recently split a large configuration into multiple smaller configurations, each with its own state file. They want to share outputs from one configuration (networking) as inputs to another (compute). Which approach should they use to reference the networking state from the compute configuration without duplicating data?

Question 14easymulti select
Read the full Implement and maintain state explanation →

Which TWO of the following are valid reasons to use Terraform state?

Question 15hardmultiple choice
Read the full Implement and maintain state explanation →

You are a DevOps engineer for a company that uses Terraform to manage infrastructure across multiple AWS accounts (production, staging, development). Each account has its own Terraform configuration and remote state stored in an S3 bucket with DynamoDB locking. Recently, the production deployment pipeline failed with the error: 'Error: Error loading state: AccessDenied: Access Denied'. The pipeline runs under an IAM role that has been working for months. The S3 bucket policy and IAM role permissions have not been changed. However, the team did recently enable S3 bucket versioning and added a lifecycle policy to transition objects to Glacier after 30 days. The state file was last modified 35 days ago. What is the most likely cause of the error?

Question 16easymultiple choice
Read the full Implement and maintain state explanation →

A team is using a shared backend for Terraform state. After running terraform apply, the state file is locked for an extended period, causing other team members to fail with 'Error acquiring the state lock'. What is the most likely cause?

Question 17mediummulti select
Read the full Implement and maintain state explanation →

Which THREE actions should be taken when migrating Terraform state from local to a remote backend?

Question 18mediummulti select
Read the full Implement and maintain state explanation →

Which four of the following statements about Terraform state management are correct? (Choose all that apply. There are four correct answers.)

Question 19mediumdrag order
Read the full Implement and maintain state explanation →

Drag and drop the steps to use Terraform modules from the registry 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 20mediummatching
Read the full Implement and maintain state explanation →

Match each Terraform state command to its action.

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

Concepts
Matches

List resources in the state

Show details of a single resource in state

Move an item in the state

Remove an item from the state

Download current state from backend

Question 21easymultiple choice
Read the full Implement and maintain state explanation →

A company uses Terraform with an S3 backend. A user accidentally deletes the state file. What is the best practice to recover the state?

Question 22mediummultiple choice
Read the full Implement and maintain state explanation →

A developer runs `terraform apply` and receives the error: 'Error acquiring the state lock'. Another engineer is currently running `terraform plan`. What should the developer do?

Question 23hardmultiple choice
Read the full Implement and maintain state explanation →

In a CI/CD pipeline, Terraform state is stored in Terraform Cloud. A pipeline run fails with the error: 'State version conflict'. What is the most likely cause?

Question 24mediummultiple choice
Read the full Implement and maintain state explanation →

An organization uses a shared remote backend. They want to prevent concurrent apply operations that could corrupt the state. What built-in mechanism does Terraform provide?

Question 25hardmultiple choice
Read the full Implement and maintain state explanation →

After running `terraform state mv` to rename a resource, the resource's state binding is lost and the resource cannot be managed. Which command should be run to restore the state binding?

Question 26easymultiple choice
Read the full Implement and maintain state explanation →

What is the purpose of the `terraform state list` command?

Question 27mediummultiple choice
Read the full Implement and maintain state explanation →

A user wants to inspect the current attributes of a specific resource in the Terraform state. Which command should they use?

Question 28hardmultiple choice
Read the full Implement and maintain state explanation →

A team uses a Consul backend for Terraform state. They want to encrypt state at rest. What should they do?

Question 29easymultiple choice
Read the full Implement and maintain state explanation →

Which of the following is NOT a valid backend type for storing Terraform state?

Question 30easymulti select
Read the full Implement and maintain state explanation →

Which THREE of the following are valid strategies to migrate Terraform state from a local backend to a remote backend?

Question 31mediummulti select
Read the full Implement and maintain state explanation →

Which TWO actions will cause Terraform to update the state file?

Question 32hardmulti select
Read the full Implement and maintain state explanation →

Which TWO statements are correct about Terraform state when using the S3 backend with DynamoDB for state locking?

Question 33easymultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. What does the output indicate?

Exhibit

$ terraform state list
aws_vpc.main
aws_subnet.public
aws_instance.web
Question 34mediummultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. A developer runs `terraform apply` but receives an error that the state file is locked. Which of the following is a likely cause?

Exhibit

terraform {
  backend "s3" {
    bucket = "my-company-terraform-state"
    key    = "prod/terraform.tfstate"
    region = "us-east-1"
    encrypt = true
  }
}
Question 35hardmultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. An engineer sees this error. Which command should they run to force-unlock?

Exhibit

Error: Error acquiring the state lock

Error message: ConditionalCheckFailedException: The conditional request failed
Lock Info:
  ID:        123456
  Path:      my-company-terraform-state/prod/terraform.tfstate
  Operation: OperationTypeApply
  Who:       jenkins@ci
  Version:   1.0.0
  Created:   2023-01-15 10:00:00.123456789 +0000 UTC
  Info:      terraform apply from pipeline
Question 36easymultiple choice
Read the full Implement and maintain state explanation →

A user runs `terraform apply` and receives an error: 'Error acquiring the state lock'. What is the most likely cause?

Question 37mediummultiple choice
Read the full Implement and maintain state explanation →

A team uses an S3 backend with DynamoDB locking. They accidentally delete the DynamoDB table used for state locking. What is the immediate consequence?

Question 38hardmultiple choice
Read the full Implement and maintain state explanation →

An organization uses Terraform Cloud workspaces to manage multiple environments. They notice that after promoting a configuration change from development to production workspace, the production workspace's state file contains references to resources that were only created in development. What is the most likely cause?

Question 39easymultiple choice
Read the full Implement and maintain state explanation →

A user wants to use a remote state backend for the first time. After adding the backend configuration, which command must they run to migrate the state from local to remote?

Question 40mediummultiple choice
Read the full Implement and maintain state explanation →

During a deployment, a user runs `terraform apply` but the command fails because the state lock cannot be acquired. They suspect the lock was released after the previous `apply` but is still held. What command can they use to force unlock the state?

Question 41hardmultiple choice
Read the full Implement and maintain state explanation →

A Terraform state file is stored in an S3 bucket with versioning enabled. During a deployment, the state file becomes corrupted due to a network error. What is the best way to recover?

Question 42easymultiple choice
Read the full Implement and maintain state explanation →

Which command can be used to see the current state of a specific resource in the Terraform state?

Question 43mediummultiple choice
Read the full Implement and maintain state explanation →

A team uses a remote state backend with partial configuration. They have a `backend` block with only the `bucket` attribute, and the rest of the backend configuration is provided via CLI during `terraform init`. Which of the following best describes the purpose of partial configuration?

Question 44hardmultiple choice
Read the full Implement and maintain state explanation →

A user runs `terraform plan` and notices that the plan includes 'Outgoing changes' for a number of resources that were not modified in the configuration. What is the most likely cause?

Question 45easymulti select
Read the full Implement and maintain state explanation →

Which two statements about Terraform state files are true? (Choose two.)

Question 46mediummulti select
Read the full Implement and maintain state explanation →

Which three of the following are valid command-line operations that modify the Terraform state? (Choose three.)

Question 47hardmulti select
Read the full Implement and maintain state explanation →

A team uses an S3 backend for state storage with DynamoDB locking. They want to migrate to a new S3 bucket. Which two steps are necessary to perform a successful state migration? (Choose two.)

Question 48mediummultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. A user runs `terraform state list` and receives the output shown. The configuration defines an `aws_instance.web` resource with count = 3 and an `aws_s3_bucket.data` resource. After some changes, the user runs `terraform plan` and sees that the plan wants to create a new `aws_instance.web[2]` and destroy the existing `aws_instance.web[2]`. What is the most likely cause?

Exhibit

$ terraform state list
aws_instance.web[0]
aws_instance.web[1]
aws_instance.web[2]
aws_s3_bucket.data
Question 49easymultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. A user has this backend configuration. The user then runs `terraform init` and receives an error: 'NoSuchBucket: The specified bucket does not exist'. What is the most likely cause?

Exhibit

terraform {
  backend "s3" {
    bucket         = "my-company-state-bucket"
    key            = "dev/terraform.tfstate"
    region         = "us-east-1"
    encrypt        = true
    dynamodb_table = "tf-lock-table"
  }
}
Question 50hardmultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. A user runs `terraform plan` and receives this error. The user is using a local backend. Which of the following is the most likely cause?

Exhibit

Error: Error loading state: 
    Terraform state file does not exist.
Question 51easymultiple choice
Read the full Implement and maintain state explanation →

A team uses an S3 backend for Terraform state. During a `terraform apply`, another team member accidentally runs a plan that also modifies the same state. Which feature prevents state corruption in this scenario?

Question 52mediummultiple choice
Read the full Implement and maintain state explanation →

An organization stores state files in an S3 backend with encryption. However, some resource attributes (e.g., database passwords) are stored in plaintext within the state. What is the recommended approach to avoid storing sensitive values in state?

Question 53hardmultiple choice
Read the full Implement and maintain state explanation →

A team is migrating from local state to an S3 remote backend. They have existing state files in the working directory. After configuring the backend block and running `terraform init`, what is the correct next step to migrate the existing state?

Question 54easymultiple choice
Read the full Implement and maintain state explanation →

After making manual changes to an AWS resource via the console, a Terraform user wants to update the state file to reflect those changes without modifying infrastructure. Which command should they run?

Question 55mediummultiple choice
Read the full Implement and maintain state explanation →

An organization uses Terraform workspaces to manage multiple environments (dev, staging, prod) with the same configuration. What is the primary benefit of using workspaces for state management?

Question 56hardmultiple choice
Read the full Implement and maintain state explanation →

A user accidentally ran `terraform state rm` on a critical resource, removing it from state but not destroying the actual infrastructure. Later, they need to re-import the resource. Which sequence of commands correctly accomplishes this?

Question 57mediummulti select
Read the full Implement and maintain state explanation →

Which TWO of the following are required when configuring a Terraform backend for remote state storage?

Question 58mediummulti select
Read the full Implement and maintain state explanation →

Which THREE of the following are best practices for Terraform state management in a team environment?

Question 59hardmulti select
Read the full Implement and maintain state explanation →

Which TWO of the following are valid methods to acquire a state lock in Terraform Cloud?

Question 60mediummultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. A Terraform configuration includes an `aws_instance.web` resource. The state shows the instance with a specific AMI and instance type. After running `terraform plan`, Terraform reports no changes. However, an engineer observes that the actual instance in AWS has a different AMI ID but the same instance type. What is the most likely cause?

Exhibit

Refer to the exhibit.

```
$ terraform show
# data.aws_ami.ubuntu
id = "ami-0c55b159cbfafe1f0"
# aws_instance.web
resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"
  tags = {
    Name = "WebServer"
  }
}
```
Question 61hardmultiple choice
Read the full Implement and maintain state explanation →

Your organization uses Terraform Cloud with a remote execution mode. There are two workspaces: `app-prod` and `app-staging`. The state for `app-prod` is stored in the `prod` workspace, and `app-staging` in the `staging` workspace. Recently, a new developer joined the team and tried to run `terraform plan` locally for the `app-staging` workspace. They received an error: "S3Backend bucket 'my-company-tf-state' does not exist." The developer is not using Terraform Cloud locally. The team uses a remote backend configuration with Terraform Cloud. What is the most likely cause?

Question 62mediummultiple choice
Read the full Implement and maintain state explanation →

A DevOps engineer manages infrastructure with Terraform using an S3 backend with DynamoDB locking. During a `terraform apply`, the engineer's network connection drops. After reconnecting, they run `terraform plan` and get an error: "Error acquiring the state lock." The lock is from the previous session. The engineer has verified that no other operations are running. What is the appropriate next step to proceed?

Question 63hardmultiple choice
Read the full Implement and maintain state explanation →

A company manages multiple microservices across AWS accounts. Each service has its own Terraform configuration and state file stored in a shared S3 bucket. The team uses `terraform_remote_state` data sources to read outputs from other services' state files. A service team recently changed the output structure in their state, breaking the `terraform_remote_state` calls from other services. The affected services now show errors during plan. What is the best practice to avoid such cross-service dependency issues?

Question 64mediummultiple choice
Read the full Implement and maintain state explanation →

A team uses Terraform with the `azurerm` backend. A junior engineer accidentally deletes the state file from the storage container. The team has a backup from 2 hours ago in a different container. What is the correct procedure to recover from this state loss?

Question 65easymultiple choice
Read the full Implement and maintain state explanation →

A new developer joins a project that uses Terraform with a remote backend in GCS (Google Cloud Storage). They clone the repository and run `terraform init` successfully. However, when they run `terraform plan`, they get an error: "Error loading state: AccessDenied: 403 my-project-terraform-state@my-project.iam.gserviceaccount.com does not have storage.objects.get access to the Google Cloud Storage bucket." What is the most likely resolution?

Question 66easymultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. A developer modifies the configuration by changing the resource name from 'aws_instance.web' to 'aws_instance.web2'. After running terraform plan, the output indicates that a new resource 'aws_instance.web2' will be created, but no resource will be destroyed. What should the developer do to update the state to match the configuration?

Exhibit

$ terraform state list
aws_instance.web
aws_security_group.sg
Question 67mediummulti select
Read the full Implement and maintain state explanation →

Which TWO statements about Terraform state locking are correct?

Question 68mediummultiple choice
Read the full Implement and maintain state explanation →

A team of five engineers manages infrastructure using Terraform with remote state stored in an S3 bucket and state locking via a DynamoDB table. After a power outage, an engineer notices that a terraform apply command fails with the message: 'Error: Error acquiring the state lock'. The engineer suspects that a lock from a previous run has not been released. The team needs to proceed with applying changes. Which action should the engineer take to resolve the issue safely?

Question 69hardmultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. A developer runs terraform plan and receives this error. What should the developer do to resolve the error?

Exhibit

Error: Backend initialization required: please run "terraform init"

Reason: Backend configuration has changed.

The configured backend "s3" has changed since the last "terraform init".
Previous configuration:
  bucket = "prod-terraform-state"
  key    = "network/terraform.tfstate"
  region = "us-east-1"

New configuration:
  bucket = "prod-terraform-state"
  key    = "network/terraform.tfstate"
  region = "us-west-2"
Question 70hardmultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. A team member receives this error when running terraform apply. What is the most likely cause?

Exhibit

Error: Error acquiring the state lock

Lock Info:
  ID:        1234567890abcdef
  Path:      terraform.tfstate
  Operation: OperationTypeInvalid
  Who:       user@hostname
  Version:   1.0.0
  Created:   2023-01-15 10:30:00.000000000 +0000 UTC
  Info:      

Terraform acquires a state lock to protect the state from being written
by multiple users at the same time. Please resolve the issue and try again.
If you have access to the backend, you may be able to unlock
it manually by running "terraform force-unlock <lock-id>".
Question 71hardmultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. A developer updates the network state and runs terraform apply. The aws_instance.web is not recreated. Which statement explains this behavior?

Exhibit

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

  tags = {
    Name = "WebServer"
  }
}

# Remote state data source
data "terraform_remote_state" "network" {
  backend = "s3"
  config = {
    bucket = "mycompany-terraform-state"
    key    = "network/terraform.tfstate"
    region = "us-east-1"
  }
}

resource "aws_security_group" "web_sg" {
  name_prefix = "web-sg-"
  vpc_id      = data.terraform_remote_state.network.outputs.vpc_id
}
Question 72hardmultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. A developer creates a new Terraform configuration with this backend block and runs terraform init. What will happen?

Exhibit

Error: Backend configuration block requires a backend type

  on main.tf line 1, in terraform:
   1: terraform {
   2:   backend "s3" {
   3:   }
   4: }

An argument named "region" or "bucket" is required.
Question 73hardmultiple choice
Read the full Implement and maintain state explanation →

Refer to the exhibit. A developer runs terraform plan and sees "No changes". However, the developer knows that manual changes were made to the infrastructure outside Terraform. What is the most likely reason terraform plan does not detect the drift?

Exhibit

$ terraform init
Initializing the backend...

Successfully configured the backend "s3"! Terraform will automatically
use this backend for state storage.

Initializing provider plugins...
- Finding latest version of hashicorp/aws...
- Installing hashicorp/aws v4.0.0...
- Installed hashicorp/aws v4.0.0 (signed by HashiCorp)

Terraform has been successfully initialized!

$ terraform plan

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration
and found no differences, so no changes are needed.

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 Implement and maintain state setsAll Implement and maintain state questionsTF-003 Practice Hub