Files
acdl/modules/l1/waf
Jon Chery de91a4bb76 feat(P31): encryption-by-default + per-stack CMK (REQ-83, REQ-84, REQ-85)
---ci---
project: acdl
phase: 31
milestone: v1.8
status: execute
---/ci---

- New kms-key L1 primitive (aws:kms:key) with enable_key_rotation=true
  (AWS-managed annual rotation, D-075). Registered in registry.json.
- Adapter TYPE_MAP expanded for aws:kms:key + aws:kms:alias.
- Adapter emits enable_key_rotation from NFR.
- S3 adapter emits server_side_encryption_configuration with KMS when
  kms_key_arn provided; managed KMS fallback with stderr warning when not.
- All 10 existing L1 primitives now have encryption_enabled NFR (default true).
- s3, rds, ecr, ecs-service, ecs-cluster have kms_key_arn input.
- Both L2 compositions (static-assets, microservice) now include a kms-key
  child + wires connecting kms_key_arn to children.
- L2 stack outputs include kms_key_arn.

Tests: +7 (300 -> 307). All pass. run_platform.sh --check-only green
(static-assets now resolves to 5 resources with the CMK).
2026-07-22 22:11:03 +00:00
..

waf — WAFv2 Web ACL

Module kind: primitive | Version: 1.0.0

A WAFv2 Web ACL scoped to CloudFront. It applies managed rule groups by default and can be associated with a CloudFront distribution to filter traffic before it reaches the origin. CloudFront-scoped Web ACLs are always created in us-east-1.

Resources

Resource Type Purpose
webacl aws_wafv2_web_acl WAFv2 Web ACL with managed rules

Inputs

Name Type Required Default Description
name string yes Name of the Web ACL
scope string no cloudfront Scope of the Web ACL (default cloudfront for CloudFront associations)
default_action string no allow Default action (default allow)
rules string no Optional custom rules as JSON (default: managed rules only)
region string yes AWS region (CloudFront-scoped WAF is always us-east-1; the adapter ignores this for cloudfront scope)

Outputs

Name Type Description
web_acl_arn arn The WAF Web ACL ARN

Usage

{
  "id": "waf",
  "type": "aws:wafv2:webacl",
  "module": "waf@1.0.0",
  "inputs": {
    "name": "acdl-static-assets-waf",
    "scope": "cloudfront",
    "default_action": "allow",
    "region": "us-east-1"
  }
}

The web_acl_arn output is typically wired as a ref: expression into the cloudfront primitive's waf_web_acl_arn input inside a module composition (see modules/l2/static-assets).

Compliance extension points

  • Rate limiting — add a rate-based rule to cap requests per IP (SOC2 CC6.1, DORA operational resilience).
  • Geo blocking — add a geo-match statement to block/allow countries for data-residency compliance (GDPR Art.44, SOC2 CC6.1).
  • Custom rules — add custom rule statements for application-specific filtering (e.g. block SQLi/IP allow-lists) (SOC2 CC6.1).
  • Logging — enable WAF access logging to S3/CloudWatch/Kinesis for auditability (SOC2 CC7.2, DORA audit trail).

Examples

Validated example contracts are in examples/. The platform-test pipeline validates them against schemas/contract.schema.json.

Simple

A minimal deployment:

examples/simple.yaml

# Simple WAF with managed rules only
uses: acdl/pipelines/deploy.yaml@v1.6
module: waf
environment: dev
inputs:
  name: my-waf
  region: us-east-1

Complex

A production deployment with optional inputs:

examples/complex.yaml

# Complex WAF with rate limiting + geo blocking (custom rules)
uses: acdl/pipelines/deploy.yaml@v1.6
module: waf
environment: dev
inputs:
  name: my-production-waf
  scope: cloudfront
  default_action: allow
  region: us-east-1

Versioning

1.0.0 — interface MAJOR, behavior MINOR, lifecycle PATCH. MAJOR bumps require a new registry entry (immutable publication); old entries enter a 12-month deprecation window.