terraform/website/docs/language/providers/index.mdx

116 lines
5.1 KiB
Plaintext
Raw Normal View History

---
2021-11-23 00:47:36 +01:00
page_title: Providers - Configuration Language
description: >-
An overview of how to install and use providers, Terraform plugins that
interact with services, cloud providers, and other APIs.
sidebar_title: Providers
---
# Providers
> **Hands-on:** Try the [Perform CRUD Operations with Providers](https://learn.hashicorp.com/tutorials/terraform/provider-use?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn.
Terraform relies on plugins called "providers" to interact with cloud providers,
2021-07-09 17:01:32 +02:00
SaaS providers, and other APIs.
Terraform configurations must declare which providers they require so that
Terraform can install and use them. Additionally, some providers require
configuration (like endpoint URLs or cloud regions) before they can be used.
## What Providers Do
2021-11-23 00:47:36 +01:00
Each provider adds a set of [resource types](/language/resources/)
and/or [data sources](/language/data-sources/) that Terraform can
manage.
Every resource type is implemented by a provider; without providers, Terraform
can't manage any kind of infrastructure.
Most providers configure a specific infrastructure platform (either cloud or
self-hosted). Providers can also offer local utilities for tasks like
generating random numbers for unique resource names.
## Where Providers Come From
Providers are distributed separately from Terraform itself, and each provider
has its own release cadence and version numbers.
The [Terraform Registry](https://registry.terraform.io/browse/providers)
is the main directory of publicly available Terraform providers, and hosts
providers for most major infrastructure platforms.
## Provider Documentation
Each provider has its own documentation, describing its resource
types and their arguments.
The [Terraform Registry](https://registry.terraform.io/browse/providers)
includes documentation for a wide range of providers developed by HashiCorp, third-party vendors, and our Terraform community. Use the
"Documentation" link in a provider's header to browse its documentation.
Provider documentation in the Registry is versioned; you can use the version
menu in the header to change which version you're viewing.
For details about writing, generating, and previewing provider documentation,
2021-11-23 00:47:36 +01:00
see the [provider publishing documentation](/registry/providers/docs).
## How to Use Providers
To use resources from a given provider, you need to include some information
about it in your configuration. See the following pages for details:
2021-11-23 00:47:36 +01:00
- [Provider Requirements](/language/providers/requirements)
documents how to declare providers so Terraform can install them.
2021-11-23 00:47:36 +01:00
- [Provider Configuration](/language/providers/configuration)
documents how to configure settings for providers.
2021-11-23 00:47:36 +01:00
- [Dependency Lock File](/language/dependency-lock)
documents an additional HCL file that can be included with a configuration,
which tells Terraform to always use a specific set of provider versions.
## Provider Installation
- Terraform Cloud and Terraform Enterprise install providers as part of every run.
- Terraform CLI finds and installs providers when
2021-11-23 00:47:36 +01:00
[initializing a working directory](/cli/init/). It can
automatically download providers from a Terraform registry, or load them from
a local mirror or cache. If you are using a persistent working directory, you
must reinitialize whenever you change a configuration's providers.
2021-11-23 00:47:36 +01:00
To save time and bandwidth, Terraform CLI supports an optional plugin
cache. You can enable the cache using the `plugin_cache_dir` setting in
[the CLI configuration file](/cli/config/config-file).
To ensure Terraform always installs the same provider versions for a given
configuration, you can use Terraform CLI to create a
2021-11-23 00:47:36 +01:00
[dependency lock file](/language/dependency-lock)
and commit it to version control along with your configuration. If a lock file
is present, Terraform Cloud, CLI, and Enterprise will all obey it when
installing providers.
> **Hands-on:** Try the [Lock and Upgrade Provider Versions](https://learn.hashicorp.com/tutorials/terraform/provider-versioning?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn.
## How to Find Providers
To find providers for the infrastructure platforms you use, browse
[the providers section of the Terraform Registry](https://registry.terraform.io/browse/providers).
Some providers on the Registry are developed and published by HashiCorp, some
are published by platform maintainers, and some are published by users and
volunteers. The provider listings use the following badges to indicate who
develops and maintains a given provider.
2021-11-23 00:47:36 +01:00
<ProviderTable />
<p></p>
## How to Develop Providers
Providers are written in Go, using the Terraform Plugin SDK. For more
information on developing providers, see:
2021-11-23 00:47:36 +01:00
- The [Plugin Development](/plugin/) documentation
- The [Call APIs with Terraform Providers](https://learn.hashicorp.com/collections/terraform/providers?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS)
collection on HashiCorp Learn