Terraform overview

Terraform overview

November 19, 2019

Basic concepts

There are some basic components for terraform.

  1. Resource: one infrastructure element, like a virtual machine. Resource type is defined in a provider.
  2. Provider: a collection of resource types. Most provider offer resource types on a platform. The example of a provider is AWS, GCP, or Kubernetes.
  3. Module: a set of resources. In order to use modules, following elements may be used.
    1. Input variables:, defined as variable.
    2. Output variables: defined as output.
    3. Local variables: defined in locals.
  4. Data Sources: Data defined and used externally from current terraform. This may be a different terraform state.

State

The current infrastructure configuration is stored in state by terraform. Terraform stores the state in terraform.tfstate localy by default, but using backend, state can be stored remotely like AWS S3. The state can contain sensitive data such as a database password. To avoid this, by some backends, encryption or other features are provided.

External web services or tools

Terraform Cloud

https://app.terraform.io/app

The managed service for terraform. See official page for more details.

Terraform registry

https://registry.terraform.io/

Reusable modules published on registry.

GitHub Actions

https://www.terraform.io/docs/github-actions/index.html

Circle CI Orbs

https://circleci.com/orbs/registry/orb/ovotech/terraform

There are many unofficial terraform orbs, but this has check, plan, and apply features with workspace, parallelism, and github comments.

Further readings

See official pages for more details.

Last updated on