DEV Community

Cover image for Terraform Providers
Srinivasulu Paranduru for AWS Community Builders

Posted on • Updated on

Terraform Providers

Providers :

Terraform relies on plugins called providers to interact with cloud providers, SaaS providers, and other APIs.

Terraform configuration must declare the provider which they require then terraform can install and use them.

Where the providers are coming from :

Providers are distributed separately from Terraform itself, and each provider has its own release and version

Each provider has its own documentation, describing its resource types and arguments

Terraform Registry includes a wide range of providers developed by HashiCorp, third-party vendors, and our Terraform community.

How to use AWS Provider

To install this provider (AWS Provider), copy and paste this code into your Terraform configuration. Then, run terraform init.

Terraform 0.13+

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "5.31.0"
    }
  }
}

provider "aws" {
  # Configuration options
}

Enter fullscreen mode Exit fullscreen mode

Provider Installation

Terraform CLI checks the relevant providers in the configuration file and installs in the working directory. It will automatically downloads from terraform registry.

Plugin Development

Design, develop, and test plugins that connect Terraform to external services

Reference : Plugin Development url references

Note : Is it possible to create custom providers? Yes

  • Create new providers with the framework documentation
  • Maintain the existing providers with SDKv2 documentation
  • Get Hashicorp verify your provider and verified providers will get a badge.
  • Share internal owned provider within your organization using private registry

Provider Architecture

  • Provider plugins are released separately from terraform itself.
  • They have different set of version numbers.
  • Explicitly setting provider version : During terraform init, if version argument is not specified, the most recent provider will be downloaded during initialization.

Image description

For the below snippet used version = "~>2.70" and it will download the packages in 2.7X range

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "~>2.70"
    }
  }
}

provider "aws" {
  # Configuration options
}

Enter fullscreen mode Exit fullscreen mode

Top comments (0)