provider block
A top-level block that configures a provider, for example which region or endpoint it talks to and which credentials it uses.
In more detail
It is separate from required_providers, which only says which plugin and versions you need. Some providers, like local and random, need no provider block at all. Never put credentials in the block itself; let the provider read them from the environment.
Example
provider "aws" {
region = "eu-west-2"
}Related terms
- provider — A plugin that teaches Terraform how to talk to one API, such as AWS or your local disk, and which resource types it offers.
- required_providers — The block inside the terraform block that lists each provider a configuration needs, where to download it from and which versions are acceptable.
- provider alias — A second, named configuration of the same provider, used when one configuration must talk to two regions or accounts.
- region — A separate geographic area where a cloud provider runs data centres, such as eu-west-2 for London in AWS.
Taught in
- Providers And The required_providers Block — Infrastructure as Code with Terraform
- Providers: How Terraform Reaches Every API — HashiCorp Terraform Associate (004) Exam Prep
- Versions, The Lock File And Provider Aliases — HashiCorp Terraform Associate (004) Exam Prep
- State: Terraform's Memory Of What It Built — HashiCorp Terraform Associate (004) Exam Prep
- Custom Conditions: Validation, Pre And Postconditions, Checks — HashiCorp Terraform Associate (004) Exam Prep
- Sensitive Data, Ephemeral Values And Secrets From Vault — HashiCorp Terraform Associate (004) Exam Prep
- Module Scope: What Goes In, What Comes Out — HashiCorp Terraform Associate (004) Exam Prep
- Verbose Logging: TF_LOG And Friends — HashiCorp Terraform Associate (004) Exam Prep
- The Full Mock: Sixty Minutes, Eight Areas, One Plan For The Last Week — HashiCorp Terraform Associate (004) Exam Prep