Home
Softono
iac

iac

Open source HCL
106
Stars
6
Forks
16
Issues
1
Watchers
1 week
Last Commit

About iac

iac is an Infrastructure as Code project that automates the deployment and management of infrastructure across diverse environments. The repository consolidates Ansible playbooks and roles, Docker configurations, Kubernetes manifests, Terraform modules, and Packer scripts into a modular, programmable framework designed for full programmatic control over infrastructure. The Kubernetes stack uses Cilium for networking, cert-manager for SSL certificate automation, External DNS for DNS synchronization, External Secrets with Bitwarden for secret management, Ingress NGINX for traffic routing, Rook Ceph for distributed storage, and Tofu Controller for running Terraform workloads within the cluster. Terraform modules are organized by provider and service, with reusable modules and templates for common infrastructure patterns. Secrets are handled securely through a custom bws-cache utility that retrieves secrets from Bitwarden Secrets Manager via API requests and injects them into Terraform state at runtime, avoiding

Platforms

Web Self-hosted Docker Kubernetes

Languages

HCL YAML
crane-iac

Infrastructure as Code (IaC) by Bryan J.

A comprehensive set of tools and configurations for automating tasks across various environments.

Blog »

Kubernetes Deployments · Ansible Roles · Terraform Modules

Overview

This repository provides a set of tools and configurations for automating tasks across environments. It includes Ansible playbooks and roles, Docker configurations, Kubernetes manifests, Terraform modules, and Packer scripts. Secrets are managed through various methods, most notably Bitwarden Secrets Manager. The project is designed with flexibility in mind, allowing me to configure every inch of my infrastructure programmatically while being modular.

About The Lab

Kubernetes

Kubernetes  Age-Days  Uptime-Days  Node-Count  Pod-Count  CPU-Usage  Memory-Usage 

Core Components

Terraform

❯ tree -L1 terraform
terraform
├── _modules
├── _templates
├── authentik
├── aws
[...]

Core Components

bws-cache

Securely retrieves secrets into the Terraform state by making API requests to a secrets management service (like Bitwarden) using an access token. By leveraging the bws-cache, it ensures sensitive information is dynamically fetched and securely passed into the Terraform state without hardcoding secrets, minimizing exposure risks.

Example
[...]
for key in key_name:
  bws_response = requests.get(
      f"http://mgmt-srv-01:5000/key/{key}",
      headers={"Authorization": f"Bearer {access_token}"},
      timeout=10,
  ).json()

  logging.debug(bws_response)

  try:
      results.append(bws_response['value'])
  except KeyError as exc:
      raise InvalidToken(
          "Token is invalid or does not have permissions to read value"
      ) from exc
[...]
resource "radarr_download_client_sabnzbd" "sabnzbd" {
  enable         = true
  priority       = 1
  name           = "sabnzbd"
  host           = "sabnzbd.${var.cluster_media_domain}"
  url_base       = "/"
  port           = var.ports["sabnzbd"]
  movie_category = "movies"
  api_key        = data.external.bws_lookup.result["infra-media-secrets_sabnzbd_api_key"]
}

Ansible

Core Components

N/A

Equipment

Kubernetes
Name Device CPU OS Disk Data Disk RAM OS Purpose
ct-k3s-01 Lenovo M710q i5-6500T 64GB SSD 1TB NVME 32GB Kairos control-plane/worker
ct-k3s-02 Lenovo M710q i5-6500T 64GB SSD 1TB NVME 32GB Kairos control-plane/worker
ct-k3s-03 Lenovo M710q i5-6500T 64GB SSD 1TB NVME 32GB Kairos control-plane/worker
Servers
Name Device CPU OS Disk Data Disk RAM OS Purpose
WhiteBox Custom TR 2970W 128GB 6TB 128GB Proxmox VM/Containers
Synology RS819 - - 4x4TB SHR - DSM 7 Storage
mgmt-pi Raspberry Pi4 Cortex A72 64GB SSD - 8GB Debian 12 Misc Software
Network
Device Purpose
Dell 7040 Network - Router
TL-SG1016PE Network - Switch

(back to top)

Roadmap

  • Finish README