stacks:
  - media-service

regions:
  - eu-west-1

allowedStages:
  - TEST
  - PROD

templates:
  autoscaling:
    type: autoscaling
    parameters:
    dependencies:
      - app-ami-update

  usage-autoscaling:
    type: autoscaling
    app: usage
    contentDirectory: usage
    parameters:
    dependencies:
      - app-ami-update

  usage-deploy:
    template: usage-autoscaling
    actions:
      - deploy
    dependencies:
      - usage

deployments:
  auth:
    template: autoscaling

  collections:
    template: autoscaling

  cropper:
    template: autoscaling

  image-loader:
    template: autoscaling

  image-loader-projection:
    template: autoscaling

  kahuna:
    template: autoscaling

  leases:
    template: autoscaling

  media-api:
    template: autoscaling

  metadata-editor:
    template: autoscaling

  thrall:
    template: autoscaling

  # Usage is confusingly a single artifact running twice with different configuration
  usage:
    template: usage-autoscaling
    actions:
      - uploadArtifacts

  usage-api:
    template: usage-deploy

  usage-stream:
    template: usage-deploy
    app: usage-stream

  imgops:
    template: autoscaling
    actions:
      - deploy

  app-ami-update:
    type: ami-cloudformation-parameter
    parameters:
      cloudFormationStackByTags: false
      cloudFormationStackName: media-service
      prependStackToCloudFormationStackName: false
      amiParametersToTags:
        AmiId:
          BuiltBy: amigo
          AmigoStage: PROD
          Recipe: editorial-tools-jammy-java11
        ImagingAmiId:
          BuiltBy: amigo
          AmigoStage: PROD
          Recipe: grid-imaging-jammy-java11
        ImgOpsAmiId:
          BuiltBy: amigo
          AmigoStage: PROD
          Recipe: grid-imgops-jammy

  elasticsearch-ami-update:
    type: ami-cloudformation-parameter
    parameters:
      cloudFormationStackByTags: false
      cloudFormationStackName: media-service-elasticsearch
      prependStackToCloudFormationStackName: false
      amiEncrypted: true
      amiParametersToTags:
        ElasticSearchAMI:
          BuiltBy: amigo
          AmigoStage: PROD
          Recipe: grid-elasticsearch-jammy-arm

  image-counter-lambda:
    type: aws-lambda
    parameters:
      prefixStack: false
      fileName: image-counter-lambda.zip
      functionNames:
        - "image-counter-lambda-function-"
