Providers
Overview
Terraform uses providers to interact with various cloud platforms and services. Each provider is responsible for understanding API interactions and exposing resources. Some popular providers include:
- AWS
- Azure
- Google Cloud Platform (GCP)
- Kubernetes
For a complete list of providers, see Terraform registry.
For more details about registry documentation and provider resource references, see Registry.
When you run terraform init, Terraform automatically detects and downloads the required providers for your configuration. The provider configuration has two main parts:
- Required provider
- Actual provider configuration
Provider Configuration
Each provider requires a configuration block, even if you don’t change any default settings. These blocks can also include multiple providers, not just one.
- You can define additional providers as needed
- Each provider corresponds to a different platform or service
This allows a single Terraform run to manage resources across multiple environments or services.
Azure
Default Azure provider block:
provider "azurerm" { }
Example with customized behavior:
provider "azurerm" {
features {
virtual_machine {
graceful_shutdown = true
delete_os_disk_on_deletion = true
}
template_deployment {
delete_nested_items_during_deletion = true
}
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}