Terraform/OpenTofu

Terraform

Infrastructure automation to provision and manage resources in any cloud or data center.

Home: https://www.terraform.io/
Releases: https://github.com/hashicorp/terraform/releases
Final version with Mozilla Public License: 1.5.7
The newer versions are released under Business Source License.

OpenTofu

The open source infrastructure as code tool

Home: https://opentofu.org/
Releases: https://github.com/opentofu/opentofu/releases

Basic Terraform commands - Cheat sheet

CommandDescription
terraform initInitialize the Terraform directory and download the required provider plugins
terraform fmt -recursiveEnsure all Terraform code in the current directory and subdirectories is formatted properly
terraform validateValidate the syntax of the Terraform configuration files and check for errors
terraform planShow the execution plan, the resources that will be created, updated, or destroyed
terraform applyApply the changes required to reach the desired state of the infrastructure
terraform destroyDestroy the Terraform-managed infrastructure
terraform showDisplay the current state of the Terraform-managed infrastructure
terraform state listList all resources in the Terraform state
terraform apply -replace "id"Force replacement of a resource

Azure VM module

The modules in the terraform/modules folder are implementing a Virtual Machine with the associated network setup and storage. This VM can be used to test/host the Docker services of this repo.

Usage:

  1. Login to Azure account (without browser access on device): az login --use-device-code
  2. See the file terraform/Makefile for available make commands for deploying/connection/deleting the VM.

Requirements

NameVersion
terraform>= 1.5
azurerm~> 4.0

Modules

NameSourceVersion
base./modules/basen/a
storage./modules/storagen/a
vm./modules/vmn/a

Inputs

NameDescriptionTypeDefaultRequired
admin_source_addressAllow connections (SSH, …) only from this IPstringn/ayes
admin_userName of the administrative user on the VMstring"azureuser"no
git_credentialsGit credentials for accessing the infrastructure repository. Will be written to ~/.git-credentialsstringn/ayes
locationLocation of the resourcesstring"westeurope"no
repo_directoryName of the infrastructure repository directorystring"infra"no
repo_urlURL of the infrastructure repositorystringn/ayes
resourcegroupName of Resource Groupstring"HomeInfra"no
storage_disk_size_gbSize of the permanent disk in GBnumber10no
subscription_idAzure subscription ID (format: ‘00000000-xxxx-xxxx-xxxx-xxxxxxxxxxxx’)stringn/ayes
vm_domain_name_labelDNS name of the VM. The FQDN will be: <vm_domain_name_label>..cloudapp.azure.comstringn/ayes
vm_nameName, hostname of the VMstringn/ayes
vm_sizeSize of the VMstring"Standard_D2s_v5"no
vm_ubuntu_server_offerOffer of the VMstring"0001-com-ubuntu-server-jammy"no
vm_ubuntu_server_skuSKU of the VMstring"22_04-lts-gen2"no

Outputs

NameDescription
vm_fqdnn/a
vm_idn/a
vm_public_ip_addressn/a
vm_public_key_fingerprint_sha256n/a
vm_tls_private_keyn/a