Files
acdl/modules/l2/static-assets
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
..

static-assets — Production static asset stack (S3 + CloudFront + WAF)

Module kind: module pattern | Version: 1.0.0

A production-ready pattern that references the s3, cloudfront, and waf primitives to deploy a static asset site with a CloudFront CDN edge (S3 origin via Origin Access Control) and WAF protection. A simpler S3-only variation is documented below.

Resources

The pattern references these primitives:

Primitive Purpose README
s3 S3 bucket (origin) README
cloudfront CloudFront distribution + OAC README
waf WAFv2 Web ACL (CloudFront-scoped) README

Inputs

Name Type Required Description
bucket_name string yes Globally-unique S3 bucket name
region string yes AWS region the bucket is created in

Outputs

Name Type Description
distribution_domain_name string The CloudFront distribution domain name
bucket_arn arn The S3 bucket ARN
web_acl_arn arn The WAF Web ACL ARN

Usage

Define a contract referencing this module (the production stack — S3 + CloudFront + WAF):

uses: acdl/pipelines/deploy.yaml@v1.6
module: static-assets
environment: dev
inputs:
  bucket_name: my-static-assets
  region: us-east-1

The composition wires the s3 bucket regional domain name to the CloudFront origin and the WAF web ACL ARN to the CloudFront distribution automatically.

Simpler variation (S3 only)

For a simple S3-only static asset site (no CDN, no WAF), a consumer can declare a contract that references the s3 primitive directly:

uses: acdl/pipelines/deploy.yaml@v1.6
module: s3
environment: dev
inputs:
  bucket_name: my-static-assets
  region: us-east-1

This deploys a single S3 bucket (no CloudFront edge, no WAF). Use this for low-traffic internal sites where a CDN edge is not required.

See the consumer guide for a step-by-step walkthrough, and the s3, cloudfront, and waf READMEs for the underlying primitives.

Compliance extension points

The pattern can wire compliance resources when the compliance milestone (GDPR, SOX, SOC2, HIPAA, DORA) lands:

  • KMS key — shared encryption key for S3 SSE.
  • S3 access logs — access logging to a separate audit bucket.
  • Object Lock — 7-year immutable retention for evidence.
  • Public access block — prevent data exfiltration.
  • CloudFront TLS/HTTPS — viewer protocol policy defaults to redirect-to-https; a custom ACM certificate can pin TLS to a customer domain.
  • CloudFront geo restriction — whitelist/blacklist countries for data-residency compliance.
  • CloudFront logging — access logs to an S3 bucket for auditability.
  • WAF rate limiting / geo blocking / custom rules / logging — see the waf README.

See the per-primitive READMEs for the per-module compliance extension points.

Examples

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

Simple

A minimal deployment (S3 bucket only — no CloudFront/WAF):

examples/simple.yaml

# Simple static-assets deployment (S3 bucket only — no CloudFront/WAF)
# This is the simplest way to deploy a static site: just an S3 bucket.
uses: acdl/pipelines/deploy.yaml@v1.6
module: static-assets
environment: dev
inputs:
  bucket_name: my-static-site
  region: us-east-1

Complex

A production deployment with optional inputs (S3 + CloudFront + WAF):

examples/complex.yaml

# Complex static-assets deployment (S3 + CloudFront + WAF)
# The full production stack: S3 origin + CloudFront CDN edge + WAF protection.
uses: acdl/pipelines/deploy.yaml@v1.6
module: static-assets
environment: dev
inputs:
  bucket_name: my-production-static-site
  region: us-east-1
  price_class: PriceClass_100
  viewer_protocol_policy: redirect-to-https
  default_ttl: 3600
  max_ttl: 86400
  waf_enabled: true

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.