Skip to content

[BUG] An error occurred (ValidationError) when calling the CreateChangeSet operation: Stack [microservices] already exists and cannot be created again with the changeSet [microserviceslisoguuxne].  #785

Open
@raffidahmad

Description

@raffidahmad

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. How you installed ECS ComposeX: pip
  2. How you are executing it ? : As a CLI tool

Docker compose file:

services:
  yarp:
    <<: *env
    container_name: yarp
    image: microservices/yarp:develop-${BITBUCKET_COMMIT}
    build:
      <<: *build-context
      dockerfile: ./APIGateway/Yarp/Dockerfile
    ports:
      - "55560:55560"
    deploy:
      <<: *deploy_config
      labels:
        ecs.task.family: proxy
      replicas: 1
  user-management:
    <<: *env
    container_name: user-management
    image: microservices/user-management:${TAG:-develop-${BITBUCKET_COMMIT}}
    depends_on:
      - yarp
    build:
      <<: *build-context
      dockerfile: ./Microservices/UserManagementService/Dockerfile
    ports:
      - "55567:55567" # for http #TODO: move to .env file + code + compose-x
#      - "55667:55667" # for grpc
    deploy:
      <<: *deploy_config
      labels:
        ecs.task.family: user-management
      replicas: 1

aws-compose-extension:

services:
  yarp:
    image: ${AWS_ACCOUNT_ID}.dkr.ecr.$AWS_REGION.amazonaws.com/microservices/yarp:develop-$BITBUCKET_COMMIT
    x-ecr:
      InterpolateWithDigest: true
    x-aws-role: # equivalent to x-iam https://docs.compose-x.io/syntax/ecs_plugin/support.html#x-aws-role
      <<: *ecs-task-role
  user-management:
    image: ${AWS_ACCOUNT_ID}.dkr.ecr.$AWS_REGION.amazonaws.com/microservices/user-management:${TAG:-develop-$BITBUCKET_COMMIT}
    x-ecr:
      InterpolateWithDigest: true
    x-aws-role:
      <<: *ecs-task-role

x-cluster:
  Lookup:
    ClusterName: compose-cluster
  Properties:
    CapacityProviders:
      - FARGATE
      - FARGATE_SPOT
    DefaultCapacityProviderStrategy:
      - CapacityProvider: FARGATE_SPOT
        Base: 1
        Weight: 1

x-elbv2:
  lb-microservices-develop:
    Lookup:
      loadbalancer:
        Tags:
          project: ntp
          env: develop
    Listeners:
      - Port: 55560
        Protocol: HTTPS
        Targets:
          - name: proxy:yarp
            access: /
        Certificates:
          - x-acm: cert-acm
      - Port: 55567
        Protocol: HTTPS
        Targets:
          - name: user-management:user-management:55567
            access: /
        Certificates:
          - x-acm: cert-acm
      - Port: 55667
        Protocol: HTTPS
        Targets:
          - name: user-management:user-management:55667
            access: /
        Certificates:
          - x-acm: cert-acm
#    TargetGroups:
#      yarp:
#        Port: 55560
#        Protocol: HTTP
#        HealthCheck: 55560:HTTP:2:2:30:5:/health:200
#        Services:
#          - Name: proxy:yarp
#            Port: 55560
#      user-management-default:
#        Port: 55567
#        Protocol: HTTP
#        HealthCheck: 55567:HTTP:2:2:30:5:/health:200
#        Services:
#          - Name: user-management:user-management
#            Port: 55567
#      user-management-grpc:
#        Port: 55667
#        Protocol: HTTP
#        HealthCheck: 55667:HTTP:2:2:30:5:/health:200,299
#        Services:
#          - Name: user-management:user-management
#            Port: 55667
    Services:
      proxy:yarp:
        port: 55560
        protocol: HTTP
        healthcheck: 55560:HTTP:2:2:30:5:/health:200
      user-management:user-management:
        port: 55567
        protocol: HTTP
        healthcheck: 55567:HTTP:2:2:30:5:/health:200
#      user-management:user-management:55667:
#        port: 55667
#        protocol: HTTP
#        healthcheck: 55667:HTTP:2:2:30:5:/health:200,299

Expected behavior
I first create my stack using only 1 service, it works
ecs-compose-x plan -f compose.yaml -f compose.ecs-extension.yaml -n microservices

Then i add another service, its listener (i cant add the :port that also fails for some reason)
and when i run the same plan command again
ecs-compose-x plan -f compose.yaml -f compose.ecs-extension.yaml -n microservices

everything works seemingly but when it's supposed to show the changeset it throws an error that the stack already exists. When it should just update the stack and add the new ones.
Or am i doing this wrong?

Logs
Error from compose-x after everything is done:
An error occurred (ValidationError) when calling the CreateChangeSet operation: Stack [microservices] already exists and cannot be created again with the changeSet [microserviceslisoguuxne].

Desktop (please complete the following information):

  • OS: Linux/Windows
  • Python version (3.12)
  • Version: latest release

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