A powerful infrastructure automation tool that provides enhanced Terraform workflows and template management capabilities.
This tool is HEAVILY influenced by Stacks from the Cisco ThousandEyes team.
- Terraform Wrapper: Enhanced Terraform execution with additional functionality
- Template Engine: Go text templates with Sprig functions for dynamic configuration generation
- Configuration Management: Flexible configuration via YAML files and environment variables
- Modular Architecture: Clean separation of concerns with dedicated modules
git clone https://github.com/allocate-engineering/stax.git
cd stax
go build -o stax# Initialize Stax configuration
cp .stax.yaml.example .stax.yaml
# Run terraform commands through Stax
stax terraform init
stax terraform plan
stax terraform apply# Use custom config file
stax --config /path/to/config.yaml terraform plan
# Pass terraform-specific flags
stax terraform plan --var-file=terraform.tfvars --dry-runStax uses YAML configuration files. By default, it looks for .stax.yaml in the current directory or $HOME/.stax.yaml.
terraform:
binary: "terraform"
default_args:
- "-auto-approve"
environment:
TF_LOG: "INFO"
TF_IN_AUTOMATION: "true"
templates:
directory: "./templates"
output_dir: "./output"
variables:
environment: "development"
region: "us-west-2"
default_data:
project_name: "my-project"
owner: "devops-team"Stax includes a powerful template engine built on Go's text/template package with Sprig functions.
templates/
├── main.tf.tmpl
├── variables.tf.tmpl
└── outputs.tf.tmpl
# main.tf.tmpl
resource "aws_instance" "{{ .instance_name }}" {
ami = "{{ .ami_id }}"
instance_type = "{{ .instance_type | default "t3.micro" }}"
tags = {
Name = "{{ .project_name }}-{{ .environment }}"
Environment = "{{ .environment }}"
Owner = "{{ .owner }}"
CreatedAt = "{{ now | date "2006-01-02T15:04:05Z07:00" }}"
}
}stax/
├── cmd/ # Cobra commands
│ ├── root.go # Root command configuration
│ └── terraform.go # Terraform wrapper command
├── internal/ # Internal modules
│ ├── terraform/ # Terraform execution logic
│ ├── template/ # Template engine
│ └── config/ # Configuration management
├── templates/ # Template files (user-defined)
├── go.mod # Go module definition
├── main.go # Application entry point
├── .stax.yaml.example # Example configuration
└── README.md # This file
- Go 1.21 or later
- Terraform (for terraform wrapper functionality)
go mod tidy
go build -o staxgo test ./...- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.