diff --git a/infra/Makefile b/infra/Makefile index 98bc98f0..051da7dc 100644 --- a/infra/Makefile +++ b/infra/Makefile @@ -18,9 +18,11 @@ # Make will use bash instead of sh SHELL := /usr/bin/env bash -DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1 +DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.12 DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools REGISTRY_URL := gcr.io/cloud-foundation-cicd +ENABLE_BPMETADATA := 1 +export ENABLE_BPMETADATA # Enter docker container for local development .PHONY: docker_run @@ -68,6 +70,7 @@ docker_test_integration: .PHONY: docker_test_lint docker_test_lint: docker run --rm -it \ + -e ENABLE_BPMETADATA \ -e EXCLUDE_LINT_DIRS \ -v "$(CURDIR)":/workspace \ $(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \ @@ -77,9 +80,10 @@ docker_test_lint: .PHONY: docker_generate_docs docker_generate_docs: docker run --rm -it \ - -v "$(CURDIR)":/workspace \ + -e ENABLE_BPMETADATA \ + -v "$(dir ${CURDIR})":/workspace \ $(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \ - /bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs' + /bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs "-d -p infra"' # Alias for backwards compatibility .PHONY: generate_docs diff --git a/infra/metadata.display.yaml b/infra/metadata.display.yaml new file mode 100644 index 00000000..2a7d2c2b --- /dev/null +++ b/infra/metadata.display.yaml @@ -0,0 +1,66 @@ +# 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-python-webapp-display +spec: + info: + title: terraform-dynamic-python-webapp + source: + repo: https://github.com/GoogleCloudPlatform/terraform-dynamic-python-webapp + sourceType: git + ui: + input: + variables: + client_image_host: + name: client_image_host + title: Client Image Host + database_name: + name: database_name + title: Database Name + database_username: + name: database_username + title: Database Username + image_version: + name: image_version + title: Image Version + init: + name: init + title: Init + instance_name: + name: instance_name + title: Instance Name + labels: + name: labels + title: Labels + project_id: + name: project_id + title: Project Id + random_suffix: + name: random_suffix + title: Random Suffix + region: + name: region + title: Region + server_image_host: + name: server_image_host + title: Server Image Host + service_name: + name: service_name + title: Service Name + zone: + name: zone + title: Zone diff --git a/infra/metadata.yaml b/infra/metadata.yaml index 368ee8f1..4b79b18b 100644 --- a/infra/metadata.yaml +++ b/infra/metadata.yaml @@ -19,99 +19,113 @@ metadata: annotations: config.kubernetes.io/local-config: "true" spec: - title: terraform-dynamic-python-webapp - source: - repo: https://github.com/GoogleCloudPlatform/terraform-dynamic-python-webapp.git - sourceType: git - actuationTool: - type: Terraform - version: '>= 0.13' - description: - tagline: This is an auto-generated module. - detailed: |- - The resources/services/activations/deletions that this module will create/trigger are: - - Cloud Run - - Cloud SQL - - Firebase Hosting - - Secret Manager - - IAM - - Cloud Storage - preDeploy: To deploy this blueprint you must have an active billing account and billing permissions. - documentation: - - title: Hosting a Static Website - url: https://cloud.google.com/storage/docs/hosting-static-website - examples: - - name: simple_example - location: examples/simple_example - variables: - - name: database_name - description: Cloud SQL database name - type: string - default: django - required: false - - name: database_username - description: Cloud SQL database name - type: string - default: server - required: false - - name: image_host_project - description: Google Cloud Project that hosts images - type: string - default: hsa-public/terraform-python-dynamic-webapp - required: false - - name: init - description: Initialize database? - type: bool - default: true - required: false - - name: instance_name - description: Cloud SQL Instance name - type: string - default: psql - required: false - - name: labels - description: A set of key/value label pairs to assign to the resources deployed by this blueprint. - type: map(string) - default: {} - required: false - - name: project_id - description: Google Cloud Project ID - type: string - required: true - - name: random_suffix - description: Add random suffix to VM name - type: string - default: true - required: false - - name: region - description: Google Cloud Region - type: string - default: us-central1 - required: false - - name: service_name - description: Cloud Run service name - type: string - default: server - required: false - - name: zone - description: GCP zone for provisioning zonal resources. - type: string - default: us-central1-c - required: false - outputs: - - name: django_admin_password - description: Djando Admin password - - name: django_admin_url - description: Djando Admin URL - - name: firebase_url - description: Firebase URL - - name: usage - description: Next steps for usage - roles: - - level: Project + info: + title: terraform-dynamic-python-webapp + source: + repo: https://github.com/GoogleCloudPlatform/terraform-dynamic-python-webapp + sourceType: git + actuationTool: + flavor: Terraform + version: '>= 0.13' + description: + tagline: This is an auto-generated module. + detailed: |- + The resources/services/activations/deletions that this module will create/trigger are: + - Cloud Run + - Cloud SQL + - Firebase Hosting + - Secret Manager + - IAM + - Cloud Storage + preDeploy: To deploy this blueprint you must have an active billing account and billing permissions. + content: + documentation: + - title: Hosting a Static Website + url: https://cloud.google.com/storage/docs/hosting-static-website + examples: + - name: simple_example + location: examples/simple_example + interfaces: + variables: + - name: client_image_host + description: Container Registry that hosts the client image (PROJECT_ID[/folder]) + varType: string + defaultValue: hsa-public/terraform-python-dynamic-webapp + - name: database_name + description: Cloud SQL database name + varType: string + defaultValue: django + - name: database_username + description: Cloud SQL database name + varType: string + defaultValue: server + - name: image_version + description: Version of the Container Registry image to use + varType: string + defaultValue: v1.7.0 + - name: init + description: Initialize database? + varType: bool + defaultValue: true + - name: instance_name + description: Cloud SQL Instance name + varType: string + defaultValue: psql + - name: labels + description: A set of key/value label pairs to assign to the resources deployed by this blueprint. + varType: map(string) + defaultValue: {} + - name: project_id + description: Google Cloud Project ID + varType: string + required: true + - name: random_suffix + description: Add random suffix to VM name + varType: string + defaultValue: true + - name: region + description: Google Cloud Region + varType: string + defaultValue: us-central1 + - name: server_image_host + description: Container Registry that hosts the server image (PROJECT_ID[/folder]) + varType: string + defaultValue: hsa-public/terraform-python-dynamic-webapp + - name: service_name + description: Cloud Run service name + varType: string + defaultValue: server + - name: zone + description: GCP zone for provisioning zonal resources. + varType: string + defaultValue: us-central1-c + outputs: + - name: django_admin_password + description: Djando Admin password + - name: django_admin_url + description: Djando Admin URL + - name: firebase_url + description: Firebase URL + - name: neos_toc_url + description: Neos Tutorial URL + - name: usage + description: Next steps for usage + requirements: roles: - - roles/owner - services: - - cloudresourcemanager.googleapis.com - - storage-api.googleapis.com - - serviceusage.googleapis.com + - level: Project + roles: + - roles/cloudsql.admin + - roles/compute.admin + - roles/compute.networkAdmin + - roles/firebase.managementServiceAgent + - roles/firebasehosting.admin + - roles/iam.serviceAccountAdmin + - roles/iam.serviceAccountUser + - roles/resourcemanager.projectIamAdmin + - roles/run.admin + - roles/secretmanager.admin + - roles/storage.admin + services: + - cloudresourcemanager.googleapis.com + - storage-api.googleapis.com + - serviceusage.googleapis.com