Interview Infrastructure as Code (Terraform, Ansible)

What is a Terraform provider, and how is it versioned?

Infrastructure as Code (Terraform, Ansible) · Basic level

Answer

A Terraform provider is a plugin that knows how to talk to an API such as AWS, Azure, Kubernetes, GitHub, or Datadog. Providers are versioned independently from Terraform itself, and production code should constrain provider versions with required_providers and commit the dependency lock file.

Technical explanation

Providers translate Terraform CRUD operations into API calls and expose resources and data sources.

Provider aliases allow one configuration to address multiple regions, accounts, or clusters.

Provider upgrades must be reviewed because schema or behavior changes can alter plans.

Keep Terraform's ownership boundary clear: one state should own a resource or field, and other tools should consume published outputs instead of modifying it.

Use fmt, validate, linting, policy checks, plan review, and state locking before production applies.

Design for small blast radius by splitting state around lifecycle, permissions, and recovery boundaries.

Hands-on example

1. Create version controls for: What is a Terraform provider, and how is it versioned?

2. Add versions.tf:

terraform {

required_version = ">= 1.6, < 2.0"

required_providers {

aws = {

source = "hashicorp/aws"

version = "~> 5.0"

}

}

}

3. Run terraform init, commit .terraform.lock.hcl, and run terraform providers lock for multi-platform CI if needed.

4. Test an upgrade in a branch with terraform init -upgrade, review the provider changelog, and compare plans before merging.

Preparing for an interview?

Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.

More Infrastructure as Code (Terraform, Ansible) interview questions

← All Infrastructure as Code (Terraform, Ansible) questions