An enterprise security architect is designing an automated credential rotation workflow for a PostgreSQL database. The database credentials must be stored in Google Cloud Secret Manager, encrypted using a Customer-Managed Encryption Key (CMEK) stored in Cloud KMS, and automatically rotated every 30 days using a dedicated Cloud Run rotation service triggered by Pub/Sub notifications. You must establish the secure lifecycle configurations and IAM bindings following the principle of least privilege. What is the correct sequence of steps to configure this automated secret rotation workflow?
- 1Grant the Secret Manager Service Agent the Cloud KMS CryptoKey Encrypter/Decrypter role on the dedicated Cloud KMS key.
- 2Create the Pub/Sub topic for rotation notifications and create the Secret Manager secret configured with CMEK encryption and the Pub/Sub topic binding.
- 3Grant the Secret Manager Service Agent the Pub/Sub Publisher role on the created rotation Pub/Sub topic.
- 4Deploy the Cloud Run rotation service configured with a dedicated runtime service account that holds the Secret Manager Secret Version Manager role.
- 5Configure the 30-day automatic rotation schedule on the Secret Manager secret to initiate the automated rotation lifecycle.
Cevap
The correct sequence of steps begins by granting the Secret Manager Service Agent the Cloud KMS CryptoKey Encrypter/Decrypter role on the CMEK key. Next, create the rotation Pub/Sub topic and the Secret Manager secret configured with CMEK. Third, grant the Secret Manager Service Agent the Pub/Sub Publisher role on the topic. Fourth, deploy the Cloud Run rotation service bound to a service account with the Secret Manager Secret Version Manager role. Finally, set the 30-day automatic rotation schedule on the secret.
The lifecycle of automated Secret Manager rotation with CMEK requires precise prerequisite sequencing. First, the Secret Manager Service Agent must have `cloudkms.cryptoKeyEncrypterDecrypter` permissions on the Cloud KMS key to allow secret creation and version encryption. Second, the secret can be created using CMEK alongside the designated Pub/Sub topic reference. Third, the Secret Manager Service Agent must be granted `pubsub.publisher` on the Pub/Sub topic so rotation events can be sent. Fourth, the Cloud Run rotation handler service must be deployed with a service account possessing `roles/secretmanager.secretVersionManager` to handle payload generation and updating credentials. Finally, applying the rotation schedule on the secret activates the end-to-end automated workflow without execution errors.
Adım Adım Çözüm
Anahtar Kavram
Secret Manager Automated Rotation Lifecycle with CMEK and Service Accounts