# 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

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

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

### State

* The file <mark style="color:orange;">`terraform.tfstate`</mark> 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

<figure><img src="https://3885248957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoE4wMO1dMVDOGDjh0En7%2Fuploads%2FnlQwaOXHpNo88r4cqB3J%2Fimage.png?alt=media&#x26;token=d0b92580-3185-4d32-bc39-6e79ef25f4a5" alt=""><figcaption></figcaption></figure>

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

```bash
# 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
```
