Practica 60 preguntas originales de HashiCorp Terraform Associate sobre conceptos básicos, gestión de estado, recursos y provisioners, módulos, y Terraform Cloud y CLI, con respuestas y explicaciones.
Nivel: HashiCorp Terraform AssociateDificultad: intermediate60 preguntas60 min
Elige un modo de práctica, responde cada pregunta de Terraform Associate y revisa la explicación. Los errores se guardan localmente para repasar.
Racha de días: 0 díasGuardado solo en este dispositivo
Progreso0 / 60
Tiempo restante: 00:00
Aún no hay errores guardados.
Ninguna pregunta coincide con tus filtros.
Pregunta 1
What is Terraform?
Terraform is an infrastructure as code tool that lets you define and manage cloud resources declaratively. It is not a database, web server, or monitoring agent.
Pregunta 2
What is infrastructure as code?
Infrastructure as code means defining and provisioning infrastructure through version-controlled configuration files. This makes changes repeatable and auditable.
Pregunta 3
What does HCL stand for?
HCL is the HashiCorp Configuration Language used by Terraform. It is designed to be readable by humans and machines.
Pregunta 4
What is a provider in Terraform?
A provider is a plugin that translates Terraform configuration into API calls for a specific platform such as AWS, Azure, or GCP.
Pregunta 5
What is a resource in Terraform?
A resource is an infrastructure object such as a virtual machine, network, or database that Terraform creates and manages.
Pregunta 6
What is a data source in Terraform?
A data source lets Terraform read information from existing infrastructure without creating or changing it.
Pregunta 7
What does terraform plan do?
terraform plan compares the configuration with current state and shows what will be created, changed, or destroyed without applying it.
Pregunta 8
What does terraform apply do?
terraform apply executes the changes needed to make real infrastructure match the configuration. It should usually follow a plan.
Pregunta 9
What does terraform destroy do?
terraform destroy removes the resources managed by the current configuration. It is destructive and should be used carefully.
Pregunta 10
What does terraform init do?
terraform init prepares the working directory by downloading providers and modules and configuring the backend. It is usually the first command.
Pregunta 11
What does terraform validate do?
terraform validate checks whether configuration is syntactically valid and internally consistent without contacting providers, which helps catch errors before planning or applying changes.
Pregunta 12
What does terraform fmt do?
terraform fmt rewrites .tf files using Terraform canonical formatting. It does not change infrastructure or state.
Pregunta 13
What is a variable in Terraform?
Variables let users pass values into configuration, such as region or instance size. They make modules reusable.
Pregunta 14
What is an output in Terraform?
Outputs expose selected values from applied infrastructure, such as IP addresses or endpoint URLs, to users or other modules.
Pregunta 15
Terraform configuration is declarative.
This statement is true. Terraform declares the desired end state, and Terraform figures out how to reach it. This is different from imperative scripts.
Pregunta 16
The Terraform configuration language is called ___.
Terraform uses HCL, the HashiCorp Configuration Language, to define infrastructure. HCL files usually have .tf extensions.
Pregunta 17
What does a provider configuration define?
A provider block tells Terraform which provider plugin to use and includes settings such as region and credentials.
Pregunta 18
What is a dependency graph?
Terraform builds a dependency graph from references between resources and uses it to determine creation and update order.
Pregunta 19
What does terraform refresh do?
terraform refresh reads the actual infrastructure and updates the state file without changing resources. Modern versions refresh during plan and apply.
Pregunta 20
What is a resource address?
A resource address such as aws_instance.web identifies a resource uniquely so commands like plan, apply, and state can target it.
Pregunta 21
What is Terraform state?
Terraform state maps configuration to real-world resources. It stores resource metadata and is essential for planning and updates.
Pregunta 22
Where can Terraform state be stored?
State can be stored locally in terraform.tfstate or remotely in a backend such as Terraform Cloud, S3, or Azure Storage.
Pregunta 23
What is a backend in Terraform?
A backend defines where state is stored and how locking works. Remote backends are important for team collaboration.
Pregunta 24
What is state locking?
State locking prevents two Terraform operations from modifying the same state at the same time, reducing conflicts.
Pregunta 25
How are sensitive values stored in state by default?
Sensitive values such as passwords can appear in plaintext in state files. You should use secure backends and avoid committing state.
Pregunta 26
What is remote state?
Remote state stores the state file in a shared backend, enabling team collaboration and centralized locking.
Pregunta 27
What does terraform state list do?
terraform state list shows the resource addresses currently tracked in the state file. It is useful for confirming which resources are managed before planning changes.
Pregunta 28
What does terraform state show do?
terraform state show displays the attributes of a specific resource as recorded in state. This is useful when inspecting a single resource without running a plan.
Pregunta 29
What does count do in a resource block?
count creates a fixed number of resource instances from one block. for_each is a more flexible alternative.
Pregunta 30
What does for_each do?
for_each iterates over a map or set of strings to create resource instances. It is more flexible than count.
Pregunta 31
What is depends_on used for?
depends_on forces Terraform to create one resource before another when the dependency is not automatic.
Pregunta 32
What is a lifecycle block used for?
A lifecycle block includes settings such as create_before_destroy, prevent_destroy, and ignore_changes. These settings control how Terraform replaces and updates resources.
Pregunta 33
What does create_before_destroy do?
create_before_destroy builds the new resource before removing the old one, which helps reduce downtime during replacement.
Pregunta 34
What is a provisioner?
Provisioners execute scripts or configuration steps on local or remote machines after a resource is created.
Pregunta 35
Which provisioner runs commands on the local machine?
local-exec runs a command on the machine where Terraform runs. remote-exec runs commands on a remote resource.
Pregunta 36
Which provisioner runs commands on a remote resource?
remote-exec connects to the created resource and runs commands there. local-exec runs on the Terraform host.
Pregunta 37
State files can contain sensitive values.
This statement is true. State files can store sensitive attribute values, so secure backends and access controls are important.
Pregunta 38
Every backend automatically supports state locking.
This statement is false. Not all backends support locking. Backends such as S3 with DynamoDB or Terraform Cloud provide locking.
Pregunta 39
The command to list resources in state is terraform state ___.
terraform state list prints resource addresses from state. Other subcommands include show, mv, rm, and pull.
Pregunta 40
What does the configuration represent?
Terraform configuration declares the desired end state. Terraform compares it with real resources to plan changes.
Pregunta 41
What is a Terraform module?
A module is a reusable container of Terraform configuration. Modules can be called from other configurations and the registry.
Pregunta 42
What is the root module?
The root module is the configuration in the working directory where Terraform runs. Child modules are called from it.
Pregunta 43
What are module inputs?
Module inputs are variables defined in the child module and set by the calling configuration.
Pregunta 44
What are module outputs?
Module outputs expose selected values so the calling configuration can use them, such as endpoint URLs or IDs.
Pregunta 45
Where can modules be sourced from?
Modules can come from local directories, the Terraform Registry, Git repositories, HTTP URLs, and other sources.
Pregunta 46
What is the Terraform Registry?
The Terraform Registry is a public repository where users can find and publish reusable providers and modules.
Pregunta 47
What is module versioning?
Module versioning uses tags such as v1.0.0 so callers can pin a specific version and receive controlled updates.
Pregunta 48
What is a workspace in Terraform?
Workspaces allow multiple named states for the same configuration, which is useful for environments such as dev and prod.
Pregunta 49
What is Terraform Cloud?
Terraform Cloud provides remote runs, state storage, variable management, and collaboration features for Terraform. It is used by teams to run infrastructure changes in a controlled way.
Pregunta 50
What is a run in Terraform Cloud?
A run represents the process of planning and applying changes to infrastructure for a Terraform Cloud workspace.
Pregunta 51
Where are variables stored in Terraform Cloud?
Terraform Cloud stores variables in workspaces, and they can be marked sensitive so they are hidden after saving.
Pregunta 52
What does terraform import do?
terraform import attaches an existing real-world resource to a resource block in configuration so Terraform can manage it.
Pregunta 53
What does terraform output do?
terraform output shows the values of outputs after apply, which is useful for scripts and integrations.
Pregunta 54
What is a run trigger?
Run triggers in Terraform Cloud start a workspace run when another workspace completes or a source changes.
Pregunta 55
Modules can be reused across projects.
This statement is true. Modules are designed for reuse across projects and teams, reducing duplicated configuration.
Pregunta 56
terraform plan can save an execution plan file.
This statement is true. terraform plan -out=plan.tfplan saves a plan that can be applied later with terraform apply plan.tfplan.
Pregunta 57
Workspaces are commonly used to manage multiple environments.
This statement is true. Workspaces keep separate state for environments such as development, staging, and production.
Pregunta 58
Terraform Cloud stores state remotely by default.
This statement is true. Terraform Cloud uses a remote backend for state and provides locking and version history.
Pregunta 59
The command to initialize a working directory is terraform ___.
terraform init installs providers, downloads modules, and configures the backend. It should be run before plan and apply.
Pregunta 60
What does terraform destroy -target do?
-target limits an operation to a specific resource or module. terraform destroy -target=aws_instance.web removes only that resource.