TF-004 · domain
Use Terraform outside the core workflow
This domain covers running Terraform beyond the local CLI: remote backends (S3, Terraform Cloud), state locking with DynamoDB, workspaces, and CI/CD automation. Questions present realistic pipeline failures—lock acquisition errors, interrupted applies, concurrent jobs—and ask for the correct operational response using Terraform commands and backend configuration.
Focused practice
Practice Use Terraform outside the core workflow questions
Scored sessions drawing only from this domain — pick a length below.
Start 20-question practice test →What this domain covers
What to know about Use Terraform outside the core workflow
Be able to configure an S3 backend with DynamoDB locking, diagnose lock errors, and safely clear a stale lock with terraform force-unlock. The key skill is knowing when a lock is genuinely stale versus actively held, and never bypassing locking by editing backend resources directly.
Configuring S3 remote backend with DynamoDB state locking table
Using terraform force-unlock to release a stale state lock
Running terraform init, plan, and apply non-interactively in CI/CD
Managing multiple workspaces and isolating state per environment
Watch out for
Common Use Terraform outside the core workflow exam traps
- ▸Deleting or editing the DynamoDB lock item manually instead of using terraform force-unlock, risking state corruption.
- ▸Assuming terraform apply resumes automatically after failure; you must re-run plan/apply to reconcile partial state.
- ▸Sharing one state file across concurrent CI jobs or workspaces, causing repeated lock contention and failures.
Question index
All Use Terraform outside the core workflow questions (80)
Click any question to see the full explanation, or start a practice session above.
A team needs to share a Terraform module across multiple projects within their organization. What is the best practice?
Easy2What is the purpose of the 'terraform validate' command?
Easy3Refer to the exhibit. An operator runs terraform plan and gets the following output. They have not modified the Terraform configuration since the last successful apply. What is the most likely cause of the planned changes?
Medium4Which THREE of the following are capabilities of Terraform Cloud's Sentinel policy framework? (Choose three.)
Hard5Which THREE of the following are necessary steps to configure OIDC (OpenID Connect) for authenticating Terraform in a CI/CD pipeline?
Hard6A company uses Terraform to manage multi-cloud infrastructure. They have separate Terraform configurations for AWS and Azure, each with its own state file. They want to share a common set of networking variables (e.g., allowed IP ranges) between these configurations without duplicating data. Which approach best achieves this?
Hard7Which THREE of the following are best practices for Terraform state management?
Medium8Your team stores Terraform state in an AWS S3 bucket and uses DynamoDB for state locking. A junior engineer runs `terraform apply` locally while a CI pipeline is also running `terraform apply` against the same state. The apply succeeds in both cases, but the resulting infrastructure is inconsistent and resources are missing from state. What is the most likely cause?
Medium9A company uses Terraform Cloud and wants to enforce policy checks before any apply. They have a set of Sentinel policies. Where should they configure these policies to run automatically on all runs?
Medium10Refer to the exhibit. A user encounters this error while running 'terraform plan'. What is the best course of action?
Hard11An organization wants to use Terraform to manage infrastructure in multiple environments (dev, staging, prod) with the same configuration but different variable values. Which approach should they use?
Medium12Which THREE are valid methods to create and manage Terraform workspaces?
Medium13A team is using Terraform Cloud and wants to enforce that all AWS resources created by Terraform have a specific tag. Which feature should they use?
Medium14A team uses Terraform Cloud for remote state management. They want to ensure that state file changes are only made through the Terraform Cloud API and not through direct access to the storage backend. Which feature should they enable?
Medium15An operator runs `terraform apply` and receives an error that the state file is locked. What is the most likely cause?
Easy16Which TWO are valid methods to import existing infrastructure into Terraform?
Medium17A team has a monolithic Terraform configuration managing multiple AWS accounts. They want to decompose it into smaller configurations that can be managed independently. What is the recommended strategy?
Hard18A small startup is using Terraform to deploy AWS resources. They have two separate environments: development and production. Currently, they manage two sets of Terraform configuration files in different directories, each with its own state file stored locally. The CEO wants to reduce duplication and simplify management. The team decides to restructure into a single configuration with workspaces. After implementing workspaces, they run `terraform workspace new dev` and `terraform workspace new prod`, then `terraform apply` in the dev workspace. However, when they switch to prod and run `terraform apply`, the plan shows that Terraform wants to recreate all resources instead of managing the existing production resources. What is the most likely reason for this behavior?
Easy19A developer needs to inspect the current state of a specific resource managed by Terraform without modifying any infrastructure. Which command should they use?
Easy20Refer to the exhibit. Which command was most likely executed?
Easy21An organization uses Terraform Cloud and wants to automate run triggers when a new version of a module is published in a private module registry. What is the recommended method?
Medium22A company uses Terraform with a remote backend (AWS S3). They want to ensure that the state file is encrypted at rest. Which configuration approach guarantees this?
Hard23Refer to the exhibit. A team deploys this configuration. They run 'terraform apply' once and the instance is created. Later, they modify the instance type and run 'terraform apply' again. They notice the provisioner does not run on the second apply. Why?
Easy24Refer to the exhibit. The user runs 'terraform plan' and sees that Terraform wants to create the instance. However, the instance already exists in the AWS account with the same configuration. What is the most likely reason?
Medium25A company uses Terraform Cloud and wants to ensure that only approved modules from the private registry are used in configurations. How can they enforce this?
Hard26Which TWO of the following are valid ways to pass variables to Terraform in an automated pipeline?
Easy27You are managing a Terraform configuration that deploys resources across multiple AWS accounts using provider aliases. The configuration uses a single backend (S3) to store the state file. Recently, you discovered that the state file has become very large (over 100 MB) and is causing slow operations and timeouts. The team wants to improve performance without losing the ability to manage all resources with a single `terraform apply`. You need to propose a solution. Which approach should you take?
Medium28A small startup uses Terraform to manage infrastructure on AWS. They store the state file directly in a Git repository (gitignored but accidentally committed) and have no remote backend. The team has two engineers: Alice and Bob. They both run Terraform from their local machines. Recently, they experienced state conflicts where Alice's apply would succeed but subsequently Bob's apply would fail due to state drift. They want a simple solution without adding too much complexity. What should they do?
Easy29Which TWO of the following are valid ways to use Terraform outside the core workflow? (Choose two.)
Easy30A company uses Terraform Cloud and wants to enforce policies that all EC2 instances must be of type t2.micro or t2.small. Which feature should they use?
Hard31A company uses Terraform with a backend configured to store state in Azure Blob Storage. They want to view the current state of resources without performing a plan or apply. Which command should be used?
Medium32A company uses Terraform with multiple workspaces (dev, staging, prod) and a remote backend in an S3 bucket with a DynamoDB lock table. The backend configuration is defined in the main.tf with partial configuration. Developers are required to provide the backend configuration via command-line flags during 'terraform init'. One developer accidentally ran 'terraform init' without the required flags on a Monday morning. The init succeeded and created a local state file in the project directory. Over the next few days, other team members made changes to the workspace and pushed updates to the remote state. The developer who ran local init then runs 'terraform plan' and sees a plan that would recreate all resources. They realize their mistake. How can this situation be prevented in the future?
Medium33Which TWO Terraform backends support remote state locking?
Medium34During a CI/CD pipeline run, terraform apply fails halfway through due to a network error. The state file is locked. The team wants to resume from the last successful apply. What should they do?
Hard35You are a platform engineer at a large enterprise that uses Terraform Cloud with a VCS-backed workflow for all infrastructure. Your team manages a configuration that provisions AWS EC2 instances for a critical application. Recently, a junior team member accidentally committed a change that removed a required tag from the EC2 instance resource. The change passed the plan stage but was blocked by a Sentinel policy during the apply, preventing the infrastructure from being updated. The team needs to fix the configuration and apply the change. However, the repository is configured to automatically trigger runs on every push to the main branch. The team wants to avoid triggering an unwanted run while they work on the fix. What should the team do?
Hard36A company uses Terraform with multiple cloud providers and wants to integrate with their existing CI/CD pipeline. They need to enforce that all infrastructure changes go through code review and automated testing before being applied to production. Which approach best meets these requirements?
Hard37The user runs `terraform init` successfully, but then `terraform plan` still fails with a different error: "Error: No configuration files found in this directory." The directory contains backend.tf and main.tf. What is the most likely cause?
Medium38Which TWO statements about using Terraform with remote backends are correct?
Easy39Which THREE are valid use cases for the 'terraform state replace-provider' command?
Hard40An organization uses Terraform Cloud with a VCS-backed workspace connected to a GitHub repository. They want to trigger a speculative plan without creating a run (i.e., without costing compute resources or being displayed in the workspace). Which approach is appropriate?
Hard41A DevOps team manages infrastructure for a large e-commerce platform using Terraform with a remote backend in an S3 bucket with DynamoDB state locking. Recently, a team member ran `terraform apply` from their local machine but the command failed with the error: 'Error acquiring the state lock: ConditionalCheckFailedException: The conditional request failed'. The state file is not locked according to the DynamoDB table. After investigation, the team finds that the DynamoDB table has a TTL attribute enabled on the 'LockID' field, and old lock records are automatically deleted after a few minutes. The team suspects that another engineer's `terraform plan` process from a CI/CD pipeline might have created a lock that was subsequently deleted by TTL before it was released, causing the conflict. Which action should the team take to prevent this issue from recurring?
Hard42A developer wants to use a module from the Terraform Registry in their configuration. Which block is required in the root module?
Easy43A team is migrating from using local state to a remote backend for collaboration. They want to ensure that team members cannot overwrite each other's changes. Which feature should they enable?
Easy44During a `terraform apply`, the operation fails mid-way due to a network outage, leaving some resources created. The operator wants to resume applying from where it left off without destroying the already-created resources. What should they do?
Hard45A CI/CD pipeline runs 'terraform plan' and needs to automatically approve only if no resources will be destroyed. Which approach should be used?
Hard46A developer accidentally deleted a resource from the Terraform state file using 'terraform state rm'. The resource still exists in the cloud provider. How can the developer re-import the resource without affecting other resources?
Medium47You are a platform engineer at a large e-commerce company that uses Terraform Enterprise to manage thousands of infrastructure resources across multiple teams. The company has a central 'networking' workspace that provisions shared VPCs and subnets, and several application workspaces that consume these networking resources via remote state data sources. Recently, the networking team changed the CIDR block of a shared subnet from '10.0.1.0/24' to '10.0.2.0/24' and applied the change successfully. However, the application teams are now reporting that their Terraform runs are failing with errors indicating that the subnet ID they reference does not exist. The application workspaces use the following configuration to consume the subnet: ```hcl data "terraform_remote_state" "networking" { backend = "remote" config = { organization = "mycompany" workspaces = { name = "networking" } } } resource "aws_instance" "app" { subnet_id = data.terraform_remote_state.networking.outputs.subnet_id ... } ``` The application workspaces have not been modified recently. The networking workspace output 'subnet_id' now contains the ID of the updated subnet. What is the most likely cause of the failures?
Hard48A company has a Terraform configuration that creates many AWS resources. They want to check the estimated cost of the plan before applying. Which approach should they use?
Medium49Which Terraform command is used to validate the syntax of configuration files without accessing any cloud provider?
Easy50A developer wants to see the list of resources currently managed by Terraform in the state file. Which command should they use?
Easy51Based on the exhibit, what will happen to the existing Elastic IP (aws_eip.web_eip) when this plan is applied?
Medium52A Terraform configuration uses a module from the public registry. After a provider update, the module's resources fail to create. What is the most probable cause?
Hard53Which TWO of the following are valid ways to use Terraform outside the core workflow (i.e., in automation or CI/CD pipelines)?
Medium54A developer runs `terraform plan` and it fails with a provider plugin error. Which command should they run first to resolve the issue?
Easy55A team uses an S3 backend with DynamoDB for state locking. They notice that sometimes terraform plan fails because the state is locked. What is the best practice to handle this in an automated pipeline?
Medium56Which Terraform command is used to bring existing infrastructure that was created outside of Terraform under Terraform management?
Easy57A user wants to see the current state of resources in a human-readable format without making changes. Which command should they use?
Easy58A team wants to import an existing AWS S3 bucket named 'my-bucket' into Terraform state. The resource block is defined as 'aws_s3_bucket.my_bucket'. Which command should be used?
Easy59Match each Terraform meta-argument to its purpose.
Medium60A DevOps team is integrating Terraform into a CI/CD pipeline using Jenkins. They want to ensure that the pipeline fails if the Terraform plan contains destructive changes. Which approach best achieves this?
Easy61An organization uses Terraform Cloud for team collaboration. They have a workspace that manages production infrastructure. Due to a security policy, they must ensure that all changes go through a peer review process before they are applied. How can they enforce this requirement?
Medium62A company uses Terraform with remote state stored in an S3 bucket. An operator accidentally runs 'terraform destroy' on a production workspace and wants to recover the state before the operation. What is the best course of action?
Medium63Which TWO of the following are best practices when using Terraform in a CI/CD pipeline? (Choose two.)
Medium64A company wants to use Terraform to manage resources across AWS and Azure. They need a single workflow that can apply changes to both providers. What is the best practice?
Medium65Which TWO of the following are benefits of using Terraform Cloud Run Tasks?
Medium66Which THREE of the following are valid methods to manage Terraform state in a team environment? (Choose three.)
Easy67Which TWO are benefits of using Terraform Cloud's remote operations with a CLI-driven run workflow?
Medium68A company uses Terraform Cloud with a remote state backend and runs infrastructure as code through a CI/CD pipeline (GitHub Actions). The pipeline executes 'terraform plan' and 'terraform apply' using a service account with appropriate permissions. Recently, the team introduced a Sentinel policy to enforce that all AWS resources have mandatory tags (Environment, Owner, Project). The policy passes when runs are triggered manually from the Terraform Cloud UI, but fails consistently when the CI/CD pipeline runs the plan. The infrastructure configuration files are identical in both cases. The team verifies that the service account used by CI/CD has the same workspace permissions as the UI user. What is the most likely cause of the failure?
Hard69A team uses Terraform Cloud with a VCS-backed workflow. They notice that a recent commit triggered a run that failed because of an invalid configuration. The team fixed the configuration and wants to re-run the plan without committing again. Which action should they take?
Hard70A team uses Terraform with multiple workspaces and wants to automatically trigger a plan when a pull request is opened in their Git repository. They use Terraform Cloud. Which feature enables this?
Hard71Refer to the exhibit. A Terraform plan fails with the error shown. What is the most likely cause?
Easy72Drag and drop the steps to use Terraform workspaces for environment separation in the correct order.
Medium73A company wants to integrate Terraform with their CI/CD pipeline to automatically deploy infrastructure. Which Terraform feature should they use to ensure state files are stored securely and accessible by the pipeline?
Easy74A user receives the error shown in the exhibit when running `terraform init`. The user is behind a corporate proxy. Which environment variable should be set to resolve this issue?
Hard75A team using a remote S3 backend with DynamoDB locking is experiencing frequent 'Error acquiring the state lock' messages in their CI/CD pipeline. The pipeline runs multiple concurrent jobs for different workspaces. What is the most likely cause and solution?
Hard76An organization uses Terraform Cloud to manage infrastructure across multiple teams. They need to enforce that all workspaces use a specific version of Terraform and that no workspace can be deleted accidentally. Which approach meets these requirements without using Sentinel or Terraform Enterprise?
Hard77A DevOps team is using Terraform Cloud to manage infrastructure. They want to integrate Terraform into their CI/CD pipeline by triggering runs programmatically. Which approach should they use to invoke a Terraform run from an external system?
Easy78An organization uses Terraform with remote state stored in S3 and DynamoDB for state locking. During a plan, they receive the error: 'Error acquiring the state lock: ConditionalCheckFailedException: The conditional request failed'. What is the most likely cause?
Hard79Which TWO of the following are valid methods for importing existing infrastructure into Terraform management? (Choose two.)
Easy80A developer wants to use Terraform in a CI pipeline where the pipeline runs on pull requests. They need to preview infrastructure changes without applying them. Which command should be used?
EasyOther domains
All TF-004 exam domains
Frequently asked questions
- What does the Use Terraform outside the core workflow domain cover on the TF-004 exam?
- Be able to configure an S3 backend with DynamoDB locking, diagnose lock errors, and safely clear a stale lock with terraform force-unlock. The key skill is knowing when a lock is genuinely stale versus actively held, and never bypassing locking by editing backend resources directly.
- How many questions are in this domain?
- This page lists all 80 Use Terraform outside the core workflow questions in the TF-004 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
- What is the best way to practise this domain?
- Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
- Can I practise only Use Terraform outside the core workflow questions?
- Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.