Commit Graph

88 Commits

Author SHA1 Message Date
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
Sean Chittenden ec130d538c
Add comments requesting that the testing-specific environment variables
can be removed in Terraform 0.8.0
2016-12-10 12:32:17 +11:00
Sean Chittenden b68ef2c40b
Fall through to using the defaults from github.com/lib/pq 2016-12-10 12:32:17 +11:00
Sean Chittenden f31ebff10e
Change the PostgreSQL PGSSLMODE option to sslmode to match PostgreSQL idioms.
Also don't specify the default and rely on github.com/lib/pq (which uses "required"
and is different than what libpq(3) uses, which is "preferred" and unsupported by
github.com/lib/pq).
2016-12-10 12:32:17 +11:00
Alexander Kyxap f993f0e70e Added 'connect_timeout' argument to provider 'postgresql' (#10380) 2016-11-28 16:52:10 +00:00
stack72 f5cd90c13e
provider/postgresql: Fixing up the PG Extension test 2016-11-03 12:06:51 +00:00
Sam Dunne cb40a3ef14
Format code 2016-11-02 15:30:21 +00:00
Sam Dunne 5dbd9423cc
Update based off review 2016-11-02 14:36:39 +00:00
Sam Dunne 792a6c0232
Remove unused dependency 2016-10-05 09:32:10 +01:00
Sam Dunne d073a90cb1
Create provisioner for postgresql extensions
This change adds support for installing postgresql extensions on a
postgresql server.
2016-10-04 16:32:28 +01:00
James Nugent 44af0d60df provider/postgres: Fix acceptance tests
```
› PGSSLMODE=disable PGHOST=localhost PGUSER=postgres make testacc \
	TEST=./builtin/providers/postgresql
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/09/05 15:39:23 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/postgresql -v  -timeout 120m
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN   TestAccPostgresqlDatabase_Basic
--- PASS: TestAccPostgresqlDatabase_Basic (0.53s)
=== RUN   TestAccPostgresqlDatabase_DefaultOwner
--- PASS: TestAccPostgresqlDatabase_DefaultOwner (0.51s)
=== RUN   TestAccPostgresqlRole_Basic
--- PASS: TestAccPostgresqlRole_Basic (0.11s)
PASS
ok     	github.com/hashicorp/terraform/builtin/providers/postgresql    	1.160s
```
2016-09-05 15:39:57 -07:00
James Nugent 34a17d3b46 provider/postgres: Correct casing -> PostgreSQL 2016-09-05 15:04:48 -07:00
James Nugent 006ab910b8 provider/postgres: Use standard environment vars
Previously the provider accepted non-standard environment variables. We
now accept the standard PGHOST/PGUSER/PGPASSWORD variables that psql
uses in addition the older ones.
2016-09-05 15:04:08 -07:00
James Nugent 260179543a provider/postgres: Clean up definitions and errors
This commit brings the Postgres provider up to "new" standards for error
wrapping and nested structure definitions.
2016-09-05 14:46:40 -07:00
Martin Atkins 220d73f32c provider/postgresql: default ssl_mode is "prefer"
According to the libpq documentation, "prefer" is the default in the
underlying library and so setting a different default in the Terraform
layer would be a breaking change for existing users of this provider
whose servers do not have TLS correctly configured.

The docs now link to the libpq manual's discussion of the security
implications of each of the ssl_mode options, so the user can understand
the limitations of the "prefer" default and can make an informed decision
about which setting is appropriate for their situation.
2016-04-17 08:32:02 -07:00
Xavier Sellier fc9825e4c4 - Add support for 'ssl_mode' options present in lib/pq
- Update psotgresql provider's documentation
- Enforce default value to 'require' for ssl_mode
2016-04-11 13:20:39 -04:00
stack72 5fbec544d7 Fixing yet more gofmt errors with imports 2015-12-21 09:54:24 +00:00
Adrian Chelaru e1eef15646 postgresql provider with "database" and "role" resources 2015-12-03 23:44:20 -08:00