OpenTofu relies on a plugin-based architecture to manage providers, enabling you to provision resources across AWS, GCP, Azure, and many more platforms. This guide covers how to initialize your working directory, understand provider types, and reference provider plugins in your configurations.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
1. Initializing Your Directory
Run the following command in a directory containing your OpenTofu configuration files:.tf files, tofu init will:
- Install all required provider plugins.
- Create a lock file (
.terraform.lock.hcl) to pin provider versions. - Ensure idempotent behavior: rerunning does not alter existing infrastructure.
Always commit the
.terraform.lock.hcl file to your VCS. This ensures consistent provider versions across environments..terraform/providers in your working directory.
2. Provider Types
Providers are distributed via Terraform Registry and OpenTofu Registry, and fall into three categories:| Provider Type | Maintainer | Registry Badge |
|---|---|---|
| Official | HashiCorp | Official badge |
| Verified | Third-party (reviewed by HashiCorp) | Checkmark badge |
| Community | Individual contributors | No badge |

3. Plugin Naming Conventions
Each provider is referenced by a source address with this structure:- hostname (optional): Defaults to
registry.opentofu.orgif omitted. - namespace: Organization or author (e.g.,
hashicorp). - type: Provider name (e.g.,
aws,local).