Skip to content

Commit

Permalink
Add new output account_details, output type and metadata.display.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
q2w committed Oct 16, 2024
1 parent 809f359 commit 637aca8
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/simple-sa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
45 changes: 45 additions & 0 deletions modules/simple-sa/metadata.display.yaml
Original file line number Diff line number Diff line change
@@ -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/q2w/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
15 changes: 14 additions & 1 deletion modules/simple-sa/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions modules/simple-sa/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 637aca8

Please sign in to comment.