Providers: A plugin that Terraform uses to manage a specific cloud provider. Ex) AWS, GCP and Azure.
Resource: A piece of infra that you want to manage with Terraform. Ex, virtual machines, db, loadbalacers.
Resorces are defined in Terraform config files and are associated with a specific provider.
Module: A self-contained set of Terraform config files that can be used to create a specific set of infra resources.
Modules can be shared and reused acreoss projects, and can be nested within other modules to create more complex infra.
State: A file that keeps track of the current state of the infra being managed.
This file is updated each time Terraform runs, and is used to determine which resources need to be created, updated, or deleted.
Plan: A preview of the changes that Terraform will make to your infrastructure when you run the apply command.
Apply: The apply command is used to apply the changes that Terraform has planned to your infrastructure.
Variable:A parameter that can be passed to Terraform config files to allow them to be more flexible and reusable.
Variables can be used to define things like IP addresses, DNS names, or other configuration parameters that can vary based on the environment.
Output: An output is a value that is generated by Terraform after the infrastructure has been created.
Outputs can be used to provide information to other tools or scripts, or to display information to the user.
Backend: A backend is a storage location for the Terraform state file.
Terraform supports multiple backends, including local files, S3 buckets, and remote storage services like Consul and etcd.
Workspace: A workspace is a separate instance of Terraform state that allows you to manage multiple environments (such as development, staging, and production) with the same set of config files.
Workspaces are useful for managing configurations that are similar but have some differences between them.
Remote State: A remote state is a feature that allows the Terraform state file to be stored remotely in a shared location, rather than locally on the machine running the Terraform commands.
Local, Infra, Backend.
Goal: State of actual Infra == Stored State in Backend.
Workflow
local code stage.
Make .tstate file to store state.
After init, .terraform file will be made at local which containing contents in .tfstate.
Other local env can be sync-up with this init.
Preview of result infra of given code.
After apply, actual infra will be made in cloud and results are saved in .tfstate file in backend.
They are saved in local .terraform file also.
Import existing infra resources into new Terraform state file.
This is useful when there are existing resources in cloud that i want to manage with Terraform, but that were not originally created with Terraform.