Skip to content

Validate variable.inputs structure matches output types defined in facets.yaml inputs #53

@anujhydrabadi

Description

@anujhydrabadi

Problem

The validation process needs to ensure that inputs defined in the variable.inputs block in variables.tf are correctly structured based on the output lookup tree of the output types specified in the inputs section of facets.yaml.

Currently, there's no validation to verify that when a module's facets.yaml defines inputs with specific output types, the corresponding variables.tf file's variable.inputs object structure matches the expected output schema.

Current State

  • facets.yaml contains an inputs section defining input requirements with output types
  • variables.tf contains a variable "inputs" block with object type definition
  • No validation exists to ensure the Terraform inputs structure matches the expected output lookup tree

Expected Behavior

When running validation commands (like ftf validate-directory), the tool should:

  1. Parse the inputs section from facets.yaml to identify required input output types
  2. Fetch the output lookup tree/schema for each specified output type
  3. Parse the variable.inputs type definition from variables.tf
  4. Validate that the Terraform inputs structure matches the expected output schemas
  5. Report any mismatches or missing input definitions with clear error messages

Example

If facets.yaml defines:

inputs:
  database:
    type: "@outputs/postgres"
  storage:
    type: "@outputs/s3"

Then variables.tf should have matching structure in the inputs variable that corresponds to the output schemas of postgres and s3 modules.

Impact

This validation will ensure that modules correctly define their input dependencies and prevent runtime errors due to mismatched input structures.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions