GCP Cloud SQL
Doppler supports rotating secrets for each GCP Cloud SQL database - MySQL, Postgres, and SQL Server. Doppler utilizes the Cloud SQL Admin API to facilitate rotation. There's no need to expose your database to the internet and the GCP Service Account can be narrowly scoped.
Requirements
- Understand the Doppler rotation methodology
- GCP Account
- Ability to create GCP Service Accounts
- Access to or ability to create two database users
Overview
Configuring Doppler to facilitate rotation in Cloud SQL consists of:
- Creating a narrowly scoped GCP Service Account
- Providing the details of the Cloud SQL users to rotate between
GCP Service Account Role
In order to scope the service account as narrowly as possible, you'll first create a custom role for the service account to use.
- In the GCP console, under IAM, navigate to RolesSelect Create Role
- Provide a Title and ID. Use General Availability for Role Launch Stage
- Select Add Permissions
- In the filter section, search for and add cloudsql.users.update, cloudsql.users.list, and cloudsql.instances.get
- Select Create
GCP Service Account
- In the GCP console, navigate to Service Accounts
- Select Create Service Account
- Name your service account and provide an ID
- Select Create and Continue
- Under Grant this service account access to project, select the custom role you created above
- Select Continue and then select Done
GCP Service Account Key
- On GCP Service Account page, select the Service Account you just created above
- Select the Keys tab
- Select Add Key then Create New Key
- Leave JSON selected and click Create. You will use the generated key below
Doppler Cloud SQL Integration
- Navigate to the Doppler config you would like to add a rotated secret to
- Click the dropdown next to Add Secret and select Add Rotated Secret
- Select the engine you'd like to rotate - MySQL, SQL Server, or Postgres
- Name your integration and enter the Service Account you created above
Cloud SQL Database Details
- Rotated Secret Name: The name of the rotated secret object; it will also prefix each of the secrets that Doppler injects into your config. For example, if
DB_USER
is entered, the following secrets would be injected into your config:DB_USER_USER_HOST_NAME
(MySQL only)DB_USER_DATABASE_INSTANCE
DB_USER_DATABASE
DB_USER_USERNAME
DB_USER_PASSWORD
- Interval: How often your database passwords are rotated
- Database Instance: The name of your database
Users
During the rotation process, Doppler rotates between the database users you provide during the rotation configuration process. By providing the users to Doppler, Doppler doesn't need the ability to create new users - just update user passwords.
There are no requirements related to the users you provide.
Updated about 1 year ago