apiVersion: xl/v2
kind: Blueprint

metadata:
  name: AWS-Monolith-ECS-Fargate
  description: |
    The blueprint deploys a monolithic application generated with JHipster, to AWS ECS with the Fargate launch type.
    XL Deploy does the provisioning and deployment, while XL Release orchestrates everything.
  author: XebiaLabs
  version: 2.0
  instructions: Please read the generated file "xebialabs/USAGE.md" for further usage instructions.
  
spec:
  parameters:
  - name: AppName
    type: Input
    prompt: What is the Application name (maximum 25 characters)?
    validate: !expr "regex('^(\\\\S){0,25}$', AppName)"
  - name: PublicPort
    description: The port that the application shoule be exposed
    value: 80
  - name: MySQLMasterPassword
    type: SecretInput
    prompt: What should be the password for MySQL? (minimum 8 characters)
    validate: !expr "regex('^(\\\\S){8,}$', MySQLMasterPassword)"
  - name: UseAWSCredentialsFromSystem
    type: Confirm
    prompt: Do you want to use AWS credentials from ~/.aws/credentials file?
    promptIf: !expr "awsCredentials('IsAvailable')"
  - name: AWSAccessKey
    type: SecretInput
    prompt: What is the AWS Access Key ID?
    promptIf: !expr "!UseAWSCredentialsFromSystem"
    default: !expr "awsCredentials('AccessKeyID')"
  - name: AWSAccessSecret
    type: SecretInput
    prompt: What is the AWS Secret Access Key?
    promptIf: !expr "!UseAWSCredentialsFromSystem"
    default: !expr "awsCredentials('SecretAccessKey')"
  - name: AWSRegion
    type: Select
    prompt: "Select the AWS region:"
    saveInXlvals: true
    default: !expr "awsRegions('ecs', 0)"
    options:
      - !expr "awsRegions('ecs')"

  - name: GenerateDockerComposeSetup
    type: Confirm
    prompt: "Do you want to generate a docker-compose setup with the required tools to run this blueprint?"
    default: false

  includeAfter:
  - blueprint: xl-devops-platform
    includeIf: GenerateDockerComposeSetup
    parameterOverrides:
    - name: UseXLDeploy
      value: true
    - name: XLDeployPort
      value: 4516
    - name: UseXLRelease
      value: true
    - name: XLReleasePort
      value: 5516
    - name: XLVersion
      value: "9.0"
    - name: UseDockerProxy
      value: false
    - name: UseJenkins
      value: false

  files:
  - path: xebialabs/xld-infrastructure.yaml.tmpl
  - path: xebialabs/xld-service.yaml.tmpl
  - path: xebialabs/xld-environment.yaml.tmpl
  - path: xebialabs/xlr-pipeline.yaml.tmpl
  - path: xebialabs/USAGE.md.tmpl
  - path: xebialabs.yaml
