apiVersion: xl/v2
kind: Blueprint

metadata:
  name: GKE-Cluster
  description: |
    The blueprint provisions a GCP GKE Cluster using Terraform and XL Deploy.
  author: XebiaLabs
  version: 2.0
  instructions: Read xebialabs/USAGE-gcp-basic-gke-cluster.md to learn how to use this blueprint.

spec:
  parameters:
  - name: GCPProjectID
    type: Input
    prompt: What is the GCP project ID?
  - name: K8SMasterUser
    type: Input
    prompt: What is the username for Kubernetes cluster?
    default: admin
  - name: K8SMasterPassword
    type: SecretInput
    prompt: What is the password for Kubernetes cluster? (minimum 16 characters)
    validate: !expr "regex('^(\\\\S){16,}$', K8SMasterPassword)"
  - name: ClusterName
    type: Input
    prompt: What is the name of the cluster?
  - name: GCPRegion
    type: Select
    prompt: "Select the GCP region:"
    options:
    - label: Taiwan
      value: asia-east1
    - label: Hong Kong
      value: asia-east2
    - label: Japan
      value: asia-northeast1
    - label: India
      value: asia-south1
    - label: Singapore
      value: asia-southeast1
    - label: Australia (Sydney)
      value: australia-southeast1
    - label: Finland
      value: europe-north1
    - label: Belgium
      value: europe-west1
    - label: England
      value: europe-west2
    - label: Germany
      value: europe-west3
    - label: Netherlands
      value: europe-west4
    - label: Canada
      value: northamerica-northeast1
    - label: Brazil
      value: southamerica-east1
    - label: Iowa, USA
      value: us-central1
    - label: South Carolina, USA
      value: us-east1
    - label: Northern Virginia, USA
      value: us-east4
    - label: Oregon, USA
      value: us-west1
    - label: California, USA
      value: us-west2
  - name: GKENumNodes
    type: Input
    prompt: What is the number of nodes in each GKE cluster zone?
    default: 2
  - name: GKENodeMachineType
    type: Select
    prompt: What is the machine type of the GKE nodes?
    options:
    - n1-standard-1
    - n1-standard-2
    - n1-standard-4
    - n1-standard-8
    - n1-standard-16
    - n1-standard-32
    - n1-standard-64
    - n1-standard-96
    - n1-highmem-2
    - n1-highmem-4
    - n1-highmem-8
    - n1-highmem-16
    - n1-highmem-32
    - n1-highmem-64
    - n1-highmem-96
    - n1-highcpu-2
    - n1-highcpu-4
    - n1-highcpu-8
    - n1-highcpu-16
    - n1-highcpu-32
    - n1-highcpu-64
    - n1-highcpu-96
    - f1-micro
    - g1-small
    - n1-ultramem-40
    - n1-ultramem-80
    - n1-ultramem-160
    - n1-megamem-96

  - name: GenerateDockerComposeSetup
    type: Confirm
    prompt: "Do you want to generate a docker-compose setup with the 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: false
    - name: JetPackOrEnterprise
      value: "XL Enterprise"
    - name: XLVersion
      value: "9.0.0"
    - name: UseDockerProxy
      value: false
    - name: UseJenkins
      value: false

  files:
  # XebiaLabs
  - path: xebialabs/USAGE-gcp-basic-gke-cluster.md.tmpl
  - path: xebialabs/gcp-basic-gke-cluster.yaml.tmpl
  - path: xebialabs.yaml
  # Terraform
  - path: terraform-gcp-basic-gke-cluster/gke/main.tf
  - path: terraform-gcp-basic-gke-cluster/gke/outputs.tf
  - path: terraform-gcp-basic-gke-cluster/gke/variables.tf
  - path: terraform-gcp-basic-gke-cluster/vpc/main.tf
  - path: terraform-gcp-basic-gke-cluster/vpc/outputs.tf
  - path: terraform-gcp-basic-gke-cluster/vpc/variables.tf
  - path: terraform-gcp-basic-gke-cluster/.gitignore
  - path: terraform-gcp-basic-gke-cluster/main.tf
  - path: terraform-gcp-basic-gke-cluster/outputs.tf
  - path: terraform-gcp-basic-gke-cluster/variables.tf
