File tree Expand file tree Collapse file tree
terraform/monitoring/grafana Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,20 +18,20 @@ begin
1818 ActiveRecord::Base.connection.execute(\"
1919 DO \$\$
2020 BEGIN
21- IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'grafana_ro ') THEN
22- CREATE ROLE grafana_ro WITH LOGIN PASSWORD '#{ENV['READ_ONLY_DB_PASSWORD']}';
21+ IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'grafana_read_only ') THEN
22+ CREATE ROLE grafana_read_only WITH LOGIN PASSWORD '#{ENV['READ_ONLY_DB_PASSWORD']}';
2323 ELSE
24- ALTER ROLE grafana_ro WITH PASSWORD '#{ENV['READ_ONLY_DB_PASSWORD']}';
24+ ALTER ROLE grafana_read_only WITH PASSWORD '#{ENV['READ_ONLY_DB_PASSWORD']}';
2525 END IF;
2626 END
2727 \$\$ ;
2828 \" )
2929
3030 ActiveRecord::Base.connection.execute(\"
31- GRANT CONNECT ON DATABASE #{ActiveRecord::Base.connection.current_database} TO grafana_ro ;
32- GRANT USAGE ON SCHEMA public TO grafana_ro ;
33- GRANT SELECT ON ALL TABLES IN SCHEMA public TO grafana_ro ;
34- ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO grafana_ro ;
31+ GRANT CONNECT ON DATABASE #{ActiveRecord::Base.connection.current_database} TO grafana_read_only ;
32+ GRANT USAGE ON SCHEMA public TO grafana_read_only ;
33+ GRANT SELECT ON ALL TABLES IN SCHEMA public TO grafana_read_only ;
34+ ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO grafana_read_only ;
3535 \" )
3636
3737 puts 'Read-only role created/updated successfully'
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ resource "grafana_data_source" "postgresql" {
4949 })
5050 url = " CHANGE_ME"
5151 uid = " postgres"
52- username = " grafana_ro "
52+ username = " grafana_read_only "
5353 lifecycle {
5454 ignore_changes = [
5555 secure_json_data_encoded ,
You can’t perform that action at this time.
0 commit comments