compose-x / ecs_composex

Manage, Configure and Deploy your services and AWS services and applications from your docker-compose definitions
https://docs.compose-x.io
Mozilla Public License 2.0
158 stars 16 forks source link

[BUG] x-cloud: should generate Vpc: Ref: VpcID #704

Closed thorfi closed 8 months ago

thorfi commented 8 months ago

Bug When using x-cloud: with a private namespace, the resulting Resources: entry generated contains Vpc: x-vpc:VpcId

It should use Vpc: Ref: VpcId instead.


Steps to reproduce the behavior:

  1. pip install
  2. cli tool
  3. Docker compose file
    x-cloudmap: # ecscomposex
    PrivateZone:
    ZoneName: foo.local
  4. Results in:
    Resources:
    PrivateZone:
    Properties:
      Name: foo.local
      Tags:
        - Key: CreatedByComposeX
          Value: true
        - Key: compose-x:version
          Value: 0.23.27-rc0
      Vpc: x-vpc:VpcId
    Type: AWS::ServiceDiscovery::PrivateDnsNamespace

Expected behavior

Resources:
  PrivateZone:
    Properties:
      Name: foo.local
      Tags:
        - Key: CreatedByComposeX
          Value: true
        - Key: compose-x:version
          Value: 0.23.27-rc0
      Vpc:
        Ref: VpcId
    Type: AWS::ServiceDiscovery::PrivateDnsNamespace

Logs Not applicable

Desktop (please complete the following information):

JohnPreston commented 8 months ago

Hi @thorfi Thanks for reporting this. If the resolution of x-vpc::VpcID is not working then I need to look into that. There is a post-processing function that would make the modules go over properties of any resource and replace the value with the right thing.

Have you checked whether this works both when you create and lookup the VPC by any chance?

JohnPreston commented 8 months ago

I have tested with the following (creates the VPC)

x-cloudmap: # ecscomposex
  PrivateZone:
    ZoneName: foo.local

And I get

Resources:
  PrivateZone:
    Properties:
      Name: foo.local
      Tags:
        - Key: CreatedByComposeX
          Value: true
        - Key: compose-x:version
          Value: 0.23.27-rc2
      Vpc:
        Ref: VpcId
    Type: AWS::ServiceDiscovery::PrivateDnsNamespace

However, I do see the bug when using x-vpc.Lookup Can you just confirm for me that you are getting that error when doing x-vpc.Lookup please?