1. The main providers #
Authentication and examples.
Table #
| Provider | Recommended authentication | Example resource |
|---|---|---|
| aws | IAM role (SSO locally, OIDC in CI) | aws_s3_bucket |
| azurerm | az login or federated identity | azurerm_storage_account |
| gcloud auth application-default login or WIF | google_storage_bucket | |
| ovh / openstack | OVHcloud API key, openrc file | openstack_compute_instance_v2 |
| kubernetes / helm | kubeconfig | helm_release |
2. Several regions or accounts #
Provider aliases.
Example #
provider "aws" { region = "eu-west-3" }
provider "aws" {
alias = "secours"
region = "eu-central-1"
}
resource "aws_s3_bucket" "principal" { bucket = "donnees-paris-123" }
resource "aws_s3_bucket" "replique" {
provider = aws.secours
bucket = "donnees-francfort-123"
}3. Practicing at no cost #
Emulators and mocks.
Options #
- LocalStack and
tflocalfor the aws provider. - Azurite for Azure storage (through application code), and Bicep/Terraform templates validated locally.
- Google emulators (Pub/Sub, Firestore) for application code.
- terraform test's
mock_providerfor any provider, including openstack and ovh. - kind or k3d for the kubernetes and helm providers.
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Terraform in CI/CD: pipelines, plan review, OIDC and GitOps
Automate Terraform: plan pipeline on merge requests and apply after approval, posting the plan as...
Terraform multi-environment, workspaces and repository organization
Organize Terraform for several environments: one folder per environment, tfvars files, CLI worksp...
Terraform: principles, architecture and workflow
Understand Terraform: declarative infrastructure as code, architecture (core, providers, state), ...
Testing and securing Terraform: validate, terraform test, tflint, Checkov and policies
Ensure the quality of Terraform code: fmt and validate, native terraform test tests with mocked p...
Terraform state: remote backends, locking, import and refactoring
Manage Terraform state: the role of the state file, sensitive data, remote backends (S3, azurerm,...
Infrastructure as Code on Azure: Bicep, Terraform, Cost Management and Well-Architected
Describe and deploy Azure as code with Bicep (modules, parameters, what-if, pipeline deployments)...
The HCL language: resources, variables, outputs, data and expressions
Writing Terraform: terraform, provider, resource and data blocks, typed variables with validation...
Terraform modules: designing, versioning and reusing
Structure Terraform with modules: root module and child modules, inputs and outputs, sources (loc...
Preparing for the HashiCorp Certified: Terraform Associate certification
Preparation guide for the Terraform Associate: format, official objectives (IaC concepts, workflo...