Skip to content

Extend entry input to support rules

Context

Part 1: &18546 - this is the foundational to support rules syntax and validates dependencies between inputs.

This will allow users to write:

spec:
  inputs:
    cloud_provider:
      options: ['aws', 'gcp']
    environment:
      options: ['development', 'production']
    instance_type:
      rules:
        - if: inputs.cloud_provider == 'aws' && inputs.environment == 'development'
          options: ['t3.micro', 't3.small']
          default: 't3.micro'
        - if: inputs.cloud_provider == 'gcp' && inputs.environment == 'production'
          options: ['e2-standard-4', 'e2-standard-8']
          default: 'e2-standard-4'
        - options: [] 

Technical Notes

  • Rules are mutually exclusive w options and default
  • Each rule can have options and/or defaul

Validation

Circular dependencies will be validated in the following issue, as it's slightly more complex.

cloud_provider -> (no dependencies)
environment -> (no dependencies)
instance_type -> depends on [cloud_provider, environment] # CORRECTO!

# Invalid
input_a -> depends on [input_b]
input_b -> depends on [input_a] # BAD!! CIRCULAR DEPENDENCY

Edited by Laura Montemayor