Skip to content

CNC Framework AWS ECS: Persistent ValidationError "Unable to extract tag using discriminator 'type'" #185

@dschmidtadv

Description

@dschmidtadv

name: CNC Build Failure Bug Report
about: Report a persistent ValidationError during cnc build.
title: 'Bug: Persistent ValidationError on cnc build for AWS ECS'
labels: 'bug, aws, ecs'
assignees: ''


Description

I am encountering a persistent ValidationError when running cnc build for a standard AWS ECS project. Despite ensuring my cnc.yml and environments.yml files are minimal and align with the official documentation, the build consistently fails.

The error indicates a problem with parsing the service definitions and incorrectly references a GCP provider, even though the configuration is exclusively for AWS.

Error Trace

ValidationError: 5 validation errors for Application
collections.0.function-after[annotate_children(), AWSEnvironmentCollection].environments.0.services.0.x-cnc
  Unable to extract tag using discriminator 'type' [type=union_tag_not_found, input_value={'provider': 'aws'}, input_type=dict]
collections.0.function-after[annotate_children(), AWSEnvironmentCollection].environments.0.services.1.x-cnc
  Unable to extract tag using discriminator 'type' [type=union_tag_not_found, input_value={'provider': 'aws'}, input_type=dict]
...
collections.0.function-after[annotate_children(), GCPEnvironmentCollection].provider
  Input should be 'gcp' [type=literal_error, input_value='aws', input_type=str]

environments.yml

name: drupal-app
provider: aws
flavor: ecs
version: 1.0
collections:
  - name: drupal-app
    provider: aws
    account_id: "211125583596"
    environments:
      - name: dev
        region: us-east-1
        domain: dev-drupal-app.cns-sites.com
        tags:
          Environment: dev

cnc.yml

application:
  name: drupal-app
  tags:
    ManagedBy: coherence
    Application: drupal-app
services:
  drupal-web:
    x-cnc: {}
    type: backend
    build:
      context: .
      dockerfile: Dockerfile
    cpu: 1024
    memory: 2048
    ports:
      - "80"
    environment:
      DRUPAL_DB_HOST: db.host
      DRUPAL_DB_USER: db.username
      DRUPAL_DB_PASSWORD: db.password
      DRUPAL_DB_NAME: db.dbname
  drupal-db:
    x-cnc: {}
    type: database
    image: mysql:5.7
    engine: mysql
    instanceType: db.t3.small
    dedicated: true

Troubleshooting Steps Completed

  • Confirmed both YAML files align with CNC documentation.
  • Upgraded and reinstalled the cnc-framework package.
  • Cleared all local cache and build artifacts (.cnc, .coherence, build/, etc.).
  • The error persists across all attempts.

Conclusion

The issue appears to be a bug or a breaking schema change within the CNC Framework, as the configuration files are valid according to the documentation.

Request

Could you please advise if this is a known issue or if there is a workaround? Any clarification on the expected schema would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions