Add schema_deployer SQL user to SecretManager (#1018)

* Add schema_deployer SQL user to SecretManager

Add the 'schema_deployer' user to the SecretManager so that its
credential can be set up. The schema deployment process will use this
user instead of the 'postgres' user.

Changed the output of the get_sql_credential command for the schema
deployment process.

Added a sql script that documents the privileges granted to
'schema_deployer'.
This commit is contained in:
Weimin Yu 2021-03-17 19:31:44 -04:00 committed by GitHub
parent 1132b29679
commit 49183db199
3 changed files with 40 additions and 3 deletions

View file

@ -0,0 +1,24 @@
-- Copyright 2019 The Nomulus Authors. All Rights Reserved.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- Script to create a user with read-only permission to all tables. The
-- initialize_roles.sql script creates the readonly role used here.
-- Comment out line below if user already exists:
CREATE USER schema_deployer ENCRYPTED PASSWORD :'password';
-- Comment out line above and uncomment line below if user has been created
-- from Cloud Dashboard:
-- ALTER USER :username NOCREATEDB NOCREATEROLE;
GRANT CONNECT ON DATABASE postgres TO schema_deployer;
GRANT CREATE, USAGE ON SCHEMA public TO schema_deployer;