terraform-provider-postgresql icon indicating copy to clipboard operation
terraform-provider-postgresql copied to clipboard

allow setting configuration_parameter on roles and databases

Open joaocc opened this issue 1 year ago • 0 comments

Hi there,

Thank you for opening an issue. Please provide the following information:

Currently there doesn't seem to be a way to do the following using the provider:

ALTER DATABASE "my_db" SET timezone  TO 'UTC';
ALTER DATABASE "my_db" SET datestyle  TO 'YMD';
ALTER ROLE "my_role" SET timezone  TO 'UTC';
ALTER ROLE "my_role" SET datestyle  TO 'YMD';

From the structure of the resources, it would be useful to add this ability to to postgresql_database and postgresql_role. Since these are only 2 specific examples of configuration parameters, it could be defined as either a map(string) or via configuration_blocks.

Affected Resource(s)

  • postgresql_database
  • postgresql_role

Important Factoids

We were not able to find a any alternative to do this in a terraform way. Then only alternative we are considering is using local-exec to run psql but that would mean running it everytime the plan runs, and would not appear in the plan if things were changed. Alternatively, running only on lifecycle/creation would mean we would not be able to reset it if it ended up changing.

joaocc avatar Dec 27 '23 09:12 joaocc