Commit Graph

67 Commits

Author SHA1 Message Date
Sean Chittenden 897609878f
Automatically perform a `REASSIGN OWNED` and `DROP OWNED BY` when
removing a PostgreSQL role.

Add manual overrides if this isn't the desired behavior, but it should
universally be the desired outcome except when a ROLE name is reused
across multiple databases in the same PostgreSQL cluster, in which case
the `skip_drop_role` is necessary for all but the last PostgreSQL
provider.
2016-12-25 06:13:33 -08:00
Sean Chittenden 6e200c98d0
Use the right verb for errors. 2016-12-25 06:13:33 -08:00
Sean Chittenden ebc81727da
Add the postgresql_schema_policy resource. This is a WIP due to
issues with cycles when an object is destroyed.
2016-12-25 06:13:33 -08:00
Sean Chittenden de6dcbd8cd
Add the `owner` attribute to the `postgresql_schema` resource. 2016-12-25 06:13:32 -08:00
Sean Chittenden 1d60e9ab04
Clean up the description on postgresql_database.owner. 2016-12-25 06:13:32 -08:00
Sean Chittenden d673a0b532
Properly escape DSN parameters. 2016-12-25 05:53:12 -08:00
Igor Dubinskiy 56a1ea9012 provider/postgresql: Quote connection string parameters 2016-12-23 10:09:32 -08:00
Sean Chittenden 56a193f228
Dept of second thoughts: remove authorization support before 0.8
releases.

When postgresql_schema_policy lands this attribute should be removed in
order to provide a single way of accomplishing setting permissions on
schema objects.
2016-12-13 10:28:06 -08:00
Sean Chittenden ce60c4fede
gofmt cleanup on imports. 2016-12-12 15:21:20 -08:00
Sean Chittenden 2ecd42c0be
Remove non-standard environment variables in prep for 0.8. 2016-12-12 15:21:00 -08:00
Sean Chittenden 6ed37770c3
Add the testing Makefile that I'm using for testing the provider locally. 2016-12-12 14:44:46 -08:00
Sean Chittenden 8c41f0859b
Add the version attribute to postgresql_extension. 2016-12-12 14:37:40 -08:00
Sean Chittenden a4965c01af
Fix up helpers.
Pointed out by: @stack72
2016-12-12 14:30:25 -08:00
Sean Chittenden c602f024f4
Fix the remaining `postgresql_extension` unit test. 2016-12-12 13:40:49 -08:00
Sean Chittenden daa951434f
Teach postgresql_extension about schemas. 2016-12-12 13:15:57 -08:00
Sean Chittenden d1c9ebb6c2
Add PostgreSQL schema support 2016-12-12 13:11:47 -08:00
Sean Chittenden 1a93309e50
Expand postgresql_role support to include all known options. 2016-12-12 01:37:00 -08:00
Sean Chittenden 4c6c52ee8d
Nuke some whitespace. 2016-12-12 01:36:14 -08:00
Sean Chittenden 6deb61b0cf
Enable import support for PostgreSQL's extensions. 2016-12-12 01:33:02 -08:00
Sean Chittenden e36827c5fe
Change the default for `valid_until` to `infinity` to match the default. 2016-12-12 01:18:13 -08:00
Sean Chittenden e9dc92c18d
Change the default for `inherit` from `false` to `true` to match PostgreSQL. 2016-12-12 01:11:07 -08:00
Sean Chittenden b576a3eda1
Rename variable from `roleSuperUserAttr` to `roleSuperuserAttr`. 2016-12-12 01:07:26 -08:00
Sean Chittenden 15cd542392
Remove a duplicate `connect_timeout` from a rebase+stash. 2016-12-12 00:53:06 -08:00
Sean Chittenden e2448473cb
Clean up the DatabaseCreate call. 2016-12-10 12:32:21 +11:00
Sean Chittenden db5d7b0438
Style nit 2016-12-10 12:32:21 +11:00
Sean Chittenden bfc2a2d42f
Commit WIP re: updated postgresql_role provider.
*Read() and *Update() still need to be updated.
2016-12-10 12:32:20 +11:00
Sean Chittenden 2e529146a5
Remove unused code. 2016-12-10 12:32:20 +11:00
Sean Chittenden 6b540ecb55
Don't use d.GetOk() when the zero value is a required attribute.
Add "pathological" test.
2016-12-10 12:32:20 +11:00
Sean Chittenden 37fdc958b3
Always remove the IS_TEMPLATE attribute before dropping a database. 2016-12-10 12:32:20 +11:00
Sean Chittenden e9b2b38288
Remove SetId() call from *Read(), this isn't required for import to work. 2016-12-10 12:32:20 +11:00
Sean Chittenden f253fc9eff
Commit miss earlier, fix syntax from unstaged commit. 2016-12-10 12:32:20 +11:00
Sean Chittenden 5280c37bea
`postgresql_database` resource provider should now be feature complete.
* Add support to import databases.  See docs.
* Add support for renaming databases
* Add support for all known PostgreSQL database attributes, including:
  * "allow_connections"
  * "lc_ctype"
  * "lc_collate"
  * "connection_limit"
  * "encoding"
  * "is_template"
  * "owner"
  * "tablespace_name"
  * "template"
2016-12-10 12:32:20 +11:00
Sean Chittenden 59f4ad6fd1
Alpha sort the resources in the PostgreSQL map. 2016-12-10 12:32:19 +11:00
Sean Chittenden 300ef2bc97
Add `connect_timeout` support to the PostgreSQL provider. 2016-12-10 12:32:19 +11:00
Sean Chittenden 3750bf7af2
Depreciate the PostgreSQL provider's `ssl_mode` option in favor of `sslmode`.
Both libpq(3) and github.com/lib/pq both use `sslmode`.  Prefer this vs
the non-standard `ssl_mode`.  `ssl_mode` is supported for compatibility
but should be removed in the future.

Changelog: yes
2016-12-10 12:32:19 +11:00
Sean Chittenden a200899d93
Allow the PostgreSQL provider to talk to a non-default database. 2016-12-10 12:32:19 +11:00
Sean Chittenden 602a908d7b
Add a `fallback_application_name` to the PostgreSQL DSN. 2016-12-10 12:32:19 +11:00
Sean Chittenden 44d907a3de
Revert "Prefer PGHOSTADDR over PGHOST, if set." lib/pq doesn't support PGHOSTADDR.
d8eeeb8bae/conn.go (L1851)

This reverts commit 26a2a974f2b2f2cefd41b426b8469fa3ea72b33e.
2016-12-10 12:32:19 +11:00
Sean Chittenden 55061d190a
Prefer PGHOSTADDR over PGHOST, if set. 2016-12-10 12:32:19 +11:00
Sean Chittenden 3779dfffa9
Use a string instead of the `%t` modifier for printing a bool in SQL 2016-12-10 12:32:19 +11:00
Sean Chittenden 5b66bf0745
ForceNew is required when changing the locale, ctype, and encoding.
This will cause someone some grief.  TODO: Figure out how to prevent
someone from blowing off their foot if they twiddle this after the
fact.
2016-12-10 12:32:18 +11:00
Sean Chittenden 547dcf27e1
Decorate the computed attribute where appropriate 2016-12-10 12:32:18 +11:00
Sean Chittenden 242405bdf1
Factor out the validate function for connection limits 2016-12-10 12:32:18 +11:00
Sean Chittenden 02dea2edd9
Add missing descriptions to owner and name 2016-12-10 12:32:18 +11:00
Sean Chittenden deb91f61ce
Update the descriptions to mostly match the official PostgreSQL docs. 2016-12-10 12:32:18 +11:00
Sean Chittenden 68cadd3c2a
Update the FIXME/TODO style to match Google style guides 2016-12-10 12:32:18 +11:00
Sean Chittenden f3add9e7ef
Flesh out the CREATE DATABASE for PostgreSQL. 2016-12-10 12:32:18 +11:00
Sean Chittenden 2aee081e4b
Eh, specify default values lib/pq zero initializes itself 2016-12-10 12:32:17 +11:00
Sean Chittenden 7e5ccc089b
Spell `ssl_mode` like `sslmode` 2016-12-10 12:32:17 +11:00
Sean Chittenden 655617ed6a
Remove the PGPASSWORD requirement for tests.
If they're required and the value is missing, the test will fail.  There's
no need to enforce that in the test itself.
2016-12-10 12:32:17 +11:00