# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintMetadata
metadata:
  name: terraform-google-load-balanced-vms
  annotations:
    config.kubernetes.io/local-config: "true"
spec:
  info:
    title: Load balanced managed VMs
    source:
      repo: https://github.com/GoogleCloudPlatform/terraform-google-load-balanced-vms.git
      sourceType: git
    version: 0.6.0
    actuationTool:
      flavor: Terraform
      version: '>= 0.13'
    description:
      tagline: Create a Managed Instance Group exposed by a HTTP Load Balancer.
      detailed: |-
        Create a virtual machine cluster with a load balancer to make the VMs globally available, and instantaneously manage traffic.
        You can choose whether to deploy your solution through the console directly or download as Terraform on GitHub  to deploy later.
      architecture:
      - The user makes a request to the application deployed on Compute Engine and the request first lands on Cloud Load Balancing.
      - Cloud Load Balancing distributes the traffic to the Compute Engine Managed Instance Group (MIG) which is set up to scale to multiple instances based on traffic growth.
  content:
    documentation:
    - title: Architecture Diagram
      url: https://github.com/GoogleCloudPlatform/terraform-google-load-balanced-vms/blob/main/assets/load_balanced_vms_v1.svg
    examples:
    - name: simple_example
      location: examples/simple_example
  interfaces:
    variables:
    - name: deployment_name
      description: The name of this particular deployment, will get added as a prefix to most resources.
      varType: string
      defaultValue: load-balanced-vms
    - name: enable_apis
      description: Whether or not to enable underlying apis in this solution. .
      varType: string
      defaultValue: true
    - name: labels
      description: A map of labels to apply to contained resources.
      varType: map(string)
      defaultValue:
        load-balanced-vms: true
    - name: network_id
      description: VPC network to deploy VMs in. A VPC will be created if not specified.
      varType: string
      defaultValue: ""
    - name: network_project_id
      description: Shared VPC host project ID if a Shared VPC is provided via network_id.
      varType: string
      defaultValue: ""
    - name: nodes
      description: The number of nodes in the managed instance group
      varType: string
      required: true
    - name: project_id
      description: The project ID to deploy to
      varType: string
      required: true
    - name: region
      description: The Compute Region to deploy to
      varType: string
      required: true
    - name: subnet_self_link
      description: Subnetwork to deploy VMs in. A Subnetwork will be created if not specified.
      varType: string
      defaultValue: ""
    - name: zone
      description: The Compute Zone to deploy to
      varType: string
      required: true
    outputs:
    - name: console_page_for_load_balancer
      description: The url of the load balancer page in console
    - name: load_balancer_endpoint
      description: The url of the front end which we want to surface to the user
    - name: neos_tutorial_url
      description: The URL to launch the in-console tutorial for the Load balanced managed VMs solution
  requirements:
    roles:
    - level: Project
      roles:
      - roles/owner
    services:
    - serviceusage.googleapis.com
    - compute.googleapis.com
    - cloudresourcemanager.googleapis.com
