Terraform Made Simple: Day 2 - Terraform Providers
Welcome to Day 2! Today it’s time to talk about Terraform Providers. If the terraform {} block is the foundation, Providers are the functional plugins that allow Terraform to communicate with external platforms.
1⃣ What is a Provider?
A Provider is an interface plugin that translates Terraform configuration (HCL) into specific API calls for a target platform:
➜ It contains the code required to manage resources for a specific cloud or service.
➜ It allows Terraform to interact with hundreds of platforms, including AWS, GCP, Azure, GitHub, and Kubernetes.
➜ It carries out the actions needed to create, update, or delete your infrastructure.
2⃣ Types of Providers:
Providers are categorized based on who maintains and supports them:
➜ Official: Managed and supported directly by HashiCorp.
➜ Verified: Maintained by the platform itself (e.g., AWS or Azure) and verified by HashiCorp.
➜ Community: Open-source options developed and maintained by the broader community.
➜ Unverified/Custom: Built internally by organizations for private or specialized use cases.
3⃣ Declaring and Using Providers:
To use a provider, you must follow a two-step process in your code:
➜ Declare (required_providers): Inside the terraform {} block, you specify the Source (where to download it) and the Version to ensure your code remains stable.
➜ Configure (provider block): In a separate block, you set the global parameters for that provider, such as the region or authentication details required to connect to the platform.
4⃣ Core Jobs:
Providers handle the technical heavy lifting of infrastructure management:
➜ Initialize: When you run terraform init, Terraform downloads and installs the specific provider plugins you defined.
➜ Map: It connects the resource types in your code (like aws_instance) to the actual service on the target platform.
➜ Execute: It translates your commands into action to ensure the cloud environment matches your configuration.
That’s a wrap for Day 2! Tomorrow, we will dive into Variables and how to make your infrastructure code flexible and reusable.
Follow along for the rest of the series! If you missed the start, you can find Day 0 & Day 1 below...
Comments
Post a Comment