Skip to main content

Command Palette

Search for a command to run...

Day 6 of #TerraWeek - Terraform Providers

Updated
β€’3 min read
Day 6 of #TerraWeek - Terraform Providers
P

πŸ‘‹ Hello! I'm passionate about DevOps and have over 1+ years of experience in the field. I'm proficient in a variety of cutting-edge technologies and always motivated to expand my knowledge and skills. Let's connect and grow together!

SKILLS:

πŸ”Ή Languages & Runtimes: Python, Shell Scripting, HCL, YAML πŸ”Ή Cloud Technologies: AWS, Microsoft Azure, GCP πŸ”Ή Infrastructure Tools: Docker, Terraform, AWS CloudFormation πŸ”Ή Other Tools: Linux, Git and GitHub Actions, Jenkins, Jira, GitLab (beginner), Docker, AWS DevOps πŸ”Ή Web Development: HTML, CSS, Bootstrap, Python, SQL

Job & Responsibilities:

πŸš€ Improved development efficiency by implementing CI/CD pipelines, resulting in a 30% reduction in deployment time on the test server. πŸ”’ Strengthened deployment and testing reliability by utilizing Docker containers and optimizing Dockerfile, reducing development issues on the test server by 20%. βš™οΈ Automated S3 bucket log creation with Shell scripting, eliminating 100% of manual search and saving 2 hours per week. πŸ“… Scheduled EC2 instance start/stop using Lambda functions and Event Bridge, leading to a 25% decrease in infrastructure costs. πŸ”§ Utilized AWS, Linux, Python, Docker, Shell scripting, Terraform, Jenkins Pipelines, and automation to streamline workflows and improve overall system performance.

I'm very detail-oriented and possess strong written and verbal communication skills. As a high performer with a possibility mindset, I strive to solve problems using efficient approaches.

Let's Connect & Grow:

If you find my profile suitable for the role you are searching for, please feel free to reach out to me at sumanprasad9766@gmail.com.

πŸ“ Introduction:

In this blog post, we will dive into Terraform providers, explore provider configuration and authentication, and practice using providers for platforms such as AWS, Azure, and Google Cloud.

πŸ”Ή Understanding Terraform Providers

Terraform providers are plugins that enable Terraform to interact with various cloud platforms, infrastructure services, and APIs. Providers are responsible for understanding API interactions and exposing resources that can be managed using Terraform. Some popular providers include AWS, Azure, Google Cloud, and many others.

To use a provider, you need to declare it in your Terraform configuration file (usually a .tf file). Here's an example of declaring the AWS provider:

provider "aws" {
  region = "us-west-2"
}

Terraform providers are plugins that allow Terraform to interact with various cloud platforms and infrastructure services. They are responsible for understanding API interactions and exposing resources to be managed by Terraform. Some popular Terraform providers include:

Comparing Providers

Each provider has its own set of supported resources and features. To compare them, visit the respective provider's documentation and explore the available resources and data sources.

πŸ”Ή Provider Configuration and Authentication

Each provider has its own set of configuration options, which are used to authenticate and interact with the respective cloud platform or service. These options can include API keys, access tokens, or other credentials required for authentication.

For example, the AWS provider requires an access key and secret key for authentication. You can provide these credentials in several ways, such as environment variables, shared credentials file, or directly in the provider configuration block:

provider "aws" {
  region     = "us-west-2"
  access_key = "your_access_key"
  secret_key = "your_secret_key"
}

However, it's recommended to use environment variables or shared credentials files to avoid exposing sensitive information in your Terraform configuration files.

πŸ”Ή Working with AWS Provider

The AWS provider allows you to manage resources in your AWS account. To get started, declare the AWS provider in your Terraform configuration file:

provider "aws" {
  region = "us-west-2"
}

Next, let's create an Amazon S3 bucket using the AWS provider:

resource "aws_s3_bucket" "example" {
  bucket = "my-example-bucket"
  acl    = "private"
}

After defining the resource, run terraform init to initialize your Terraform working directory and download the required provider plugins. Then, run terraform apply to create the S3 bucket.

Working with Azure Provider

The Azure provider allows you to manage resources in your Azure account. To get started, declare the Azure provider in your Terraform configuration file:

provider "azurerm" {
  features {}
}

Next, let's create a resource group using the Azure provider:

resource "azurerm_resource_group" "example" {
  name     = "my-example-resource-group"
  location = "West US"
}

After defining the resource, run terraform init and terraform apply to create the resource group.

πŸ”Ή Working with Google Cloud Provider

The Google Cloud provider allows you to manage resources in your Google Cloud account. To get started, declare the Google Cloud provider in your Terraform configuration file:

provider "google" {
  project = "my-example-project"
  region  = "us-central1"
  zone    = "us-central1-a"
}

Next, let's create a Google Cloud Storage bucket using the Google Cloud provider:

resource "google_storage_bucket" "example" {
  name     = "my-example-bucket"
  location = "US"
}

After defining the resource, run terraform init and terraform apply to create the storage bucket.

πŸ“ Conclusion

In this blog post, we explored Terraform providers and their role in interacting with different cloud platforms and infrastructure services. We also discussed provider configuration and authentication, and practiced using providers for AWS, Azure, and Google Cloud. By mastering Terraform providers, you can efficiently manage and provision infrastructure across multiple cloud platforms, making your infrastructure management more streamlined and consistent.

πŸ”Ή Checkout GitHub Repository for projects:

πŸ”— github.com/sumanprasad007

More from this blog

D

DeployToCloud

405 posts

πŸ‘‹ Welcome to my Hashnode blog! I'm a DevOps Engineer with 2+ years of experience. Join ~5k followers and explore 320+ blogs on Python, AWS, Docker, Jenkins, Linux, and more. Let's connect & grow πŸš€