Latih 60 soalan HashiCorp Terraform Associate asli merangkumi konsep teras, pengurusan state, sumber dan provisioner, modul, serta Terraform Cloud dan CLI, dengan jawapan dan penerangan.
Tahap: HashiCorp Terraform AssociateKesukaran: intermediate60 soalan60 min
Pilih mod latihan, jawab setiap soalan Terraform Associate, kemudian semak penerangan. Jawapan salah disimpan setempat untuk ulang kaji.
Hari berturut-turut: 0 hariDisimpan hanya pada peranti ini
Kemajuan0 / 60
Masa berbaki: 00:00
Belum ada jawapan salah disimpan.
Tiada soalan sepadan dengan penapis.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 6
What is a data source in Terraform?
A data source lets Terraform read information from existing infrastructure without creating or changing it.
Soalan 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.
Soalan 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.
Soalan 9
What does terraform destroy do?
terraform destroy removes the resources managed by the current configuration. It is destructive and should be used carefully.
Soalan 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.
Soalan 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.
Soalan 12
What does terraform fmt do?
terraform fmt rewrites .tf files using Terraform canonical formatting. It does not change infrastructure or state.
Soalan 13
What is a variable in Terraform?
Variables let users pass values into configuration, such as region or instance size. They make modules reusable.
Soalan 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.
Soalan 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.
Soalan 16
The Terraform configuration language is called ___.
Terraform uses HCL, the HashiCorp Configuration Language, to define infrastructure. HCL files usually have .tf extensions.
Soalan 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.
Soalan 18
What is a dependency graph?
Terraform builds a dependency graph from references between resources and uses it to determine creation and update order.
Soalan 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.
Soalan 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.
Soalan 21
What is Terraform state?
Terraform state maps configuration to real-world resources. It stores resource metadata and is essential for planning and updates.
Soalan 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.
Soalan 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.
Soalan 24
What is state locking?
State locking prevents two Terraform operations from modifying the same state at the same time, reducing conflicts.
Soalan 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.
Soalan 26
What is remote state?
Remote state stores the state file in a shared backend, enabling team collaboration and centralized locking.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 31
What is depends_on used for?
depends_on forces Terraform to create one resource before another when the dependency is not automatic.
Soalan 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.
Soalan 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.
Soalan 34
What is a provisioner?
Provisioners execute scripts or configuration steps on local or remote machines after a resource is created.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 40
What does the configuration represent?
Terraform configuration declares the desired end state. Terraform compares it with real resources to plan changes.
Soalan 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.
Soalan 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.
Soalan 43
What are module inputs?
Module inputs are variables defined in the child module and set by the calling configuration.
Soalan 44
What are module outputs?
Module outputs expose selected values so the calling configuration can use them, such as endpoint URLs or IDs.
Soalan 45
Where can modules be sourced from?
Modules can come from local directories, the Terraform Registry, Git repositories, HTTP URLs, and other sources.
Soalan 46
What is the Terraform Registry?
The Terraform Registry is a public repository where users can find and publish reusable providers and modules.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 53
What does terraform output do?
terraform output shows the values of outputs after apply, which is useful for scripts and integrations.
Soalan 54
What is a run trigger?
Run triggers in Terraform Cloud start a workspace run when another workspace completes or a source changes.
Soalan 55
Modules can be reused across projects.
This statement is true. Modules are designed for reuse across projects and teams, reducing duplicated configuration.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.
Soalan 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.