.PHONY: init plan apply destroy check clean

# Default target
all: init plan

# Initialize Terraform
init:
	terraform init

# Show changes required by the current configuration
plan: check
	terraform plan

# Apply the changes required to reach the desired state
apply: check
	terraform apply

# Destroy Terraform-managed infrastructure
destroy:
	terraform destroy

# Format and validate Terraform files
check:
	terraform fmt -recursive
	terraform fmt -check
	terraform validate

# Clean Terraform files
clean:
	rm -rf .terraform/
	rm -f terraform.tfstate*
