Parameters:
  ProjectName:
    Type: String
    Description: Project name to link stacks
  MeshName:
    Type: String
    Description: Name of the shared mesh
  MeshOwner:
    Type: String
    Description: Account Id of the owner of the mesh

Resources:
  BackendNode:
    Type: AWS::AppMesh::VirtualNode
    Properties:
      MeshName: !Ref MeshName
      MeshOwner: !Ref MeshOwner
      VirtualNodeName: backend-2-vn
      Spec:
        Listeners:
        - PortMapping:
            Port: 80
            Protocol: http
        ServiceDiscovery:
          AWSCloudMap:
            NamespaceName: !Sub 'secondary.${ProjectName}.local'
            ServiceName: backend
