diff --git a/examples/guardrails/cloudbuild/inframanager/.github/workflows/github.yml b/examples/guardrails/cloudbuild/inframanager/.github/workflows/github.yml new file mode 100644 index 0000000..de25c3e --- /dev/null +++ b/examples/guardrails/cloudbuild/inframanager/.github/workflows/github.yml @@ -0,0 +1,47 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "main" branch + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} + SERVICE_ACCOUNT: ${{ secrets.DEV_SERVICE_ACCOUNT }} + PROJECT_ID: ${{ secrets.PROJECT_ID }} + LOCATION: ${{ secrets.LOCATION }} + + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + job_id: + runs-on: 'ubuntu-latest' + permissions: + contents: 'read' + id-token: 'write' + + steps: + - uses: 'actions/checkout@v4' + + - id: 'auth' + uses: 'google-github-actions/auth@v2' + with: + workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }} + service_account: ${{ env.SERVICE_ACCOUNT }} + + - id: 'SetupCloudSDK' + uses: 'google-github-actions/setup-gcloud@v2' + with: + version: '>= 363.0.0' + + - id: 'list-all-files' + run: 'ls -ltrh' + + - id : 'Infrastructure-Manager-Deployment' + run: 'gcloud infra-manager deployments apply projects/${{ env.PROJECT_ID }}/locations/${{ env.LOCATION }}/deployments/inframanager --service-account ${{ env.SERVICE_ACCOUNT }} --local-source="."' + \ No newline at end of file diff --git a/examples/guardrails/cloudbuild/inframanager/main.tf b/examples/guardrails/cloudbuild/inframanager/main.tf new file mode 100644 index 0000000..9d8bd66 --- /dev/null +++ b/examples/guardrails/cloudbuild/inframanager/main.tf @@ -0,0 +1,7 @@ +resource "google_storage_bucket" "inframanager" { + name = "inframanager" + location = "US" + force_destroy = true + project = "cmetestproj" + public_access_prevention = "enforced" +} diff --git a/examples/guardrails/cloudbuild/inframanager/provider.tf b/examples/guardrails/cloudbuild/inframanager/provider.tf new file mode 100644 index 0000000..d942279 --- /dev/null +++ b/examples/guardrails/cloudbuild/inframanager/provider.tf @@ -0,0 +1,23 @@ +terraform { + required_version = "~> 1.2.3" + + required_providers { + google = { + source = "hashicorp/google" + version = ">= 5.12" + } + google-beta = { + source = "hashicorp/google-beta" + version = ">= 5.12" + } + } +} + + +provider "google" { + impersonate_service_account = "" +} + +provider "google-beta" { + impersonate_service_account = "" +}