c80060878a
EXECUTE stage. Authors the remaining 11 L1 module terraform subdirs with the full versions/variables/locals/main/outputs split. Defaults previously hardcoded in the adapter move into locals.tf. Simple single-resource modules (7): - kms-key: aws_kms_key + alias (enable_key_rotation, deletion_window defaults) - ecr: aws_ecr_repository (encryption_configuration from kms_key_arn, image_scanning) - ecs-cluster: aws_ecs_cluster (name default) - iam-role: aws_iam_role + inline_policy (assume_role_policy fallback, ECR/logs policy in locals.tf) - rds: aws_db_instance (storage_encrypted, multi_az, kms_key_arn defaults) - waf: aws_wafv2_web_acl (default_action, visibility_config, dynamic rules) - uptime: aws_ecs_task_definition + aws_ecs_service (Fargate compat, container_definitions in locals.tf) Multi-resource modules with intra-refs (4): - vpc: aws_vpc + aws_subnet + aws_internet_gateway + aws_route_table (CIDR derivation in locals.tf) - ecs-service: aws_ecs_task_definition + aws_ecs_service (Fargate compat, container_definitions, network_config in locals.tf) - alb: aws_lb + aws_lb_target_group + aws_lb_listener (subnet/security_group list derivation in locals.tf) - cloudfront: aws_cloudfront_distribution + aws_cloudfront_origin_access_control (OAC defaults in locals.tf) Registry: terraform_dir added to all 11 remaining entries. Adapter fix: stack output format uses separate 'from' + 'output' fields (not 'from': 'rid.output'). Fixed _emit_root_output to read both fields. 6 previously-skipped tests unblocked (run_platform.sh --check-only now resolves static-assets.yml through the new module-assembled adapter). Removed skip markers. Fixed test assertion (aws_s3_bucket → module). Regression: 461 passed, 0 skipped, 5 deselected (slow). All 12 modules pass run_primitive_plan.sh --check-only. All 12 terraform/ subdirs pass terraform init + validate standalone. ---ci--- project: acdl phase: P56b milestone: v1.11 status: execute ---/ci---
ACDL Adapters
Overview
Adapters translate the engine-agnostic Target Stack IR to engine-specific formats. The Terraform adapter is the primary adapter (IR → HCL). Policy adapters translate security tool output into normalized PolicyCheckResult records that the confidence signal consumes in an engine-agnostic way.
Existing Adapters
| Adapter | Path | Input | Output | Purpose |
|---|---|---|---|---|
| Terraform adapter | adapters/terraform/adapter.py |
Stack instance JSON | Terraform HCL (main.tf, terraform.tf, providers.tf) |
Compiles IR to Terraform |
| Checkov adapter | adapters/terraform/policy/checkov_adapter.py |
Checkov JSON | PolicyCheckResult records |
Translates Checkov results |
| Wiz adapter | adapters/wiz/wiz_adapter.py |
Wiz API issues JSON | PolicyCheckResult records |
Translates Wiz security findings |
| Kyverno adapter | adapters/kyverno/kyverno_adapter.py |
Kyverno PolicyReport JSON | PolicyCheckResult records |
K8s-native policy translation |
How to Write an Adapter
Terraform Adapter Extension
- Add a stack type → Terraform type mapping to
TYPE_MAP. - Add non-identity input mappings to
INPUT_MAP. - Add non-identity output mappings to
OUTPUT_MAP. - Add a specialized
_emit_resourcebranch if the resource needs nested blocks (e.g. inline policies, rule sets).
Policy Adapter Pattern
- Define
SEVERITY_MAPandRESULT_MAPdicts that translate the engine's native severity/result vocabulary to thePolicyCheckResultenums. - Implement
_to_pcr(raw_record, contract_id)→PolicyCheckResultdict. - Implement
adapt(input_path, contract_id)→ list ofPolicyCheckResultdicts. - Implement
is_configured()→ bool (env var check) so the platform can skip the adapter when credentials are absent.
How to Wire an Adapter
- Terraform adapter — invoked by
scripts/run_platform.shStep 3 (terraform-plan). - Checkov adapter — invoked by
scripts/run_platform.shStep 5 (checkov). - Wiz / Kyverno adapters — optional Steps 5b/5c, run only when the relevant env vars are set.
- All policy adapters output records that are validated against
schemas/policy_check_result.schema.json.
Dependencies
jsonschema,pyyaml— used by all adapters for loading and validating inputs.boto3— used by the Wiz adapter for AWS API access.checkov— used by the Checkov adapter to run policy scans.- No external deps for the Terraform adapter (pure Python).
How to Test Adapters
tests/test_adapter.py— Terraform adapter (TYPE_MAP, resource emission, refs, outputs).tests/test_checkov_adapter.py— Checkov adapter.tests/test_wiz_adapter.py— Wiz adapter.tests/test_kyverno_adapter.py— Kyverno adapter.- All adapter tests load fixtures from
tests/fixtures/and usemotofor AWS mocking.
Where to Write Tests
tests/test_<adapter_name>.pypaired withtests/fixtures/<adapter>_fixture.json.
Adding a New Adapter
- Create
adapters/<name>/<name>_adapter.py. - Implement
adapt()and (for policy adapters)is_configured(). - Add the adapter's engine name to the
engineenum inschemas/policy_check_result.schema.jsonif it is a policy adapter. - Write a test (
tests/test_<name>_adapter.py) plus a fixture (tests/fixtures/<name>_fixture.json). - Add it to
scripts/run_platform.shif it is invoked at runtime. - Update this README.