Files
acdl/modules/l2/static-assets
Jon Chery 361fe600a9 feat(P61): L2 lifecycle pipeline — extend matrix + workflows + tests
Extend the modules-lifecycle pipeline with L2 composition modules
(static-assets, microservice) per REQ-128:

- pipelines/modules-lifecycle.yml: added l2-lifecycle-apply/modify/destroy
  stages + l2_modules matrix entry
- .gitea/workflows/modules-lifecycle.yml + .github/workflows/modules-lifecycle.yml:
  added l2-lifecycle job (byte-identical), matrix over [static-assets,
  microservice], needs ci-vpc-apply, has apply/modify/destroy steps.
  ci-vpc-destroy now needs both [lifecycle, l2-lifecycle].
- schemas/modules-lifecycle-pipeline.schema.json: added l2_modules to matrix
- scripts/run_l2_lifecycle_test.sh + run_l2_lifecycle_destroy.sh: L2 wrappers
  that set ACDL_REMOTE_STATE_KEY=spike/ci-vpc/terraform.tfstate so the
  microservice composition's terraform_remote_state reads from the CI VPC
- adapters/terraform/adapter.py: parameterized remote_state key via
  ACDL_REMOTE_STATE_KEY env var (default: platform/terraform.tfstate)
- modules/l2/static-assets/examples/complex.yml: fixed bucket_name to match
  simple (my-static-site) so terraform modifies in-place (adds CDN + WAF)
- modules/l2/microservice/examples/complex.yml: fixed bucket_name to match
  simple (my-microservice-demo), added desired_count:2 (modify variant)
- tests/test_pipeline_contract.py: 7 new L2 tests (l2 job exists, matrix
  lists both modules, apply/modify/destroy steps, needs ci-vpc-apply,
  ci-vpc-destroy needs both, contract matrix lists l2_modules)
- pipelines/README.md: updated stages for L2

Regression: 485 passed, 5 deselected. Gitea + GitHub workflows byte-identical.

---ci---
project: acdl
phase: P61
milestone: v1.11
status: execute
---/ci---
2026-07-28 20:17:27 +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):

environment: dev
id: assets
infrastructure:
  static-assets:
    inputs:
      bucket_name: my-static-assets
      region: us-east-1
    version: 1.0.0
name: static-assets

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:

environment: dev
id: assets
infrastructure:
  static-assets:
    inputs:
      bucket_name: my-static-assets
      region: us-east-1
    version: 1.0.0
name: static-assets

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, 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.yml

environment: dev
id: assets
infrastructure:
  static-assets:
    inputs:
      bucket_name: my-static-site
      region: us-east-1
    version: 1.0.0
name: static-assets

Complex

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

examples/complex.yml

environment: dev
id: assets
infrastructure:
  static-assets:
    inputs:
      bucket_name: my-production-static-site
      default_ttl: 3600
      max_ttl: 86400
      price_class: PriceClass_100
      region: us-east-1
      viewer_protocol_policy: redirect-to-https
      waf_enabled: true
    version: 1.0.0
name: static-assets

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.