Користувальницькькі налаштування

Налаштування сайту


software:iac:terraform

Terraform

Init

Init project in 2024, Terraform 1.7.3

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.37.0"  # AWS provider version, 5.37.*
    }
  }
  required_version = ">= 1.7.0, < 2.0.0"  # Terraform version
}

provider "aws" {
  region = "eu-central-1"
#  profile = "tda-middleware-admin"
}

Datasource of Amazon Linux 2023

data "aws_ami" "instance" {
  most_recent = true
  owners      = ["amazon"]

  filter {
    name   = "name"
    values = ["al2023-ami-2023*"]
  }

  filter {
    name   = "architecture"
    values = [var.architecture]  # AWS instance architecture, //x86_64// or //arm64//
  }
}

Generate documentation

1. Install terraform-docs
2. Write first template:

README.md
TODO: write module purpose
 
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->

3. Generate documentation:

terraform-docs markdown table --output-file README.md .
software/iac/terraform.txt · Востаннє змінено: 2024/07/26 11:45 повз charon