# 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-dynamic-javascript-webapp
  annotations:
    config.kubernetes.io/local-config: "true"
spec:
  info:
    title: terraform-dynamic-javascript-webapp
    source:
      repo: https://github.com/GoogleCloudPlatform/terraform-dynamic-javascript-webapp.git
      sourceType: git
      dir: /infra
    version: 0.0.1
    actuationTool:
      flavor: Terraform
      version: '>= 0.13'
    description:
      tagline: This is an auto-generated module.
      detailed: 'This module was generated from '
      preDeploy: To deploy this blueprint you must have an active billing account and billing permissions.
  content:
    examples:
    - name: simple_example
      location: examples/simple_example
  interfaces:
    variables:
    - name: deployment_name
      description: Identifier for the deployment. Used in some resource names.
      varType: string
      defaultValue: dev-journey
    - name: enable_apis
      description: Whether or not to enable underlying apis in this solution.
      varType: bool
      defaultValue: true
    - name: init_firestore
      description: Whether or not to initialize a Firestore instance.
      varType: bool
      defaultValue: true
    - name: initial_run_image
      description: Initial image to deploy to Cloud Run service.
      varType: string
      defaultValue: gcr.io/hsa-public/developer-journey/app
    - name: labels
      description: A set of key/value label pairs to assign to the resources deployed by this solution.
      varType: map(string)
      defaultValue: {}
    - name: project_id
      description: The project ID to deploy resources to.
      varType: string
      required: true
    - name: region
      description: Google Cloud region
      varType: string
      defaultValue: us-central1
    outputs:
    - name: frontend_url
      description: IP address to site. Load balancer expected to take ~5 minutes for it to warm up.
    - name: neos_toc_url
      description: Tutorial URL
    - name: run_service_name
      description: The name of the deployed Cloud Run service.
  requirements:
    roles:
    - level: Project
      roles:
      - roles/browser
      - roles/cloudasset.viewer
      - roles/compute.loadBalancerAdmin
      - roles/compute.networkAdmin
      - roles/firebase.developAdmin
      - roles/iam.serviceAccountCreator
      - roles/iam.serviceAccountDeleter
      - roles/iam.serviceAccountUser
      - roles/resourcemanager.projectIamAdmin
      - roles/run.admin
      - roles/secretmanager.admin
      - roles/serviceusage.serviceUsageAdmin
      - roles/storage.admin
    services:
    - cloudasset.googleapis.com
    - cloudbuild.googleapis.com
    - cloudresourcemanager.googleapis.com
    - compute.googleapis.com
    - firestore.googleapis.com
    - iam.googleapis.com
    - run.googleapis.com
    - secretmanager.googleapis.com
    - serviceusage.googleapis.com
    - storage.googleapis.com
    - storage-api.googleapis.com
    - serviceusage.googleapis.com
    - cloudasset.googleapis.com
