User Tools

Site Tools


devops:terraform

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devops:terraform [2023/10/17 06:07] skipidardevops:terraform [2024/04/03 19:53] (current) skipidar
Line 1: Line 1:
 ===== Terraform ===== ===== Terraform =====
 +
 +===Debugging===
 +
 +
 +<sxh shell>
 +# https://developer.hashicorp.com/terraform/internals/debugging
 +# investigage errors
 +export TF_LOG="TRACE"
 +export TF_LOG_PATH="./terraform.log"
 +</sxh>
  
 ===Glossary=== ===Glossary===
Line 122: Line 132:
  
 === Data === === Data ===
 +
 +When you define ''data'' blocks Terraform communicates with the **AWS provider** to query AWS and fetch the list of requested resources, mentioned in data-block.
 +
 +<sxh json>
 +
 +</sxh>
 +
 +You can apply filters.
 +
 +<sxh json>
 +
 +# Find the latest available AMI that is tagged with Component = web
 +data "aws_ami" "web" {
 +  filter {
 +    name   = "state"
 +    values = ["available"]
 +  }
 +
 +  filter {
 +    name   = "tag:Component"
 +    values = ["web"]
 +  }
 +
 +  most_recent = true
 +}
 +</sxh>
 +
  
 Create **templates.tf** Create **templates.tf**
devops/terraform.1697522869.txt.gz · Last modified: by skipidar