mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 17:49:53 +00:00
ref(terramate): mostly style updates
This commit is contained in:
@@ -2,63 +2,56 @@
|
||||
title: Terramate
|
||||
homepage: https://github.com/terramate-io/terramate
|
||||
tagline: |
|
||||
Terramate simplifies managing large-scale Terraform codebases with a focus on automation and scalability.
|
||||
Terramate simplifies managing large-scale Terraform codebases
|
||||
---
|
||||
|
||||
To update or switch versions, run `webi terramate@stable` (or `@v1.0.0`,
|
||||
To update or switch versions, run `webi terramate@stable` (or `@v0.11.4`,
|
||||
`@beta`, etc).
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
The information in this section is a copy of the preflight requirements and
|
||||
common command-line arguments from Terramate
|
||||
(https://github.com/terramate-io/terramate).
|
||||
|
||||
> `Terramate` enables scalable automation for Terraform by providing a robust
|
||||
> framework for managing multiple stacks, generating code, and executing
|
||||
> targeted workflows.
|
||||
|
||||
|
||||
### **1. Create a New Project**
|
||||
```bash
|
||||
git init -b main terramate-quickstart
|
||||
cd terramate-quickstart
|
||||
|
||||
```sh
|
||||
git init -b 'main' ./terramate-quickstart
|
||||
cd ./terramate-quickstart
|
||||
git commit --allow-empty -m "Initial empty commit"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **2. Create a Stack**
|
||||
```bash
|
||||
|
||||
```sh
|
||||
terramate create \
|
||||
--name "StackName" \
|
||||
--description "Description of the stack" \
|
||||
stacks/stackname
|
||||
./stacks/stackname/
|
||||
|
||||
git add stacks/stackname/stack.tm.hcl
|
||||
git add ./stacks/stackname/stack.tm.hcl
|
||||
git commit -m "Create a stack"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **3. List Stacks**
|
||||
```bash
|
||||
|
||||
```sh
|
||||
terramate list
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **4. Detect Changes**
|
||||
```bash
|
||||
|
||||
```sh
|
||||
terramate list --changed
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **5. Generate Code**
|
||||
|
||||
1. Create a `.tm.hcl` file for code generation:
|
||||
```bash
|
||||
cat <<EOF >stacks/backend.tm.hcl
|
||||
|
||||
```sh
|
||||
cat <<EOF > ./stacks/backend.tm.hcl
|
||||
generate_hcl "backend.tf" {
|
||||
content {
|
||||
terraform {
|
||||
@@ -70,30 +63,32 @@ terramate list --changed
|
||||
```
|
||||
|
||||
2. Run the generation command:
|
||||
```bash
|
||||
```sh
|
||||
terramate generate
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **6. Run Terraform Commands**
|
||||
|
||||
- **Initialize stacks:**
|
||||
```bash
|
||||
|
||||
```sh
|
||||
terramate run terraform init
|
||||
```
|
||||
|
||||
- **Plan changes:**
|
||||
```bash
|
||||
|
||||
```sh
|
||||
terramate run terraform plan
|
||||
```
|
||||
|
||||
- **Apply changes:**
|
||||
```bash
|
||||
|
||||
```sh
|
||||
terramate run terraform apply -auto-approve
|
||||
```
|
||||
|
||||
- **Run commands only on changed stacks:**
|
||||
```bash
|
||||
```sh
|
||||
terramate run --changed terraform init
|
||||
terramate run --changed terraform plan
|
||||
terramate run --changed terraform apply -auto-approve
|
||||
|
||||
@@ -20,26 +20,26 @@ __init_terramate() {
|
||||
|
||||
# pkg_install must be defined by every package
|
||||
pkg_install() {
|
||||
# ~/.local/opt/terramate-v0.99.9/bin
|
||||
# ~/.local/opt/terramate-v0.11.4/bin
|
||||
mkdir -p "$(dirname "$pkg_src_cmd")"
|
||||
|
||||
# mv ./terramate-*/terramate ~/.local/opt/terramate-v0.99.9/bin/terramate
|
||||
mv terramate "$pkg_src_cmd"
|
||||
# mv ./terramate* ~/.local/opt/terramate-v0.11.4/bin/terramate
|
||||
mv terramate* "$pkg_src_cmd"
|
||||
}
|
||||
|
||||
# pkg_get_current_version is recommended, but (soon) not required
|
||||
pkg_get_current_version() {
|
||||
# 'terramate version' has output in this format:
|
||||
|
||||
# 0.10.4
|
||||
|
||||
# 0.11.3
|
||||
#
|
||||
# Your version of Terramate is out of date! The latest version
|
||||
# is 0.11.1 (released on Wed Oct 30 15:37:00 UTC 2024).
|
||||
# You can update by downloading from https://github.com/mineiros-io/terramate/releases/tag/v0.11.1
|
||||
# is 0.11.4 (released on Tue Dec 3 19:27:35 UTC 2024).
|
||||
# You can update by downloading from https://github.com/terramate-io/terramate/releases/tag/v0.11.4
|
||||
|
||||
# This trims it down to just the version number:
|
||||
# 0.10.4
|
||||
terramate version | grep '^[0-9]\+\.[0-9]\+\.[0-9]\+$'
|
||||
# 0.11.4
|
||||
terramate version | head -n 1 | cut -d' ' -f1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
var github = require('../_common/github.js');
|
||||
var owner = 'terramate-io';
|
||||
var repo = 'terramate';
|
||||
let github = require('../_common/github.js');
|
||||
let owner = 'terramate-io';
|
||||
let repo = 'terramate';
|
||||
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
all.releases = all.releases.filter(
|
||||
(release) => !['checksums.txt', 'cosign.pub'].includes(release.name),
|
||||
);
|
||||
return all;
|
||||
});
|
||||
};
|
||||
let junkFiles = ['checksums.txt', 'cosign.pub'];
|
||||
|
||||
async function getDistributables() {
|
||||
let all = await github(null, owner, repo);
|
||||
let releases = [];
|
||||
for (let release of all.releases) {
|
||||
let isJunk = !junkFiles.includes(release.name);
|
||||
if (isJunk) {
|
||||
continue;
|
||||
}
|
||||
releases.push(release);
|
||||
}
|
||||
|
||||
all.releases = releases;
|
||||
return all;
|
||||
}
|
||||
|
||||
module.exports = getDistributables;
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports().then(function (all) {
|
||||
getDistributables().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
// all.releases = all.releases.slice(0, 5);
|
||||
|
||||
Reference in New Issue
Block a user