Skip to content

Commit

Permalink
fix: fixes lint issues and generates metadata (#89)
Browse files Browse the repository at this point in the history
Co-authored-by: Awais Malik <awmalik@google.com>
  • Loading branch information
g-awmalik and g-awmalik authored Dec 27, 2022
1 parent e891014 commit 935368c
Show file tree
Hide file tree
Showing 17 changed files with 718 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Make will use bash instead of sh
SHELL := /usr/bin/env bash

DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.3
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.10
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

Expand Down
2 changes: 1 addition & 1 deletion build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ tags:
- 'integration'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.3'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.10'
2 changes: 1 addition & 1 deletion build/lint.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ tags:
- 'lint'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.3'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.10'
1 change: 0 additions & 1 deletion examples/gh-runner-mig-native-packer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ $ terraform apply
| project\_id | The project id to deploy Github Runner MIG | `string` | n/a | yes |
| repo\_name | Name of the repo for the Github Action | `string` | n/a | yes |
| repo\_owner | Owner of the repo for the Github Action | `string` | n/a | yes |
| repo\_url | Repo URL for the Github Action | `string` | n/a | yes |
| source\_image | Source disk image | `string` | n/a | yes |
| source\_image\_project | Project where the source image comes from | `string` | `null` | no |

Expand Down
4 changes: 0 additions & 4 deletions examples/gh-runner-mig-native-packer/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ variable "project_id" {
description = "The project id to deploy Github Runner MIG"
}

variable "repo_url" {
type = string
description = "Repo URL for the Github Action"
}
variable "repo_name" {
type = string
description = "Name of the repo for the Github Action"
Expand Down
61 changes: 61 additions & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright 2022 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-github-actions-runners
annotations:
config.kubernetes.io/local-config: "true"
spec:
title: terraform-google-github-actions-runners
source:
repo: https://github.com/terraform-google-modules/terraform-google-github-actions-runners
sourceType: git
subBlueprints:
- name: gh-oidc
location: modules/gh-oidc
- name: gh-runner-gke
location: modules/gh-runner-gke
- name: gh-runner-mig-container-vm
location: modules/gh-runner-mig-container-vm
- name: gh-runner-mig-vm
location: modules/gh-runner-mig-vm
examples:
- name: gh-org-runner-mig-native-simple
location: examples/gh-org-runner-mig-native-simple
- name: gh-runner-gke-dind
location: examples/gh-runner-gke-dind
- name: gh-runner-gke-simple
location: examples/gh-runner-gke-simple
- name: gh-runner-mig-container-vm-dind
location: examples/gh-runner-mig-container-vm-dind
- name: gh-runner-mig-container-vm-simple
location: examples/gh-runner-mig-container-vm-simple
- name: gh-runner-mig-native-packer
location: examples/gh-runner-mig-native-packer
- name: gh-runner-mig-native-simple
location: examples/gh-runner-mig-native-simple
- name: oidc-simple
location: examples/oidc-simple
roles:
- level: Project
roles:
- roles/owner
services:
- cloudresourcemanager.googleapis.com
- storage-api.googleapis.com
- iam.googleapis.com
- container.googleapis.com
- serviceusage.googleapis.com
124 changes: 124 additions & 0 deletions modules/gh-oidc/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Copyright 2022 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-github-actions-runners
annotations:
config.kubernetes.io/local-config: "true"
spec:
title: ""
source:
repo: https://github.com/terraform-google-modules/terraform-google-github-actions-runners
sourceType: git
version: 3.1.0
actuationTool:
type: Terraform
version: '>= 0.13'
examples:
- name: gh-org-runner-mig-native-simple
location: examples/gh-org-runner-mig-native-simple
- name: gh-runner-gke-dind
location: examples/gh-runner-gke-dind
- name: gh-runner-gke-simple
location: examples/gh-runner-gke-simple
- name: gh-runner-mig-container-vm-dind
location: examples/gh-runner-mig-container-vm-dind
- name: gh-runner-mig-container-vm-simple
location: examples/gh-runner-mig-container-vm-simple
- name: gh-runner-mig-native-packer
location: examples/gh-runner-mig-native-packer
- name: gh-runner-mig-native-simple
location: examples/gh-runner-mig-native-simple
- name: oidc-simple
location: examples/oidc-simple
variables:
- name: allowed_audiences
description: Workload Identity Pool Provider allowed audiences.
type: list(string)
default: []
required: false
- name: attribute_condition
description: Workload Identity Pool Provider attribute condition expression. [More info](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/iam_workload_identity_pool_provider#attribute_condition)
type: string
required: false
- name: attribute_mapping
description: Workload Identity Pool Provider attribute mapping. [More info](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/iam_workload_identity_pool_provider#attribute_mapping)
type: map(any)
default:
attribute.actor: assertion.actor
attribute.aud: assertion.aud
attribute.repository: assertion.repository
google.subject: assertion.sub
required: false
- name: issuer_uri
description: Workload Identity Pool Issuer URL
type: string
default: https://token.actions.githubusercontent.com
required: false
- name: pool_description
description: Workload Identity Pool description
type: string
default: Workload Identity Pool managed by Terraform
required: false
- name: pool_display_name
description: Workload Identity Pool display name
type: string
required: false
- name: pool_id
description: Workload Identity Pool ID
type: string
required: true
- name: project_id
description: The project id to create Workload Identity Pool
type: string
required: true
- name: provider_description
description: Workload Identity Pool Provider description
type: string
default: Workload Identity Pool Provider managed by Terraform
required: false
- name: provider_display_name
description: Workload Identity Pool Provider display name
type: string
required: false
- name: provider_id
description: Workload Identity Pool Provider id
type: string
required: true
- name: sa_mapping
description: Service Account resource names and corresponding WIF provider attributes. If attribute is set to `*` all identities in the pool are granted access to SAs.
type: |-
map(object({
sa_name = string
attribute = string
}))
default: {}
required: false
outputs:
- name: pool_name
description: Pool name
- name: provider_name
description: Provider name
roles:
- level: Project
roles:
- roles/owner
services:
- cloudresourcemanager.googleapis.com
- storage-api.googleapis.com
- iam.googleapis.com
- container.googleapis.com
- serviceusage.googleapis.com
4 changes: 4 additions & 0 deletions modules/gh-oidc/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ terraform {
source = "hashicorp/google"
version = ">= 3.64, < 5.0.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = ">= 3.64, < 5.0.0"
}
}

provider_meta "google" {
Expand Down
Loading

0 comments on commit 935368c

Please sign in to comment.