Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:

- name: Windsor Down
run: |
windsor down --clean
windsor down

checkov:
runs-on: ubuntu-latest
Expand Down
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
# core
Core configurations used as the basis for most blueprints
Core Terraform modules and Kubernetes configurations used by [Windsor CLI](https://github.com/windsorcli/cli) to provision and manage infrastructure across multiple cloud providers.

![CI Workflow](https://github.com/your-repo/core/actions/workflows/ci.yaml/badge.svg)

## Contributing

This project uses several tools to maintain code quality and consistency:

- [aqua](https://aquaproj.github.io/) for CLI tool management
- [Task](https://taskfile.dev/) for build automation
- [lefthook](https://github.com/evilmartians/lefthook) for git hooks

### Setup

1. Install [aqua](https://aquaproj.github.io/docs/overview/getting-started)

2. Install project dependencies:
```bash
aqua i
```

3. Install git hooks:
```bash
lefthook install
```

### Development Workflow

- `task fmt` - Format Terraform code
- `task test` - Run Terraform tests
- `task docs` - Generate Terraform documentation
- `task scan` - Run security scans

Git hooks will automatically:
- Format code on commit
- Run tests and generate docs before push
22 changes: 21 additions & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,30 @@ tasks:
- |
MODULE={{.CLI_ARGS | default "terraform"}}
if [ -d "$MODULE" ]; then
# Create a temporary directory for test results
TEMP_DIR=$(mktemp -d)
# Find all test files and run them in parallel
find "$MODULE" -type f -name '*.tftest.hcl' | while read testfile; do
testdir=$(dirname "$testfile")
(cd "$testdir" && terraform init -input=false && terraform test)
(
cd "$testdir" && \
terraform init -input=false -reconfigure && \
terraform test > "$TEMP_DIR/$(basename "$testfile").log" 2>&1 || \
echo "FAILED: $testfile" >> "$TEMP_DIR/failures"
) &
done
# Wait for all background jobs to complete
wait
# Check if any tests failed
if [ -f "$TEMP_DIR/failures" ]; then
echo "Test failures:"
cat "$TEMP_DIR/failures"
echo "Test logs:"
find "$TEMP_DIR" -name "*.log" -type f -exec echo "=== {} ===" \; -exec cat {} \;
rm -rf "$TEMP_DIR"
exit 1
fi
rm -rf "$TEMP_DIR"
else
echo "Module path '$MODULE' does not exist."
exit 1
Expand Down
2 changes: 2 additions & 0 deletions aqua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ packages:
- name: derailed/k9s@v0.50.6
- name: getsops/sops@v3.10.2
- name: 1password/cli@v2.30.3
- name: evilmartians/lefthook@v1.6.7
- name: bridgecrewio/checkov@3.2.424
79 changes: 79 additions & 0 deletions docs/terraform/cluster/aws-eks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >=1.8 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | 5.97.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.97.0 |
| <a name="provider_local"></a> [local](#provider\_local) | 2.5.2 |
| <a name="provider_null"></a> [null](#provider\_null) | 3.2.4 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_eks_addon.main](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/eks_addon) | resource |
| [aws_eks_cluster.main](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/eks_cluster) | resource |
| [aws_eks_fargate_profile.main](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/eks_fargate_profile) | resource |
| [aws_eks_node_group.main](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/eks_node_group) | resource |
| [aws_iam_policy.external_dns](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_policy) | resource |
| [aws_iam_policy.pod_identity_agent](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_policy) | resource |
| [aws_iam_role.cluster](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role) | resource |
| [aws_iam_role.ebs_csi](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role) | resource |
| [aws_iam_role.efs_csi](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role) | resource |
| [aws_iam_role.external_dns](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role) | resource |
| [aws_iam_role.fargate](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role) | resource |
| [aws_iam_role.node_group](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role) | resource |
| [aws_iam_role.pod_identity_agent](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role) | resource |
| [aws_iam_role.vpc_cni](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role) | resource |
| [aws_iam_role_policy_attachment.cluster_AmazonEKSClusterPolicy](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.cluster_AmazonEKSVPCResourceController](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.ebs_csi](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.efs_csi](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.external_dns](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.fargate_pod_execution_role_policy](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.node_group_AmazonEC2ContainerRegistryReadOnly](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.node_group_AmazonEKSWorkerNodePolicy](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.node_group_AmazonEKS_CNI_Policy](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.pod_identity_agent](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.vpc_cni](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/iam_role_policy_attachment) | resource |
| [aws_kms_key.eks_encryption_key](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/kms_key) | resource |
| [aws_launch_template.node_group](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/launch_template) | resource |
| [aws_security_group.cluster_api_access](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/resources/security_group) | resource |
| [local_sensitive_file.kubeconfig](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/sensitive_file) | resource |
| [null_resource.create_kubeconfig_dir](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/data-sources/caller_identity) | data source |
| [aws_eks_addon_version.default](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/data-sources/eks_addon_version) | data source |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/data-sources/region) | data source |
| [aws_subnets.private](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/data-sources/subnets) | data source |
| [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/5.97.0/docs/data-sources/vpc) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_addons"></a> [addons](#input\_addons) | Map of EKS add-ons | <pre>map(object({<br/> version = optional(string)<br/> tags = optional(map(string), {})<br/> }))</pre> | <pre>{<br/> "aws-ebs-csi-driver": {},<br/> "aws-efs-csi-driver": {},<br/> "coredns": {},<br/> "eks-pod-identity-agent": {},<br/> "external-dns": {},<br/> "vpc-cni": {}<br/>}</pre> | no |
| <a name="input_cluster_api_access_cidr_block"></a> [cluster\_api\_access\_cidr\_block](#input\_cluster\_api\_access\_cidr\_block) | The CIDR block for the cluster API access. | `string` | `"0.0.0.0/0"` | no |
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | The name of the EKS cluster. | `string` | `""` | no |
| <a name="input_context_id"></a> [context\_id](#input\_context\_id) | The windsor context id for this deployment | `string` | `""` | no |
| <a name="input_context_path"></a> [context\_path](#input\_context\_path) | The path to the context folder, where kubeconfig is stored | `string` | `""` | no |
| <a name="input_endpoint_public_access"></a> [endpoint\_public\_access](#input\_endpoint\_public\_access) | Whether to enable public access to the EKS cluster. | `bool` | `true` | no |
| <a name="input_fargate_profiles"></a> [fargate\_profiles](#input\_fargate\_profiles) | Map of EKS Fargate profile definitions to create. | <pre>map(object({<br/> selectors = list(object({<br/> namespace = string<br/> labels = optional(map(string), {})<br/> }))<br/> tags = optional(map(string), {})<br/> }))</pre> | `{}` | no |
| <a name="input_kubernetes_version"></a> [kubernetes\_version](#input\_kubernetes\_version) | The kubernetes version to deploy. | `string` | `"1.32"` | no |
| <a name="input_max_pods_per_node"></a> [max\_pods\_per\_node](#input\_max\_pods\_per\_node) | Maximum number of pods that can run on a single node | `number` | `64` | no |
| <a name="input_node_groups"></a> [node\_groups](#input\_node\_groups) | Map of EKS managed node group definitions to create. | <pre>map(object({<br/> instance_types = list(string)<br/> min_size = number<br/> max_size = number<br/> desired_size = number<br/> disk_size = optional(number, 64)<br/> labels = optional(map(string), {})<br/> taints = optional(list(object({<br/> key = string<br/> value = string<br/> effect = string<br/> })), [])<br/> }))</pre> | <pre>{<br/> "default": {<br/> "desired_size": 2,<br/> "instance_types": [<br/> "t3.medium"<br/> ],<br/> "max_size": 3,<br/> "min_size": 1<br/> }<br/>}</pre> | no |
| <a name="input_vpc_cni_config"></a> [vpc\_cni\_config](#input\_vpc\_cni\_config) | Configuration for the VPC CNI addon | <pre>object({<br/> enable_prefix_delegation = bool<br/> warm_prefix_target = number<br/> warm_ip_target = number<br/> minimum_ip_target = number<br/> })</pre> | <pre>{<br/> "enable_prefix_delegation": true,<br/> "minimum_ip_target": 1,<br/> "warm_ip_target": 1,<br/> "warm_prefix_target": 1<br/>}</pre> | no |
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | The ID of the VPC where the EKS cluster will be created. | `string` | `null` | no |

## Outputs

No outputs.
7 changes: 4 additions & 3 deletions docs/terraform/cluster/azure-aks.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ No modules.
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the AKS cluster | `string` | `null` | no |
| <a name="input_context_id"></a> [context\_id](#input\_context\_id) | Context ID for the resources | `string` | `null` | no |
| <a name="input_context_path"></a> [context\_path](#input\_context\_path) | The path to the context folder, where kubeconfig is stored | `string` | `""` | no |
| <a name="input_default_node_pool"></a> [default\_node\_pool](#input\_default\_node\_pool) | Configuration for the default node pool | <pre>object({<br/> name = string<br/> vm_size = string<br/> os_disk_type = string<br/> max_pods = number<br/> host_encryption_enabled = bool<br/> min_count = number<br/> max_count = number<br/> node_count = number<br/> })</pre> | <pre>{<br/> "host_encryption_enabled": true,<br/> "max_count": 3,<br/> "max_pods": 30,<br/> "min_count": 1,<br/> "name": "system",<br/> "node_count": 1,<br/> "os_disk_type": "Managed",<br/> "vm_size": "Standard_D2s_v3"<br/>}</pre> | no |
| <a name="input_default_node_pool"></a> [default\_node\_pool](#input\_default\_node\_pool) | Configuration for the default node pool | <pre>object({<br/> name = string<br/> vm_size = string<br/> os_disk_type = string<br/> max_pods = number<br/> host_encryption_enabled = bool<br/> min_count = number<br/> max_count = number<br/> node_count = number<br/> only_critical_addons_enabled = bool<br/> })</pre> | <pre>{<br/> "host_encryption_enabled": true,<br/> "max_count": 3,<br/> "max_pods": 30,<br/> "min_count": 1,<br/> "name": "system",<br/> "node_count": 1,<br/> "only_critical_addons_enabled": true,<br/> "os_disk_type": "Managed",<br/> "vm_size": "Standard_D2s_v3"<br/>}</pre> | no |
| <a name="input_expiration_date"></a> [expiration\_date](#input\_expiration\_date) | The expiration date for the AKS cluster's key vault | `string` | `null` | no |
| <a name="input_kubernetes_version"></a> [kubernetes\_version](#input\_kubernetes\_version) | Version of Kubernetes to use | `string` | `"1.32"` | no |
| <a name="input_local_account_disabled"></a> [local\_account\_disabled](#input\_local\_account\_disabled) | Whether to disable local accounts for the AKS cluster | `bool` | `false` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the resource | `string` | `"cluster"` | no |
| <a name="input_network_acls_default_action"></a> [network\_acls\_default\_action](#input\_network\_acls\_default\_action) | The default action for the AKS cluster's network ACLs | `string` | `"Allow"` | no |
| <a name="input_private_cluster_enabled"></a> [private\_cluster\_enabled](#input\_private\_cluster\_enabled) | Whether to enable private cluster for the AKS cluster | `bool` | `false` | no |
| <a name="input_public_network_access_enabled"></a> [public\_network\_access\_enabled](#input\_public\_network\_access\_enabled) | Whether to enable public network access for the AKS cluster | `bool` | `true` | no |
Expand All @@ -67,8 +68,8 @@ No modules.
| <a name="input_role_based_access_control_enabled"></a> [role\_based\_access\_control\_enabled](#input\_role\_based\_access\_control\_enabled) | Whether to enable role-based access control for the AKS cluster | `bool` | `true` | no |
| <a name="input_sku_tier"></a> [sku\_tier](#input\_sku\_tier) | The SKU tier for the AKS cluster | `string` | `"Standard"` | no |
| <a name="input_soft_delete_retention_days"></a> [soft\_delete\_retention\_days](#input\_soft\_delete\_retention\_days) | The number of days to retain the AKS cluster's key vault | `number` | `7` | no |
| <a name="input_vnet_name"></a> [vnet\_name](#input\_vnet\_name) | Name of the VNET | `string` | `null` | no |
| <a name="input_vnet_resource_group_name"></a> [vnet\_resource\_group\_name](#input\_vnet\_resource\_group\_name) | Name of the VNET resource group | `string` | `null` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to apply to the resources | `map(string)` | `{}` | no |
| <a name="input_vnet_module_name"></a> [vnet\_module\_name](#input\_vnet\_module\_name) | Name on the VNET module | `string` | `"network"` | no |
| <a name="input_vnet_subnet_id"></a> [vnet\_subnet\_id](#input\_vnet\_subnet\_id) | ID of the subnet | `string` | `null` | no |
| <a name="input_workload_autoscaler_profile"></a> [workload\_autoscaler\_profile](#input\_workload\_autoscaler\_profile) | Configuration for the AKS cluster's workload autoscaler | <pre>object({<br/> keda_enabled = bool<br/> vertical_pod_autoscaler_enabled = bool<br/> })</pre> | <pre>{<br/> "keda_enabled": false,<br/> "vertical_pod_autoscaler_enabled": false<br/>}</pre> | no |

Expand Down
Loading
Loading