From 4be4cb358f9b96ff44ff5179d50edf314ddd0c98 Mon Sep 17 00:00:00 2001 From: Gastli Oussama <37796504+Ga13Ou@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:03:21 +0100 Subject: [PATCH] Updating readme --- terramate/README.md | 87 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/terramate/README.md b/terramate/README.md index edd7ac145..97c04513d 100644 --- a/terramate/README.md +++ b/terramate/README.md @@ -18,22 +18,83 @@ common command-line arguments from Terramate > framework for managing multiple stacks, generating code, and executing > targeted workflows. -### Preflight check -Ensure that your environment meets the following requirements to use Terramate -effectively: +### **1. Create a New Project** +```bash +git init -b main terramate-quickstart +cd terramate-quickstart +git commit --allow-empty -m "Initial empty commit" +``` + +--- + +### **2. Create a Stack** +```bash +terramate create \ + --name "StackName" \ + --description "Description of the stack" \ + stacks/stackname + +git add stacks/stackname/stack.tm.hcl +git commit -m "Create a stack" +``` -- **Terraform installed**: Terramate integrates with Terraform; ensure you have - the required version installed. -- **Go (optional)**: Needed if you are building Terramate from source. -- **Set up your PATH**: Add Terramate to your PATH for easy access. +--- -To install and verify Terramate: +### **3. List Stacks** +```bash +terramate list +``` -```sh -# Install Terramate using your preferred method -webi terramate@stable +--- -# Verify installation -terramate version +### **4. Detect Changes** +```bash +terramate list --changed ``` + +--- + +### **5. Generate Code** +1. Create a `.tm.hcl` file for code generation: + ```bash + cat <stacks/backend.tm.hcl + generate_hcl "backend.tf" { + content { + terraform { + backend "local" {} + } + } + } + EOF + ``` + +2. Run the generation command: + ```bash + terramate generate + ``` + +--- + +### **6. Run Terraform Commands** +- **Initialize stacks:** + ```bash + terramate run terraform init + ``` + +- **Plan changes:** + ```bash + terramate run terraform plan + ``` + +- **Apply changes:** + ```bash + terramate run terraform apply -auto-approve + ``` + +- **Run commands only on changed stacks:** + ```bash + terramate run --changed terraform init + terramate run --changed terraform plan + terramate run --changed terraform apply -auto-approve + ```