Course contentsShow
← Cloud and Infrastructure
Lesson 2246 of 2,98948. Secrets ManagementFree lesson

GCP Secret Manager IAM and Versioning

Managing access with IAM roles, secret versions, and enabling/disabling specific secret versions.

GCP Secret Manager IAM and Versioning

You'll learn how to control who can access secrets in GCP and manage multiple versions of secret values over time.

Understanding IAM for Secret Manager

GCP Secret Manager uses Identity and Access Management (IAM) roles to control access at the secret resource level. You can grant specific principals (users, service accounts, groups) permission to view, edit, or manage secrets individually or project-wide.

Key IAM roles include:

  • roles/secretmanager.secretAccessor: Read secret values (most common for applications)
  • roles/secretmanager.admin: Full control over secrets
  • roles/secretmanager.viewer: View secret metadata (not values)

Think of IAM permissions like room keys in a hotel: some people get master keys (admin), some can only enter specific rooms (secret-level accessor), and others can just see which rooms exist (viewer).

Secret Versioning

Every time you update a secret's value, Secret Manager creates a new version automatically. Versions are immutable and numbered sequentially (1, 2, 3...). You can:

  • Enable a version to make it accessible
  • Disable a version to block access without deleting
  • Destroy a version permanently (irreversible)

Applications can reference secrets by version number or use latest to always fetch the newest enabled version. This lets you roll back to previous values instantly by disabling the current version and enabling an older one—like having safety backups of your password history.

Why This Matters

Combining IAM with versioning gives you audit trails (who accessed what when) and rollback capability (restore previous values without losing history). You can safely update database credentials, rotate API keys, or test new configurations knowing you can revert immediately.

Key Takeaway: GCP Secret Manager's IAM controls provide granular access permissions per secret, while automatic versioning lets you track changes and safely roll back by enabling/disabling specific versions.