Skill 2.2.3

Provider configuration and credentials

Key Concepts

Provider blocks are written in the root module, for example provider "aws" { region = "eu-west-1" }. The arguments are defined by each provider. Many arguments can also come from environment variables or the platform's own configuration files, and that is the recommended way to supply credentials: never write access keys as literals in configuration, because the files end up in version control.

A provider block is optional when the provider needs no settings or reads them all from the environment. Provider configurations can reference input variables and data sources, but values that are known only after apply can prevent Terraform from planning, so avoid them. Reusable modules should not contain provider blocks; they receive configurations from the root module.