# 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-bigquery-udf
  annotations:
    config.kubernetes.io/local-config: "true"
spec:
  info:
    title: BigQuery Persistent UDFs
    source:
      repo: https://github.com/terraform-google-modules/terraform-google-bigquery
      sourceType: git
      dir: /modules/udf
    version: 7.0.0
    actuationTool:
      flavor: Terraform
      version: ">= 0.13"
    description: {}
  content:
    examples:
      - name: basic_bq
        location: examples/basic_bq
      - name: basic_view
        location: examples/basic_view
      - name: data_warehouse
        location: examples/data_warehouse
      - name: multiple_tables
        location: examples/multiple_tables
      - name: scheduled_queries
        location: examples/scheduled_queries
  interfaces:
    variables:
      - name: add_udfs
        description: Whether or not this module should be enabled.
        varType: string
        defaultValue: false
      - name: dataset_id
        description: Dataset id
        varType: string
        defaultValue: null
        required: true
      - name: project_id
        description: Project ID that contains the dataset
        varType: string
        defaultValue: null
        required: true
    outputs:
      - name: added_udfs
        description: List of UDFs utility functions added.
  requirements:
    roles:
      - level: Project
        roles:
          - roles/bigquery.admin
          - roles/cloudkms.cryptoKeyEncrypterDecrypter
          - roles/owner
    services:
      - cloudkms.googleapis.com
      - cloudresourcemanager.googleapis.com
      - bigquery.googleapis.com
      - bigquerystorage.googleapis.com
      - bigqueryconnection.googleapis.com
      - serviceusage.googleapis.com
      - iam.googleapis.com
