Terraform

Dalet chose Terraform as its reference implementation for IaC. Terraform is industry-standard and allows for simple, yet exhaustive and durable description and of infrastructure resources and helps create, update (or delete) those over tools and API calls.

Flex comes bundled with multiple Terraform modules for various Cloud providers, which can be used as-is to create a managed Cloud resources (e.g. VPC, security groups, virtual machines, disk volumes, S3 buckets, databases and so on ...).

Supported Hosts

Flex deployment and administration requires a UNIX-compatible system. At present time, officially tested and supported desktop configurations are:

  1. MacOS (with Apple Silicon ARM64 architecture)
  2. Ubuntu Linux LTS 24.04+ (AMD64 and ARM64 architectures).

Installation

Terraform's installation can be done through 2 distinctives way:

  1. Through OpsCtl (recommended procedure).
  2. Through manual installation.

Manual installation on MacOS

This requires prior installation of Homebrew package manager.

Once available, Terraform can be installed through:

MacOS Installation

brew tap hashicorp/tap
brew install hashicorp/tap/terraform

Manual Installation on Ubuntu Linux

This requires administrative (i.e. root) privileges.

Ubuntu Installation

wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform

State Backend

Terraform is statefull. Infrastructure changes are stored in a so-called tfstate file, describing your complete infrastructure. Every single change on infrastructure (resource addition, update, deletion) is recording and versionned in the tfstate file.

Danger

This file is vital. Loss or alteration of the state file is almost irremediable.

File the tfstate file is stored locally on the computer Terraform is being executed by default, this is not a recommended practice.

As to preserve both state consistency, integrity and allow various team members to work altogether, it is heavily recommended to use an S3 bucket as state location placeholder. More details on how to set it up will be covered in infrastructure setup section.