Skip to content

compute-engine: add optional service_account (email + cloud-platform scope) to instances #5

@Lexxick

Description

@Lexxick

Current state

The module's google_compute_instance.this has no service_account block — so VMs it creates have no identity and can't authenticate to any GCP API. (Earlier notes saying it uses the default Compute SA were wrong; verified in main.tf.)

Why / best practice

To let a consumer fetch secrets from GCP Secret Manager at boot (the Postiz Cloudflare-tunnel token in infra-environments-dev), the VM needs (1) a service account and (2) the cloud-platform OAuth scope (default scopes exclude Secret Manager). This also closes the standing 'VM has no SA' hardening gap.

Proposed

Add optional, backward-compatible per-instance fields to the instances object — omit ⇒ current no-SA behavior, set ⇒ emit a dynamic "service_account" block:

  • service_account_email (default "")
  • service_account_scopes (default ["cloud-platform"])

Blocks

The GCP Secret Manager wiring in officialdad/infra-environments-dev (linked issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions