apiVersion: xl/v2
kind: Blueprint

metadata:
  name: basic-arm-template
  description: |
    This blueprint provisions a single VM using an ARM template. XL Deploy does the provisioning.
  author: XebiaLabs
  version: 2.0
  instructions: Please read the generated file "xebialabs/USAGE-basic-arm-template.md" for further usage instructions.

spec:
  parameters:
  - name: AppName
    type: Input
    prompt: What do you want to name the application?
    validate: !expr "regex('^[a-zA-Z][\\\\w-]{1,29}[\\\\w]$', AppName)"

  - name: TemplateFile
    type: Input
    prompt: "Path to the ARM template file:"
    default: ../arm-basic-arm-template/template.json

  - name: AdminUsername
    type: Input
    prompt: "Admin username for logging into the VM:"
    default: azure

  - name: AdminPassword
    type: SecretInput
    prompt: "Admin password for logging into the VM:"
    description: "The supplied password must be between 6-72 characters long and must satisfy at least 3 of password complexity requirements from the following: (1) Contains an uppercase character, (2) Contains a lowercase character, (3) Contains a numeric digit, (4) Contains a special character, (5) Control characters are not allowed"
    validate: !expr "strlen(AdminPassword) >= 6 && strlen(AdminPassword) <= 72"

  includeAfter:
  - blueprint: fragments/azure-resourcegroup-location

  - blueprint: fragments/azure-credentials

  - blueprint: xl-devops-platform
    parameterOverrides:
    - name: UseXLDeploy
      value: true
    - name: UseXLRelease
      value: true
    - name: XLVersion
      value: "9.0"
    - name: UseDockerProxy
      value: false
    - name: UseJenkins
      value: false

  files:
  # XebiaLabs
  - path: xebialabs.yaml
  - path: README.md
  - path: xebialabs/USAGE-basic-arm-template.md.tmpl
  - path: xebialabs/xld-basic-arm-template-applications.yaml.tmpl
  - path: xebialabs/xld-basic-arm-template-infrastructure.yaml.tmpl
  - path: xebialabs/xld-basic-arm-template-environments.yaml.tmpl
  - path: xebialabs/xlr-basic-arm-template-pipeline-ci-cd.yaml.tmpl
  - path: xebialabs/xlr-basic-arm-template-pipeline-destroy.yaml.tmpl
  # Azure
  - path: arm-basic-arm-template/template.json
    writeIf: !expr "TemplateFile == '../arm-basic-arm-template/template.json'"
