Practice Terraform state vocabulary: state file tracking, remote state backends, DynamoDB locking, state corruption recovery, terraform state mv, drift detection, and importing existing resources.
0 / 10 completed
1 / 10
'The state file tracks all managed resources.' What happens if the state file is deleted?
The Terraform state file is the single source of truth about what infrastructure Terraform manages. Without it, Terraform doesn't know what it previously created. Running terraform apply without state would create duplicate resources (since Terraform thinks nothing exists). This is why remote state with backup is critical for any real infrastructure.
2 / 10
'Remote state in S3 with DynamoDB locking.' Why is DynamoDB locking needed?
When the state file is stored in S3, multiple team members could potentially run terraform apply at the same time — both reading the same state, both making changes, and both writing back a new state file, causing one to overwrite the other (state corruption). DynamoDB provides a distributed lock: the first apply operation acquires the lock, and any concurrent apply waits or fails with a lock error.
3 / 10
'Terraform state mv to reorganise resources.' What does terraform state mv do?
terraform state mv changes how a resource is addressed in the state file. For example, if you rename an AWS instance from aws_instance.web to aws_instance.frontend, terraform state mv aws_instance.web aws_instance.frontend updates the state reference so Terraform doesn't destroy the old resource and create a new one. It's essential for safe refactoring of Terraform code.
4 / 10
'The plan shows infrastructure drift.' What is infrastructure drift in Terraform?
Infrastructure drift occurs when cloud resources are modified outside of Terraform — by someone manually changing settings in the console, or by other automation tools. Running terraform plan detects drift by comparing the actual resource state (fetched from the provider) against what Terraform expects from its state and configuration. Drift appears as 'will be updated' or 'will be replaced' in the plan output.
5 / 10
'We import existing infrastructure into state.' When is terraform import used?
terraform import allows Terraform to begin managing infrastructure that was created outside of Terraform. You write the resource configuration block, then run terraform import to associate the existing cloud resource (identified by its provider ID) with that configuration in the state. After import, terraform plan should show no changes if the configuration matches the actual resource.
6 / 10
During a code review of a PR that applies a Terraform configuration to create a new VPC, Alice comments: 'Looks like you're relying heavily on the state file. Are you sure we should be storing the entire state locally? Shouldn't we consider using remote state with S3 for better collaboration and disaster recovery?' What does Alice *primarily* want to discuss regarding Terraform State?
Alice is raising concerns about the potential risks associated with storing Terraform state locally – specifically data loss if the local machine fails or conflicts arise during concurrent updates. She correctly identifies remote backends like S3 as a solution for collaboration, versioning, and resilience, which are crucial aspects of managing Terraform state effectively. Option A is too broad; while performance *can* be a factor, Alice's immediate concern is about data safety.
7 / 10
In a Slack channel dedicated to the 'Project Phoenix' Terraform deployment, Ben writes: 'Just ran `terraform plan` and got a huge output about changes to the security group rules. It's saying we need to open ports 80 and 443 on all subnets! I'm confused – why isn't Terraform just updating the existing state?' What is the *most likely* reason for this behavior?
Terraform's core function is to manage *declared* changes based on its understanding of the desired state. If someone manually modifies a resource (like opening ports in a security group) outside of Terraform's control, Terraform will detect this as a change and prompt for an update. Options B, C, and D are incorrect because they misinterpret Terraform's behavior—it doesn't proactively optimize or automatically fix issues without explicit instructions.
8 / 10
During a standup meeting, Maria says: 'We're using the `terraform state mv` command to move our infrastructure resources between different Terraform modules. This allows us to logically group related assets and keeps our state files cleaner.' What is the *primary* purpose of the terraform state mv command?
The terraform state mv command's core function is to *rearrange* the order of resources within a Terraform state file without altering the actual infrastructure itself. This improves organization and makes it easier to manage complex configurations by logically grouping related resources. Options A, C, and D describe other Terraform commands or features.
9 / 10
In a PR description for a change that updates the Terraform configuration to use a new remote state backend (S3), David writes: 'This update ensures our infrastructure configurations are automatically versioned and replicated across multiple regions.' What does David mean by 'automatically versioned and replicated' in the context of Terraform State?
David refers to the benefits provided by using a remote backend like S3 for Terraform state management. S3 inherently offers versioning and replication features, ensuring that multiple copies of the state file exist in different locations, which is crucial for redundancy and disaster recovery. Options A, C, and D describe related but distinct processes or technologies.
10 / 10
Sarah is investigating a Terraform plan that shows infrastructure drift. The plan indicates that a database instance has been unexpectedly upgraded to a newer version and some network rules have changed. What does 'infrastructure drift' generally refer to in the context of Terraform?
Infrastructure drift describes the situation where the *actual* state of your infrastructure deviates from what's defined in your Terraform configuration – typically due to manual changes or errors. This is a critical concern because it can lead to inconsistencies and unexpected behavior. Options A, C, and D represent legitimate actions within Terraform, but don't explain the core concept of drift.
What does this Terraform Operations exercise cover?
This exercise, "Terraform State Vocabulary", tests your understanding of terraform operations vocabulary and phrasing through 10 multiple-choice questions drawn from real workplace scenarios.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is completely free — no account, sign-up, or payment required.
How many questions does this exercise have?
This exercise has 10 questions. Each one presents a realistic sentence or scenario with multiple-choice options and an explanation once you answer.
What happens after I answer a question?
You'll see immediate feedback showing whether your answer was correct, along with a short explanation of why — then a button to move to the next question.
Can I retry the exercise if I get questions wrong?
Yes. Once you reach the results screen, click "Try again" to reset your answers and go through the exercise from the start as many times as you like.
Do I need to create an account to take this exercise?
No account is needed. Your answers are scored in your browser during the session — nothing is saved to a server, so you can jump straight in.
Is my progress saved if I leave the page?
No — progress within an exercise resets if you navigate away or reload. Each exercise is short enough to complete in a few minutes in one sitting.
Who is this Terraform Operations exercise for?
It's designed for IT professionals and learners who want to sound natural discussing terraform operations topics in English — useful for meetings, documentation, interviews, and day-to-day communication with English-speaking teams.
How is this different from reading a glossary or blog article?
Exercises like this one are active recall drills — you have to choose the correct term or phrasing yourself, which builds retention faster than passively reading a definition.
Where can I find more Terraform Operations exercises?
Browse the full Terraform Operations exercises hub for more practice, or explore other exercise categories covering vocabulary, grammar, interviews, and workplace communication.