Terraform & Ansible Best Practices
🚧 WIP
🚧 WIP
Welcome to our Data & AI/ML GitOps Platform with Hybrid-Multi-Cloud approach:
tf-k3s-template/ ## K3s
├── registry/environments/
│ ├── development/ ## ArgoCD resources & config for dev environment (k3d)
│ ├── staging/ ## ArgoCD resources & config for staging environment (k3s)
│ └── production/ ## ArgoCD resources & config for production environment (AWS/EKS)
├── templates/
│ ├── mgmt/ ## Management-plane YAML (ArgoCD, Vault, Atlantis, etc.)
│ └── workload-vcluster/ ## Optional: vcluster-based workloads or environment overlays
├── terraform/
│ ├── k3s/ ## Terraform code for K3s
│ ├── github/ ## Terraform code for Github
│ ├── users/ ## Terraform code for Users
│ └── vault ## Terraform code for Vault
└── Taskfile.yml # Orchestrates tasks for K3s
...
tf-aws-template/ ## AWS
tf-azure-template/ ## Azure
k3d
let you spin up and tear down for short dev cycles.task dev-setup
or task cluster-create
can spin up the cluster; ArgoCD automatically syncs from environments/dev
.terraform/k3s
sets up nodes, networking, domain, etc.data-pipelines/
, which staging ArgoCD picks up.terraform/aws
for EKS cluster, VPC, subnets, domain, secrets in AWS parameter store or Vault.environments/production/
, deploying the same pipeline definitions but scaled up.We maintain a trunk-based or branch-based approach:
environments/dev
for local k3d testing.environments/staging
.environments/production
.See our Mermaid diagram in .mermaid-diagrams/gitops-flow.mmd
for a visual representation of multi-branch data changes.
This GitOps strategy leverages Terraform for infrastructure as code, integrates GitOps principles to drive automated deployments, and segments our environments and features to ensure robust, secure, and agile operations.
By combining Terraform-driven IaC with a clear multi-branch workflow, we ensure that hotfixes, AWS cloud foundation enhancements, and developer platform integrations are seamlessly validated and deployed across our environments—from local k3d development to k3s staging and final multi-cloud production deployments. This design adheres to the highest industry standards, ensuring agility, security, and operational excellence in every release.
DevContainer Flow:
Feature Branches:
Release Management:
Initialization & Base Setup
Development Branch (develop
)
develop
branch.DevContainer & Hotfix Branch (hotfix
)
hotfix
branch is created.develop
to ensure that the fix is propagated.Feature Branches
develop
, ensuring integration with the existing Terraform state and modules.develop
.Staging Environment (staging
)
develop
after hotfixes and feature integrations are merged.Production Promotion (main
and release
)
develop
branch is merged into main
.release
branch is then used to bundle and finalize production release candidates.Infrastructure as Code (IaC):
Automated CI/CD Pipelines:
Environment Isolation:
Branch Naming & Semantic Versioning:
v0.1
, v0.2
, etc.) are applied to critical commits, enabling precise rollbacks if necessary.Scalability & Security:
registry/<environment>
paths.Local Dev:
k3d
, terraform
, task
.task dev-setup
or task cluster-create
(depending on your Taskfile definitions).task mgmt-manual-apply
: apply mgmt-plane YAML to dev.task test-all
: checks pods, namespaces, Terraform code validity.Staging:
cd terraform/k3s
terraform init && terraform plan -var-file="../../environments/staging/terraform.tfvars"
terraform apply -auto-approve -var-file="../../environments/staging/terraform.tfvars"
environments/staging
changes, deploys your data pipelines, etc.Production:
cd terraform/aws
terraform init && terraform plan -var-file="../../environments/production/terraform.tfvars"
terraform apply -auto-approve -var-file="../../environments/production/terraform.tfvars"
environments/production
folder, letting ArgoCD orchestrate them at scale.task test-provision
: Runs terraform validate
or terraform plan
for k3s or AWS code.task test-deployed
: Checks pods/namespaces in each environment.task test-all
: Aggregates both.cluster-types/workload-vcluster/
for example YAML definitions.main
.environments/<dev|staging|production>
or terraform/<k3s|aws>
.We hope this multi-environment GitOps approach empowers your data & AI/ML workflows, ensuring consistent, automated deployments from local dev to production scale in AWS.
The nnthanh101/terraform:latest
Docker image is a secure, lightweight, and production-ready environment tailored for modern CloudOps and DevOps workflows. Built on Chainguard's Wolfi Linux, this image incorporates best practices for multi-cloud, Infrastructure-as-Code (IaC), and Kubernetes ecosystem management.
Designed to meet the demands of multi-cloud environments and enterprise-grade automation, it includes tools for provisioning, configuration management, orchestration, and secrets management. The devops
tag extends its functionality with Kubernetes tooling, making it ideal for hybrid-cloud operations.
The nnthanh101/runbooks:latest
image is a secure, lightweight, and production-grade Python environment built on Chainguard's Wolfi Base. This image has been optimized to support multi-cloud environments (AWS, Azure) and cross-platform workflows for CloudOps, FinOps, Analytics, AI, and Data Science projects.
With a focus on modern CloudOps and DevOps practices, this image incorporates security, maintainability, and scalability into its design. It integrates essential extensions like MkDocs, JupyterLab, and Vizro for documentation and analytics workflows.