Skip to content

Terraform

Infrastructure as Code (IaC) Orchestration Tool

terraform diagram

Terraform is an open-source infrastructure as code (IaC) orchestration tool created by HashiCorp. It allows users to define and provision infrastructure resources using a declarative configuration language, enabling them to manage infrastructure in a predictable and repeatable way across different cloud providers, data centers, and environments.

Key Features

  • Declarative Configuration: Terraform uses a declarative configuration language called HashiCorp Configuration Language (HCL) to define infrastructure resources, dependencies, and configurations, allowing users to describe the desired state of their infrastructure.
  • Infrastructure as Code: Terraform treats infrastructure as code, enabling users to version control infrastructure configurations, collaborate on changes, and apply infrastructure changes programmatically using version control systems like Git.
  • Multi-Cloud Support: Terraform supports multiple cloud providers, including AWS, Azure, Google Cloud Platform (GCP), and others, as well as on-premises infrastructure, enabling users to manage heterogeneous environments with a single tool.
  • Immutable Infrastructure: Terraform promotes the concept of immutable infrastructure, where infrastructure changes are made by replacing entire resource instances rather than modifying existing instances, ensuring consistency and reproducibility.
  • Resource Graph: Terraform builds a dependency graph of infrastructure resources based on their configurations, allowing it to determine the optimal order of resource creation, update, and destruction during provisioning and modification.

Getting Started

To get started with Terraform, download and install the Terraform binary from the official website, and set up your development environment. Follow the provided documentation and tutorials to learn the basics of Terraform configuration, provisioning, and management.

Community and Support

Join the Terraform community on GitHub to engage with other users, report issues, contribute code, and stay informed about the latest updates and developments. Participate in community discussions, share feedback, and collaborate on improving and enhancing the Terraform infrastructure as code platform.

Automate infrastructure provisioning and management with Terraform—a versatile and powerful tool for defining, provisioning, and managing infrastructure as code.

Volumes

/nfs-nas-swarm/config/
/nfs-nas-swarm/data/

Deployment

No Special requirments

Docker swarm file

version: '3.4'
services:
  terraform:
    image: debian:trixie-slim
    command: /run/install.sh
    # command: tail -f /dev/null
    # entrypoint: /home/tf01/install.sh
    environment:
      PGID: '911'
      PUID: '911'
      TZ: Europe/Amsterdam
    volumes:
    ## a volume to store the initial script to install terraform
     - /swarm/config/terraform/install.sh:/run/install.sh
     ## a volume to store local terraform files
     - /nfs-nas-swarm/config/terraform/vnerd-agents-pool:/home/vnerd-agents-pool
     ## test files
     - /swarm/config/terraform/tf01:/home/tf01
    networks:
     - traefik-public
    logging:
      driver: json-file
    deploy:
      replicas: 0
      placement:
       constraints:
         - node.labels.Arch!=i686
         - node.labels.worker==enabled
  terraform-agent01:
    image: hashicorp/tfc-agent:latest
    command: /run/configure.sh
    environment:
      TFC_AGENT_TOKEN: $AGENT_TOKEN
      TFC_AGENT_NAME: 'agent01'
      PGID: '911'
      PUID: '911'
      TZ: Europe/Amsterdam
    volumes:
    ## a volume to store the script to configure terraform agent
     - /swarm/config/terraform/configure.sh:/run/configure.sh
     ## a volume to store local terraform files
     - /swarm/config/terraform/vnerd-agents-pool:/home/vnerd-agents-pool
    networks:
     - traefik-public
    logging:
      driver: json-file
    deploy:
      replicas: 0
      placement:
       constraints:
         - node.labels.Arch!=i686
         - node.labels.worker==enabled
networks:
  traefik-public:
    external: true

Notes

Comments