A developer runs terraform plan and sees the output:
Plan: 3 to add, 1 to change, 0 to destroy.
What does this output communicate to the team?
terraform plan previews changes without making them. The summary line uses three counters:
Counter
Meaning
Symbol in plan output
to add
New resources to be created
+
to change
Existing resources to be modified in-place
~
to destroy
Resources to be deleted
-
no-op — a resource Terraform checked but found no changes needed
in-place update — modification without destroying the resource (e.g. changing a tag)
destroy and recreate (replacement) — some attribute changes force the resource to be deleted and recreated (e.g. changing an EC2 AMI ID)
Understanding plan output is essential for IaC code reviews — reviewers should always check for unexpected destroys before approving.
2 / 15
A team member says: "The Terraform state file contains a complete record of the infrastructure."
What does the Terraform state file actually represent?
Terraform state (.tfstate) is Terraform's model of reality. It stores: resource IDs, attribute values captured at last apply, and inter-resource dependencies.
Concept
Explanation
state refresh
Terraform queries the real cloud API to update the state file with current resource attributes
state drift
When real infrastructure diverges from what the state file records (e.g. manual console changes)
remote state
State stored in S3, GCS, or Terraform Cloud rather than a local file — required for team collaboration
state lock
Prevents two concurrent applies from corrupting the state file simultaneously
Security note: Never commit state to Git — it may contain secrets (database passwords, private keys) in plaintext.
3 / 15
A DevOps engineer says: "I ran terraform import on the existing RDS instance."
What does terraform import do?
terraform import tells Terraform about a resource that was created manually or by another tool. The workflow:
Write the corresponding resource block in your .tf configuration
Run terraform import <resource_address> <cloud_resource_id>
Run terraform plan to verify the configuration matches the real resource (zero diff)
Term
Meaning
bringing resources under management
The process of making Terraform responsible for a pre-existing resource
resource address
The Terraform identifier: aws_db_instance.main
generated configuration
In TF 1.5+, terraform plan -generate-config-out=generated.tf writes the .tf block for you
4 / 15
A pull request description says: "This adds a lifecycle { prevent_destroy = true } block to the production database resource."
What does this configuration enforce?
prevent_destroy = true causes Terraform to return an error if any plan operation would destroy this resource, even if destruction is triggered by another change (e.g. replacing a module).
lifecycle meta-argument
Effect
prevent_destroy = true
Error on any plan that would destroy this resource
create_before_destroy = true
Create the replacement before destroying the old resource (zero-downtime replacement)
ignore_changes = [attribute]
Ignore drift for specified attributes (e.g. tags managed outside Terraform)
replace_triggered_by
Force replacement of this resource when another resource changes
Typical candidates for prevent_destroy: production RDS instances, S3 state buckets, KMS keys, VPCs.
5 / 15
A DevOps engineer says: "We use Terraform workspaces to manage dev, staging, and prod environments from a single configuration."
What is a Terraform workspace?
A Terraform workspace is a named state slice within the same backend. terraform workspace new staging creates a separate state file for staging while using the same .tf configuration.
Approach
Isolation level
Best for
Workspaces
Separate state, shared backend and code
Lightweight environment variants with near-identical configs
Separate state backends
Fully isolated state and backend
Production environments requiring strict blast-radius isolation
Separate directories
Isolated code, state, and backend
Environments with significant configuration differences
Best practice: For production, use separate state backends and/or directories. Workspaces are suitable for dev/test variants — not as a substitute for proper environment isolation.
6 / 15
Sarah, a junior developer, is reviewing a pull request that uses Terraform to deploy a new AWS S3 bucket. The PR description includes the following block: resource "aws_s3_bucket" "example" { bucket = "my-unique-bucket-name"}
Mark, the senior engineer, comments: 'Could you explain what's happening with this bucket attribute? I'm not entirely sure why it needs to be explicitly defined like that.' What is Mark most likely referring to?
Mark is questioning the explicit definition of the bucket attribute. While Terraform handles much of this behind the scenes, explicitly defining it – particularly a unique name – is crucial to prevent naming conflicts across AWS accounts and regions. The bucket parameter controls the S3 bucket's creation and configuration.
7 / 15
During a standup meeting, David, a DevOps engineer, says: 'We're using Terraform modules to break down our infrastructure deployments into reusable components. This allows us to quickly spin up new environments for testing and development.' What is the primary benefit of utilizing Terraform modules in this scenario?
David is highlighting the core advantage of Terraform modules: they promote reusability and modularity. By encapsulating related resources (e.g., a database configuration), modules reduce redundancy, improve maintainability, and simplify deployment across different environments – especially when variations exist.
8 / 15
You receive the following Slack message from a teammate: 'I'm trying to use Terraform to deploy a new Kubernetes cluster, but I'm getting errors related to network policies. I need to ensure that traffic is allowed between specific pods.' What is the most relevant concept to address this issue within your Terraform configuration?
While Terraform can manage some aspects of networking (e.g., VPCs), it doesn't directly define Kubernetes network policies. Kubernetes handles its own networking configuration through manifests and related tools. Terraform primarily focuses on provisioning the *infrastructure* upon which the Kubernetes cluster runs – the control plane and worker nodes.
9 / 15
A pull request description states: 'We're adding a lifecycle block to our EC2 instance resource definition to prevent accidental deletion during updates.' What is the purpose of this configuration?
The lifecycle block with prevent_destroy = true is a powerful feature. It prevents Terraform from automatically deleting the EC2 instance during a plan or destroy operation – this is critical for maintaining desired state and preventing unintended consequences of infrastructure changes. This allows you to schedule updates and maintenance tasks.
10 / 15
During a code review discussion, Liam asks: 'How does Terraform handle dependencies between resources?' What is the most accurate explanation?
Terraform's core strength lies in its dependency resolution. When you define a resource that depends on another (e.g., a database dependent on a VPC), Terraform automatically determines the correct order of operations – first creating the VPC, then creating the database within it. This ensures all dependencies are satisfied before any resources are fully deployed.
11 / 15
Sarah, a junior developer, is reviewing a pull request that uses Terraform to deploy a new AWS S3 bucket. The PR description includes the following block: resource "aws_s3_bucket" "example" { bucket = "my-unique-bucket-name"}
Mark, the senior engineer, comments: 'Could you explain what's happening with this bucket attribute? I'm not entirely sure why it needs to be explicitly defined like that.' What is Mark most likely referring to?
Mark is questioning the explicit definition of the bucket attribute. While Terraform handles much of this behind the scenes, explicitly defining it – particularly a unique name – is crucial to prevent naming conflicts across AWS accounts and regions. The bucket parameter controls the S3 bucket's creation and configuration.
12 / 15
During a standup meeting, David, a DevOps engineer, says: 'We're using Terraform modules to break down our infrastructure deployments into reusable components. This allows us to quickly spin up new environments for testing and development.' What is the primary benefit of utilizing Terraform modules in this scenario?
David is highlighting the core advantage of Terraform modules: they promote reusability and modularity. By encapsulating related resources (e.g., a database configuration), modules reduce redundancy, improve maintainability, and simplify deployment across different environments – especially when variations exist.
13 / 15
You receive the following Slack message from a teammate: 'I'm trying to use Terraform to deploy a new Kubernetes cluster, but I'm getting errors related to network policies. I need to ensure that traffic is allowed between specific pods.' What is the most relevant concept to address this issue within your Terraform configuration?
While Terraform can manage some aspects of networking (e.g., VPCs), it doesn't directly define Kubernetes network policies. Kubernetes handles its own networking configuration through manifests and related tools. Terraform primarily focuses on provisioning the *infrastructure* upon which the Kubernetes cluster runs – the control plane and worker nodes.
14 / 15
A pull request description states: 'We're adding a lifecycle block to our EC2 instance resource definition to prevent accidental deletion during updates.' What is the purpose of this configuration?
The lifecycle block with prevent_destroy = true is a powerful feature. It prevents Terraform from automatically deleting the EC2 instance during a plan or destroy operation – this is critical for maintaining desired state and preventing unintended consequences of infrastructure changes. This allows you to schedule updates and maintenance tasks.
15 / 15
During a code review discussion, Liam asks: 'How does Terraform handle dependencies between resources?' What is the most accurate explanation?
Terraform's core strength lies in its dependency resolution. When you define a resource that depends on another (e.g., a database dependent on a VPC), Terraform automatically determines the correct order of operations – first creating the VPC, then creating the database within it. This ensures all dependencies are satisfied before any resources are fully deployed.
What will I practise in "Terraform Core Vocabulary Exercises"?
Practice English for Terraform workflows: plan output, state file concepts, terraform import, lifecycle meta-arguments, and Terraform workspace vocabulary for DevOps and platform engineers.
How many exercises are in this module?
This module has 15 multiple-choice exercises, each with instant feedback and a full explanation of the correct answer.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free to use with no account, sign-up, or paywall.
Do I need to create an account to do these exercises?
No account is required. Just click an option to answer — your score for this session is tracked automatically in the progress bar above.
What happens if I choose the wrong answer?
You'll immediately see which answer was correct, plus a full explanation covering the vocabulary and reasoning behind it — mistakes are where most of the learning happens.
Can I retry the exercises if I want a higher score?
Yes — use the "Try again" button on the results screen to reset and go through all the questions again.
Is my progress saved if I close the page?
No. Progress is tracked only for your current visit; reloading or leaving the page resets the counter. This keeps the exercise simple and account-free.
Where can I find more Infrastructure as Code exercises?
Browse the full Infrastructure as Code hub for related drills, or check the "Next up" link below to continue with a connected topic.
How is this different from reading an article on the same topic?
Articles explain vocabulary and concepts in prose; this exercise tests and reinforces that vocabulary through active recall with immediate feedback — the two work best together.
Who writes these exercises?
Every exercise is written by the CoderSlingo team, drawing on real workplace English used in IT roles, then reviewed for accuracy and clarity.