Terraform components

Provider

  • The Terraform provider is basically a way that allows you to interact with the API endpoints of different cloud providers or apps or even on-prem providers such as VMWare

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.0"
    }
  }
}

# Configure the AWS Provider
provider "aws" {
  region = "us-east-1"
}

State

  • The file terraform.tfstate is where the resources that are deployed are kept track of

  • We can see all or most information here as well as in the cloud

We have a few CLI tools that allows us to interact with the TFState file

# This allows us to list the resources:
terraform state list

# We can get the info from a resource by running the following:
terraform state show <resource_name>

# If you want to view the entire state:
terraform show

Last updated