The Simplest Way to Make GitLab CI and Google Cloud Deployment Manager Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Pairing gitlab ci and google cloud deployment manager lets teams update cloud resources from code. When a developer pushes a change, the runner checks the files and updates the cloud. This workflow turns manual cloud changes into repeatable code checks. Every change goes through peer review before it reaches production. Teams can track who requested a change and when the update ran. How gitlab ci and google cloud deployment manager exchange data The pipeline starts when a team member merges

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Pairing gitlab ci and google cloud deployment manager lets teams update cloud resources from code. When a developer pushes a change, the runner checks the files and updates the cloud.

This workflow turns manual cloud changes into repeatable code checks. Every change goes through peer review before it reaches production. Teams can track who requested a change and when the update ran.

How gitlab ci and google cloud deployment manager exchange data

The pipeline starts when a team member merges a code change in the repo. A runner picks up the job and reads the resource template files. The runner then needs to log in to the cloud project to apply the changes.

In a good setup, the runner uses workload identity federation to log in. GitLab issues a short job token that proves the identity of the pipeline. Google Cloud checks this token against a trust rule in the project.

Once the trust check passes, the runner gets temporary permissions for a specific service account. The runner sends the template files to the deployment service API. The cloud service reads the state, compares it to the templates, and updates the resources.

After the update finishes, the cloud service sends the status back to the runner. The runner writes the result to the job log for the team to review. The temporary permissions expire as soon as the job ends.

Common failure modes and how to scope roles

Many teams still use static service account keys stored as pipeline variables. Static keys do not expire by default and can leak in build logs. If an attacker steals a static key, they can use it from anywhere.

Overbroad roles create another big risk for cloud projects. Teams often give the pipeline service account full editor or owner permissions. If a bad template runs, it can delete databases or change network rules across the project.

Shared runners can also mix permissions between different apps and teams. When one runner handles jobs for ten projects, a broad rule lets one repo change another. Unlogged manual changes outside the pipeline also cause state drift and broken builds.

GitLab CI Security + GCP Access Context Manager: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix these issues, replace all static keys with federated identity trust rules. Scope each trust rule to a single repo and a single protected branch. This step stops test branches from touching production resources.

Next, create a dedicated service account for each app or project. Grant only the exact roles needed to manage the target resources in that template. Separate the service account that runs dry-run checks from the one that writes changes.

Auditing and governing cloud deployment pipelines

Good security requires a clear record of every change from commit to cloud resource. Cloud audit logs record the service account name, the API call, and the time. Still, cloud logs alone often miss which developer approved the pipeline job.

Teams should pass job metadata into the request or correlate logs across both systems. Protected branches and required approvals in the repo add a strong human check. When a team member approves a merge, that name stays linked to the commit hash.

You should also lock down network paths for your build runners. Run private runners inside a controlled network rather than using public shared machines. Private runners let you restrict cloud API calls to known source networks.

Finally, block direct human write permissions to production cloud resources. Force all standard updates to flow through the reviewed pipeline. When engineers need emergency access to fix an outage, control and log every query or command.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How should a GitLab runner log in to Google Cloud without static keys?

Use workload identity federation between your repo and your cloud project. The runner trades its short job token for temporary cloud permissions during the run.

How do we stop feature branches from changing production resources?

Set attribute conditions on your cloud identity pool to check the branch name. Only allow tokens from your protected main branch to assume the production role.

What permissions should the deployment service account have?

Give the runner account permission to start deployments and read state. Grant resource creation roles only to the specific services defined in your templates.

The query runs. The emails stay hidden.