Terraform

Terraform

Manually creating infrastructure can be a straightforward task for smaller setups. However, as the infrastructure scales, it often leads to misconfigurations or errors. To address this, we will emphasize Infrastructure as Code (IaC), with Terraform being our preferred choice due to its robust support for a wide range of providers.

Install terraform

sudo snap install terraform --classic
brew tap # list tapped repositories
brew tap hashicorp/tap # add tap
brew install hashicorp/tap/terraform # install terraform

Uninstall terraform

sudo snap remove terraform
brew uninstall hashicorp/tap/terraform # uninstall terraform
brew untap hashicorp/tap # remove a tap
brew tap # list tapped repositories

Remote state file

Storing state files in a backend is essential for managing Terraform projects effectively, especially in collaborative and multi-environment setups.

aws s3api create-bucket \
  --bucket zeroerrorcode-tf-state-files \
  --region ap-south-1 \
  --create-bucket-configuration LocationConstraint=ap-south-1 \
  --profile <profile_name>
Last updated on