HashiCorp Certified: Terraform Associate (004) Flashcards
Browse all 29 cards
What is the root module?
The Terraform configuration files in the main working directory that Terraform runs against directly; it can call other (child) modules.
What is a Terraform module?
A reusable, self-contained package of Terraform configuration that manages a related set of resources; every Terraform configuration has at least a root module.
What is Infrastructure as Code (IaC)?
The practice of managing and provisioning infrastructure through machine-readable configuration files rather than manual processes or interactive configuration tools. It enables versioning, review, and repeatable provisioning of infrastructure.
What are the main advantages of using Terraform over manual infrastructure management?
Terraform provides consistency and repeatability, version-controlled infrastructure, a predictable plan/apply workflow, multi-cloud support through a single workflow, and the ability to track and manage the full lifecycle of resources.
What is the core Terraform workflow?
Write configuration, run terraform plan to preview changes, and run terraform apply to make the changes. HashiCorp summarizes this as Write, Plan, Apply.
What does terraform init do?
Initializes a working directory by downloading required providers and modules and configuring the backend for storing state. It must be run before other commands in a new or cloned configuration.
What does terraform plan do?
Creates an execution plan showing what actions Terraform will take to reach the desired state described in configuration, without making any actual changes to infrastructure.
What does terraform apply do?
Executes the actions proposed in a Terraform plan to create, update, or destroy infrastructure so that real resources match the configuration.
What does terraform destroy do?
Destroys all resources tracked by the current Terraform state, removing the infrastructure that Terraform manages.
What is Terraform state?
A file (by default terraform.tfstate) that maps resources defined in configuration to real-world infrastructure objects, tracking metadata and enabling Terraform to plan future changes.
Why is Terraform state necessary?
State lets Terraform know which real-world resources correspond to configuration, track resource dependencies and metadata, and improve performance by caching resource attributes instead of querying every provider on each run.
What is a remote backend in Terraform?
A configuration that tells Terraform to store its state file in a remote location (such as HCP Terraform, an S3 bucket, or Azure Storage) instead of locally, enabling team collaboration and shared state access.
What is state locking?
A mechanism that prevents concurrent operations from writing to the same state file simultaneously, avoiding corruption or conflicting updates when multiple users or processes run Terraform against the same state.
What causes infrastructure drift?
Drift occurs when real infrastructure is changed outside of Terraform (e.g., via a cloud console or another tool), causing the actual resource configuration to diverge from what is recorded in Terraform state.
How can you detect drift in Terraform?
Running terraform plan (or terraform plan -refresh-only) compares real infrastructure against the state file and configuration, reporting any differences caused by out-of-band changes.
What is a Terraform provider?
A plugin that allows Terraform to interact with an API, such as a cloud platform or SaaS service, translating configuration into API calls to create, read, update, and delete resources.
What is a Terraform resource?
A block in configuration that describes one or more infrastructure objects, such as a virtual machine or DNS record, that Terraform will manage.
What is a Terraform data source?
A block that allows Terraform to fetch or compute information from outside the current configuration (or from existing infrastructure) for use elsewhere in the configuration, without managing the lifecycle of that resource.
Where can Terraform modules be sourced from?
Local paths, the public Terraform Registry, HCP Terraform's private registry, Git repositories, HTTP URLs, and other supported storage locations specified in the module's source argument.
What is a Terraform variable (input variable)?
A parameter defined in configuration that allows values to be passed into a module or root configuration, enabling customization without editing the configuration source.
What is a local value (locals) in Terraform?
A named expression that can be reused multiple times within a module, helping avoid repeating the same value or complex expression throughout configuration.
What is the difference between an implicit and explicit dependency in Terraform?
An implicit dependency is automatically detected when one resource references another resource's attribute; an explicit dependency is declared with depends_on when a relationship isn't visible through direct references.
What is the purpose of terraform fmt and terraform validate?
terraform fmt rewrites configuration into a canonical style for consistency, while terraform validate checks that configuration is syntactically valid and internally consistent, without contacting remote services.
What is HCP Terraform?
HashiCorp's managed service (formerly Terraform Cloud) that provides remote state management, remote plan/apply execution, a private module and provider registry, policy enforcement, and collaboration features for teams.
What is Sentinel in the HCP Terraform context?
A policy-as-code framework that lets organizations enforce rules (such as security or cost policies) on Terraform runs before they are applied.
What is the difference between terraform plan and terraform apply?
terraform plan only previews proposed changes without touching infrastructure, while terraform apply actually executes those changes against real infrastructure.
What is a provisioner in Terraform?
A block used to execute scripts or commands on a local or remote machine as part of resource creation or destruction; HashiCorp recommends provisioners as a last resort when no other approach is available.
What is the purpose of the terraform.lock.hcl file?
Records the exact provider versions (and their checksums) selected during initialization, ensuring consistent provider versions are used across team members and runs.
How does Terraform handle multiple cloud providers in one configuration?
Because Terraform's core workflow and language are provider-agnostic, a single configuration can declare and use multiple providers (e.g., AWS and Azure) simultaneously, each configured with its own provider block.