How to do I perform Atmos overrides for a specific...
# atmos
j
How to do I perform Atmos overrides for a specific component? I need to override a schema validation that targets a specific component and not the whole stack.
✅ 1
g
@Andriy Knysh (Cloud Posse)
a
Copy code
components:
  terraform:
    infra/vpc:
      metadata:
        component: infra/vpc
      backend:
        s3:
          workspace_key_prefix: infra-vpc
      settings:
        # Validation
        # Supports JSON Schema and OPA policies
        # All validation steps must succeed to allow the component to be provisioned
        validation:
          validate-infra-vpc-component-with-jsonschema:
            schema_type: jsonschema
            # 'schema_path' can be an absolute path or a path relative to 'schemas.jsonschema.base_path' defined in `atmos.yaml`
            schema_path: "vpc/validate-infra-vpc-component.json"
            description: Validate 'infra/vpc' component variables using JSON Schema
          check-infra-vpc-component-config-with-opa-policy:
            schema_type: opa
            # 'schema_path' can be an absolute path or a path relative to 'schemas.opa.base_path' defined in `atmos.yaml`
            schema_path: "vpc/validate-infra-vpc-component.rego"
            # An array of filesystem paths (folders or individual files) to the additional modules for schema validation
            # Each path can be an absolute path or a path relative to `schemas.opa.base_path` defined in `atmos.yaml`
            # In this example, we have the additional Rego modules in `stacks/schemas/opa/catalog/constants`
            module_paths:
              - "catalog/constants"
            description: Check 'infra/vpc' component configuration using OPA policy
            # Set `disabled` to `true` to skip the validation step
            # `disabled` is set to `false` by default, the step is allowed if `disabled` is not declared
            disabled: false
            # Validation timeout in seconds
            timeout: 10
settings
is a first-class section (similar to
vars
) meaning it can be defined at any level (org, tenant, region, account, base component, component)
any attributes or sections inside
settings
(e.g.
settings.validation
) are inherited from all the top-level down to the component level
at the component level, you can define JSONSchema and/or OPA policies to validate just that component
@Jonathan Rose
if you have configured a validation schema at some level (e.g. stack), you can use the same key at the component level (e.g.
check-infra-vpc-component-config-with-opa-policy
in the example above) - this will completely override the schema (and not merge the map keys)
j
Works! Thank you very much.
👍 1