Providers Overview
Categories:
2 minute read
Terraform Core
Terraform Core is a fundamental component of Terraform. It interprets and executes Terraform configurations in HashiCorp Configuration Language (HCL). As an intermediary, Terraform Core connects to various service providers via plugins, handling multiple resources and services.
The core can be seen as the binary executed when Terraform code is run. It is the same across all platforms and is written in Go.
Terraform providers and the Core
Terraform providers are plugins that the Terraform Core uses to interact with APIs of various services to manage resources. They essentially extend the functionality of Terraform Core by providing resource implementations, enabling Terraform to manage a wide variety of infrastructure types, from physical machines and virtual machines to email and DNS providers.
Each provider plugin is responsible for understanding API interactions and exposing resources. Providers must implement a predetermined interface to be compatible with Terraform Core. They define and provide data sources and resources.
A data source represents a piece of read-only information that can be fetched from a provider, while a resource is something that can be created, updated, or deleted. For each resource type, providers must implement ‘Create’, ‘Read’, ‘Update’, ‘Delete’, and ‘Exists’ functions.
When Terraform Core executes a configuration, it translates the infrastructure plan into a series of CRUD operations against defined resources. It then communicates these operations to the appropriate providers, which in turn execute the necessary API calls against the service they are designed to manage.
State management is also handled in conjunction with providers. Terraform Core maintains the state of each resource and tracks metadata, while providers implement the details of how these operations are executed.
The provider model’s modularity allows for a vast ecosystem of supported services. By providing an abstraction over APIs, they allow Terraform Core to manage services in a uniform and consistent manner, regardless of the underlying service specifics.
Terraform Core communicates with the Providers (plug-ins) via RPC which in turn communicate with the corresponding target platform via HTTP.