This site contains affiliate links and we may earn a commission at no extra cost to you. Learn more.

Terraform providers explained (for the 004 exam)

Updated September 6, 2026

What Terraform providers are, how you configure and version them, and the provider concepts the Terraform Associate 004 tests.

Providers are how Terraform talks to the outside world. Every resource you manage — an AWS instance, a Cloudflare record, a GitHub repo — comes from a provider, so understanding them is foundational for the 004.

What a provider is

A provider is a plugin that translates your Terraform configuration into API calls against a specific platform. AWS, Azure, Google Cloud, Kubernetes and hundreds of others each have a provider. Terraform downloads the providers your configuration needs during terraform init.

Declaring providers: required_providers

You declare which providers a configuration needs in a terraform block, giving each a source (its registry address, like hashicorp/aws) and a version constraint. This pins where the provider comes from and which versions are acceptable.

  • source — the registry namespace and type, e.g. hashicorp/aws
  • version — a constraint such as ~> 5.0 so upgrades are deliberate

Configuring a provider

A provider block configures how to connect — region, credentials source, and so on. Best practice is to supply secrets through environment variables or a secrets manager rather than hard-coding them. You can define multiple configurations of the same provider using alias (for example two AWS regions) and select one per resource with the provider meta-argument.

Versioning and the lock file

terraform init records the exact provider versions it selected in the dependency lock file (.terraform.lock.hcl), which you commit so every run and teammate uses the same versions. Knowing why you pin versions and commit the lock file is fair exam material.

Exam tips

Be able to distinguish the terraform.required_providers declaration from the provider configuration block, explain provider aliases, and describe what init does with providers and the lock file. Reinforce it in the 004 study plan and the objectives checklist.

Ready to start studying?

Related guides