# main.tf — Demonstrates core Terraform features for Doom Emacs workflow.
#
# Navigate: SPC s i (imenu), SPC s p (grep in project)
# Format:   SPC m f (terraform fmt), Init: SPC m i, Plan: SPC m p
#
# Uses null_resource for a provider-free demo. Replace with real providers
# (aws, azurerm, google) for actual infrastructure.

terraform {
  required_version = ">= 1.5"
  required_providers {
    null = {
      source  = "hashicorp/null"
      version = "~> 3.0"
    }
  }
}

# A null resource that runs a local command — useful for demos and provisioning
resource "null_resource" "hello" {
  triggers = {
    message = var.greeting_message
  }

  provisioner "local-exec" {
    command = "echo '${var.greeting_message}' > /tmp/terraform-hello.txt"
  }
}

# Output the greeting message for verification
output "greeting" {
  description = "The greeting message written to file"
  value       = var.greeting_message
}

output "environment" {
  description = "Current deployment environment"
  value       = var.environment
}
