Skip to content

[BUG] x-elbv2 throws validation error using environment variable to set Service port #778

@dfrank-a

Description

@dfrank-a

Using docker run and the latest image, the relevant snippet of my docker-compose file is:

x-elbv2:
  testALB:
    Properties:
      Scheme: internal
      Type: application
      LoadBalancerAttributes:
        deletion_protection.enabled: "false"
    MacroParameters:
      Ingress:
        ExtSources:
          - IPv4: 0.0.0.0/0
            Name: ANY
            Description: "ANY"
    Listeners:
      - Port: 80
        Protocol: HTTP
        DefaultActions:
          - Redirect: HTTP_TO_HTTPS
      - Port: 443
        Protocol: HTTPS
        Certificates:
          - CertificateArn: REDACTED
        Targets:
          - name: family:service
            access: service.com/
    Services:
      'family:service': 
        port: ${FAMILY_SERVICE_PORT}
        protocol: HTTP
        healthcheck: ${FAMILY_SERVICE_PORT}:HTTP:7:2:15:5:/health_check/:200

And .env containing:

FAMILY_SERVICE_PORT=8080
2024-09-03 17:53:39 [   ERROR] elbv2.testALB - Definition is not conform to schema.
Traceback (most recent call last):
  File "/usr/local/bin/ecs-compose-x", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/ecs_composex/cli.py", line 206, in main
    root_stack = generate_full_template(settings)
  File "/usr/local/lib/python3.10/site-packages/ecs_composex/ecs_composex.py", line 248, in generate_full_template
    settings.mod_manager.init_mods_resources(settings)
  File "/usr/local/lib/python3.10/site-packages/ecs_composex/mods_manager.py", line 307, in init_mods_resources
    module.set_resources(settings)
  File "/usr/local/lib/python3.10/site-packages/ecs_composex/mods_manager.py", line 266, in set_resources
    new_definition = self.resource_class(
  File "/usr/local/lib/python3.10/site-packages/ecs_composex/elbv2/elbv2_stack/elbv2.py", line 75, in __init__
    super().__init__(name, definition, module, settings)
  File "/usr/local/lib/python3.10/site-packages/ecs_composex/compose/x_resources/network_x_resources.py", line 37, in __init__
    super().__init__(name, definition, module, settings)
  File "/usr/local/lib/python3.10/site-packages/ecs_composex/compose/x_resources/services_resources.py", line 39, in __init__
    super().__init__(name, definition, module, settings)
  File "/usr/local/lib/python3.10/site-packages/ecs_composex/compose/x_resources/__init__.py", line 79, in __init__
    self.validate_schema(name, definition, module.mod_key)
  File "/usr/local/lib/python3.10/site-packages/ecs_composex/compose/x_resources/__init__.py", line 191, in validate_schema
    _eval.validate(definition)
  File "/usr/local/lib/python3.10/site-packages/jsonschema/validators.py", line 451, in validate
    raise error
jsonschema.exceptions.ValidationError: '8080' is not of type 'integer'

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions