Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various changes to the PostgreSQL provider #10682

Merged
merged 46 commits into from
Dec 12, 2016
Merged

Various changes to the PostgreSQL provider #10682

merged 46 commits into from
Dec 12, 2016

Conversation

sean-
Copy link
Contributor

@sean- sean- commented Dec 12, 2016

This is basically ready to be reviewed. Before it can be merged one test needs to be fixed (hence the checkpoint, want a pair of eyes) and the version attribute should be added to postgresql_extension (almost done).

CC @kyxap1 and @samdunne who have been doing some PostgreSQL provider work recently.

… 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).
If they're required and the value is missing, the test will fail.  There's
no need to enforce that in the test itself.
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.
…slmode`.

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
* 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"
*Read() and *Update() still need to be updated.
@sean- sean- requested a review from stack72 December 12, 2016 21:22
@apparentlymart apparentlymart changed the title F fixup postgresql Various changes to the PostgreSQL provider Dec 12, 2016
@stack72
Copy link
Contributor

stack72 commented Dec 12, 2016

@jen20 is going to give this another pair of 👀

it LGTM! I love the addition of tfAppName for tracking. The other change of node is the ssl_mode is now deprecated in-favour of sslmode

% make testacc TEST=./builtin/providers/postgresql                                                                          2 ↵ ✭
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/12/12 22:41:44 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 (2.07s)
=== RUN   TestAccPostgresqlDatabase_DefaultOwner
--- PASS: TestAccPostgresqlDatabase_DefaultOwner (1.03s)
=== RUN   TestAccPostgresqlExtension_Basic
--- PASS: TestAccPostgresqlExtension_Basic (0.09s)
=== RUN   TestAccPostgresqlExtension_SchemaRename
--- PASS: TestAccPostgresqlExtension_SchemaRename (0.14s)
=== RUN   TestAccPostgresqlRole_Basic
--- PASS: TestAccPostgresqlRole_Basic (0.29s)
=== RUN   TestAccPostgresqlSchema_Basic
--- PASS: TestAccPostgresqlSchema_Basic (0.24s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/postgresql    3.880s

Copy link
Contributor

@jen20 jen20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few very minor comments here, but 👍 from me. If the first version is 0.8, now is the time to address removing the environment variables mentioned in three of the comments.

@@ -0,0 +1,28 @@
POSTGRES?=/opt/local/lib/postgresql96/bin/postgres
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's worth adding a comment to the top of this file stating the intended use, or use the "self-documenting" structure and make the help target be the default.

Required: true,
Type: schema.TypeString,
Optional: true,
// TODO(sean@): Remove POSTGRESQL_HOST in 0.8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first release this will see is 0.8 - do we want to remove this now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be okay with that. I've had this kicking around in some form since the mid-0.7 days. Removing now.

"username": {
Type: schema.TypeString,
Optional: true,
// TODO(sean@): Remove POSTGRESQL_USER in 0.8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same re 0.8 removal

Optional: true,
Type: schema.TypeString,
Optional: true,
// TODO(sean@): Remove POSTGRESQL_PASSWORD in 0.8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same re 0.8 removal

@@ -6,40 +6,101 @@ import (
"testing"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting error on imports here

@jen20 jen20 merged commit 7cda9e8 into master Dec 12, 2016
@jen20 jen20 deleted the f-fixup-postgresql branch December 12, 2016 23:23
@ghost
Copy link

ghost commented Apr 18, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants