An open API service indexing awesome lists of open source software.

https://github.com/devald/icas-demo

Modular Terragrunt framework for managing secure, automated, multi-env cloud infrastructure (ICAS: Infrastructure, Cloud, Automation & Security)
https://github.com/devald/icas-demo

aws github-oidc infrastructure-as-code kubernetes nix-flake terraform terraform-modules terragrunt

Last synced: about 1 month ago
JSON representation

Modular Terragrunt framework for managing secure, automated, multi-env cloud infrastructure (ICAS: Infrastructure, Cloud, Automation & Security)

Awesome Lists containing this project

README

          

# ICAS Demo Infrastructure

This is a fully reproducible, Terragrunt-based infrastructure deployment demo managed using Nix flakes. It is configured for a demo AWS account and deploys a full stack including VPC, EKS, job modules, and S3 storage using GitHub Actions and OIDC authentication.

## ๐Ÿงฑ Stack Components

This infrastructure includes:

- **Terragrunt + Terraform Modules**:
- `aws-data`: AWS region/account data source
- `vpc-1`: Custom VPC for demo workloads
- `eks-1`: Kubernetes cluster (EKS)
- `crawler-job-1`: Sample workload running in Kubernetes
- `crawler-s3-1`: S3 bucket for crawler storage
- `github-oidc`: IAM roles for GitHub OIDC authentication

- **Live Environment**: `live/demo/eu-central-1/`
- Organized by AWS region and account
- Each component has its own `terragrunt.hcl`

- **Nix Flake**: Development environment and automation
- `nix develop`: provides pinned versions of Terraform, Terragrunt, kubectl, and AWS CLI
- `nix run .#validate`: validates HCL and Terraform format
- `nix run .#apply`: applies all Terragrunt modules

## ๐Ÿš€ Deployment

Deployment is fully automated through GitHub Actions using OIDC:

```yaml
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::767140398543:role/github-oidc-terraform
aws-region: eu-central-1
```

GitHub workflow is located in:
```
.github/workflows/deploy.yml
```

It:
1. Installs Nix
2. Authenticates with AWS via OIDC
3. Runs `nix run .#validate`
4. Runs `nix run .#apply`

## ๐Ÿงช Validation & Formatting

Validation is handled via the `validate` app:

```bash
nix run .#validate
```

Which checks:
- `terraform fmt -recursive -check`
- `terragrunt hcl fmt --check`
- `terragrunt hcl validate` (with exit code checking)

## ๐Ÿ”ง Local Development

You can enter the development shell with:

```bash
nix develop
```

This provides:
- Terraform
- Terragrunt
- AWS CLI
- kubectl

With the following env vars set:

```bash
AWS_PROFILE=demo-profile
AWS_REGION=eu-central-1
TG_PROVIDER_CACHE=1
```

## ๐Ÿ“ Project Structure

```
.
โ”œโ”€โ”€ flake.nix
โ”œโ”€โ”€ root.hcl
โ”œโ”€โ”€ live/
โ”‚ โ””โ”€โ”€ demo/
โ”‚ โ””โ”€โ”€ eu-central-1/
โ”‚ โ”œโ”€โ”€ aws-data/
โ”‚ โ”œโ”€โ”€ vpc-1/
โ”‚ โ”œโ”€โ”€ eks-1/
โ”‚ โ”œโ”€โ”€ crawler-job-1/
โ”‚ โ”œโ”€โ”€ crawler-s3-1/
โ”‚ โ””โ”€โ”€ github-oidc/
โ”œโ”€โ”€ modules/
โ”‚ โ”œโ”€โ”€ aws-data/
โ”‚ โ”œโ”€โ”€ crawler-job/
โ”‚ โ””โ”€โ”€ github-oidc/
โ””โ”€โ”€ .github/
โ””โ”€โ”€ workflows/
โ””โ”€โ”€ deploy.yml
```

---