cookbook:
  environment:
    public:
    - GCP_REGION=us-central1
    - GCP_ZONE=us-central1-a
    - IMAGE=windows-cloud/windows-2022
    secrets:
    - GOOGLE_CREDENTIALS
  pages:
  - page: 1
    name: GCP Virtual Machine Provisioning
    recipes:
    - recipe: provision-gcp-vm-via-script
      description: Provisions a new GCP Virtual Machine.
      form:
      - variable: CUSTOM_IMAGE
        description: Custom Image (optional - leave empty to use dropdown selection
          below)
        type: text
        placeholder: project-id/image-family/image-name
      - variable: IS_WINDOWS
        description: Is the selected/custom image Windows? (used to configure RDP/SSH)
        type: select
        options:
        - label: Windows
          value: 'true'
        - label: Linux
          value: 'false'
      - variable: SSH_PORT
        description: SSH Port (optional, blank uses 22; custom ports must be 10000-65535)
        type: text
        defaults:
        - '10022'
        placeholder: '10022'
      - variable: IMAGE
        description: Select Operating System (used if Custom Image is empty)
        type: select
        options:
        - label: "\U0001FA9F Windows Server 2022"
          value: windows-cloud/windows-2022
        - label: "\U0001FA9F Windows Server 2022 Core"
          value: windows-cloud/windows-2022-core
        - label: "\U0001F427 Debian 11 (Linux)"
          value: debian-cloud/debian-11
        - label: "\U0001F427 Debian 12 (Linux)"
          value: debian-cloud/debian-12
      - variable: DISK_SIZE
        description: Boot Disk Size
        type: select
        options:
        - label: 20 GB
          value: '20'
        - label: 50 GB (Windows minimum)
          value: '50'
        - label: 60 GB
          value: '60'
        - label: 100 GB
          value: '100'
        - label: 200 GB
          value: '200'
      - variable: MACHINE_TYPE
        description: Select Machine Type
        type: select
        options:
        - label: N1 Custom 1 (1 vCPU, 1 GB RAM) - nested virtualization
          value: custom-1-1024
        - label: N1 Standard 1 (1 vCPU, 3.75 GB RAM) - nested virtualization
          value: n1-standard-1
        - label: N1 HighCPU 2 (2 vCPU, 1.8 GB RAM) - nested virtualization
          value: n1-highcpu-2
        - label: N2 HighCPU 2 (2 vCPU, 2 GB RAM) - nested virtualization
          value: n2-highcpu-2
        - label: N2 Custom 2 (2 vCPU, 2 GB RAM) - nested virtualization
          value: n2-custom-2-2048
        - label: N2 Custom 2 (2 vCPU, 4 GB RAM) - nested virtualization
          value: n2-custom-2-4096
        - label: N2 Standard 2 (2 vCPU, 8 GB RAM) - nested virtualization
          value: n2-standard-2
        - label: N2 Standard 4 (4 vCPU, 16 GB RAM) - nested virtualization
          value: n2-standard-4
        - label: N2 Standard 8 (8 vCPU, 32 GB RAM) - nested virtualization
          value: n2-standard-8
        - label: N2 Standard 16 (16 vCPU, 64 GB RAM) - nested virtualization
          value: n2-standard-16
      - variable: CUSTOM_MACHINE_TYPE
        description: Custom Machine Type (optional - overrides selection above)
        type: text
        placeholder: n2-standard-2
      - variable: ENABLE_NESTED_VIRTUALIZATION
        description: Nested Virtualization
        type: select
        options:
        - label: Enabled
          value: 'true'
        - label: Disabled
          value: 'false'
      - variable: RESOURCE_TAGS
        description: Additional Tags/Labels (optional, comma-separated)
        type: text
        placeholder: purpose=demo, sample
      now:
        steps:
        - step: 1
          name: provision gcp vm
          image: lemc-gcp-terraform-vm-custom-ssh-port:dev
          timeout: 10.minutes
          environment:
          - TERRAFORM_FUNCTION=apply
      in:
        duration: 12.hours
        steps:
        - step: 1
          name: destroy gcp vm after 12 hours
          image: lemc-gcp-terraform-vm-custom-ssh-port:dev
          timeout: 10.minutes
          environment:
          - TERRAFORM_FUNCTION=destroy
      canonical_name: provision-gcp-vm-via-script
    - recipe: create-image-from-instance
      description: Creates a custom disk image from the current running instance with
        LEMC tags.
      form:
      - variable: IMAGE_NAME
        description: Machine Image Name
        type: text
        placeholder: my-custom-image-name
      - variable: RESOURCE_TAGS
        description: Additional Tags/Labels (optional, comma-separated)
        type: text
        placeholder: purpose=demo, sample
      canonical_name: create-image-from-instance
      now:
        steps:
        - step: 1
          name: create image from instance
          image: lemc-gcp-terraform-vm-custom-ssh-port:dev
          environment:
          - TERRAFORM_FUNCTION=image
          timeout: 45.minutes
    - recipe: list-created-images
      description: Lists custom disk images created by the current LEMC username.
      form: []
      canonical_name: list-created-images
      now:
        steps:
        - step: 1
          name: list created images
          image: lemc-gcp-terraform-vm-custom-ssh-port:dev
          environment:
          - TERRAFORM_FUNCTION=list-images
          timeout: 5.minutes
    - recipe: destroy-gcp-vm-via-script
      description: Destroys the current running GCP Virtual Machine.
      form: []
      canonical_name: destroy-gcp-vm-via-script
      now:
        steps:
        - step: 1
          name: destroy gcp vm
          image: lemc-gcp-terraform-vm-custom-ssh-port:dev
          timeout: 10.minutes
          environment:
          - TERRAFORM_FUNCTION=destroy
  storage:
    wikis:
      1: PGgyPkJ1aWxkIEhvc3Q8L2gyPjxwPlVzZSBsYXVuY2gtc2luZ2xlLWhvc3QgdG8gc3RhcnQgYSBmcmVzaCBEZWJpYW4gYnVpbGQgVk0uIFBpY2sgdGhlIG1hY2hpbmUgdHlwZSBhbmQgYm9vdCBkaXNrIHNpemUgYmVmb3JlIGxhdW5jaGluZy48L3A+PHA+VXNlIGxhdW5jaC1mcm9tLW1hY2hpbmUtaW1hZ2UgdG8gc3RhcnQgZnJvbSBhIHByZXZpb3VzbHkgc2F2ZWQgR0NQIGltYWdlLiBQYXN0ZSB0aGUgZXhhY3QgaW1hZ2UgbmFtZSB5b3UgcmVjb3JkZWQgYWZ0ZXIgY3JlYXRpb24uIEJvdGggbGF1bmNoIHJlY2lwZXMgc2NoZWR1bGUgYSBkZXN0cm95IHN0ZXAgZm9yIDEyIGhvdXJzIGxhdGVyIGluIHRoZSBzYW1lIHNjb3BlLjwvcD48cD5Vc2UgZGVzdHJveS1zaW5nbGUtaG9zdCB3aGVuIHlvdSBhcmUgZG9uZSBlYXJseS4gSXQgdGVhcnMgZG93biB0aGUgVk0gYW5kIGNhbmNlbHMgdGhlIHBlbmRpbmcgMTItaG91ciBjbGVhbnVwIGZvciB0aGlzIHBhZ2UgYW5kIHNjb3BlLjwvcD4=
  name: GCP Terraform VM With Custom SSH Port
  canonical_name: lemc-gcp-terraform-vm-custom-ssh-port
