From 2a5adbfea6e9774a2d702f28857f4c907daa31c9 Mon Sep 17 00:00:00 2001 From: abhishek kumar tiwari Date: Tue, 22 Oct 2024 07:17:51 +0000 Subject: [PATCH] chore: Add new output account_details, output type and metadata.display.yaml (#133) --- modules/simple-sa/README.md | 1 + modules/simple-sa/metadata.display.yaml | 45 +++++++++++++++++++++++++ modules/simple-sa/metadata.yaml | 15 ++++++++- modules/simple-sa/outputs.tf | 8 +++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 modules/simple-sa/metadata.display.yaml diff --git a/modules/simple-sa/README.md b/modules/simple-sa/README.md index ed785d6..2d8033c 100644 --- a/modules/simple-sa/README.md +++ b/modules/simple-sa/README.md @@ -35,6 +35,7 @@ module "sa" { | Name | Description | |------|-------------| +| account\_details | Service account id and email | | email | Service account email | | env\_vars | Exported environment variables | | iam\_email | IAM format service account email | diff --git a/modules/simple-sa/metadata.display.yaml b/modules/simple-sa/metadata.display.yaml new file mode 100644 index 0000000..236eca6 --- /dev/null +++ b/modules/simple-sa/metadata.display.yaml @@ -0,0 +1,45 @@ +# Copyright 2024 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-service-accounts-display + annotations: + config.kubernetes.io/local-config: "true" +spec: + info: + title: Terraform Simple Service Account module + source: + repo: https://github.com/terraform-google-modules/terraform-google-service-accounts.git + sourceType: git + dir: /modules/simple-sa + ui: + input: + variables: + description: + name: description + title: Description + display_name: + name: display_name + title: Display Name + name: + name: name + title: Name + project_id: + name: project_id + title: Project Id + project_roles: + name: project_roles + title: Project Roles diff --git a/modules/simple-sa/metadata.yaml b/modules/simple-sa/metadata.yaml index 18a8b1f..fed84fe 100644 --- a/modules/simple-sa/metadata.yaml +++ b/modules/simple-sa/metadata.yaml @@ -63,14 +63,27 @@ spec: varType: list(string) required: true outputs: + - name: account_details + description: Service account id and email + type: + - object + - email: string + id: string - name: email description: Service account email + type: string - name: env_vars description: Exported environment variables + type: + - object + - SERVICE_ACCOUNT_EMAIL: string + SERVICE_ACCOUNT_IAM_EMAIL: string - name: iam_email description: IAM format service account email + type: string - name: id - description: Service account id and email + description: Service account id in the format 'projects/{{project}}/serviceAccounts/{{email}}' + type: string requirements: roles: - level: Project diff --git a/modules/simple-sa/outputs.tf b/modules/simple-sa/outputs.tf index dfbcf8b..d11070e 100644 --- a/modules/simple-sa/outputs.tf +++ b/modules/simple-sa/outputs.tf @@ -29,6 +29,14 @@ output "id" { value = google_service_account.sa.id } +output "account_details" { + description = "Service account id and email" + value = { + "id" : google_service_account.sa.account_id, + "email" : google_service_account.sa.email + } +} + output "env_vars" { description = "Exported environment variables" value = { "SERVICE_ACCOUNT_EMAIL" : google_service_account.sa.email,