-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
f31ebff
Change the PostgreSQL PGSSLMODE option to sslmode to match PostgreSQL…
sean- b68ef2c
Fall through to using the defaults from github.com/lib/pq
sean- ec130d5
Add comments requesting that the testing-specific environment variables
sean- 655617e
Remove the PGPASSWORD requirement for tests.
sean- 7e5ccc0
Spell `ssl_mode` like `sslmode`
sean- 2aee081
Eh, specify default values lib/pq zero initializes itself
sean- f3add9e
Flesh out the CREATE DATABASE for PostgreSQL.
sean- 68cadd3
Update the FIXME/TODO style to match Google style guides
sean- deb91f6
Update the descriptions to mostly match the official PostgreSQL docs.
sean- 02dea2e
Add missing descriptions to owner and name
sean- 242405b
Factor out the validate function for connection limits
sean- 547dcf2
Decorate the computed attribute where appropriate
sean- 5b66bf0
ForceNew is required when changing the locale, ctype, and encoding.
sean- 3779dff
Use a string instead of the `%t` modifier for printing a bool in SQL
sean- 55061d1
Prefer PGHOSTADDR over PGHOST, if set.
sean- 44d907a
Revert "Prefer PGHOSTADDR over PGHOST, if set." lib/pq doesn't suppo…
sean- 602a908
Add a `fallback_application_name` to the PostgreSQL DSN.
sean- a200899
Allow the PostgreSQL provider to talk to a non-default database.
sean- 3750bf7
Depreciate the PostgreSQL provider's `ssl_mode` option in favor of `s…
sean- 300ef2b
Add `connect_timeout` support to the PostgreSQL provider.
sean- 59f4ad6
Alpha sort the resources in the PostgreSQL map.
sean- 5280c37
`postgresql_database` resource provider should now be feature complete.
sean- f253fc9
Commit miss earlier, fix syntax from unstaged commit.
sean- e9b2b38
Remove SetId() call from *Read(), this isn't required for import to w…
sean- 37fdc95
Always remove the IS_TEMPLATE attribute before dropping a database.
sean- 6b540ec
Don't use d.GetOk() when the zero value is a required attribute.
sean- 2e52914
Remove unused code.
sean- bfc2a2d
Commit WIP re: updated postgresql_role provider.
sean- db5d7b0
Style nit
sean- e244847
Clean up the DatabaseCreate call.
sean- 15cd542
Remove a duplicate `connect_timeout` from a rebase+stash.
sean- b576a3e
Rename variable from `roleSuperUserAttr` to `roleSuperuserAttr`.
sean- e9dc92c
Change the default for `inherit` from `false` to `true` to match Post…
sean- e36827c
Change the default for `valid_until` to `infinity` to match the default.
sean- 6deb61b
Enable import support for PostgreSQL's extensions.
sean- 4c6c52e
Nuke some whitespace.
sean- 1a93309
Expand postgresql_role support to include all known options.
sean- d1c9ebb
Add PostgreSQL schema support
sean- 201d9b9
Fix the description for the postgresql_role.
sean- daa9514
Teach postgresql_extension about schemas.
sean- c602f02
Fix the remaining `postgresql_extension` unit test.
sean- a4965c0
Fix up helpers.
sean- 8c41f08
Add the version attribute to postgresql_extension.
sean- 6ed3777
Add the testing Makefile that I'm using for testing the provider loca…
sean- 2ecd42c
Remove non-standard environment variables in prep for 0.8.
sean- ce60c4f
gofmt cleanup on imports.
sean- File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
POSTGRES?=/opt/local/lib/postgresql96/bin/postgres | ||
PSQL?=/opt/local/lib/postgresql96/bin/psql | ||
|
||
PGDATA?=$(GOPATH)/src/github.com/hashicorp/terraform/builtin/providers/postgresql/data | ||
|
||
initdb:: | ||
/opt/local/lib/postgresql96/bin/initdb --no-locale -U postgres -D $(PGDATA) | ||
|
||
startdb:: | ||
2>&1 \ | ||
$(POSTGRES) \ | ||
-D $(PGDATA) \ | ||
-c log_connections=on \ | ||
-c log_disconnections=on \ | ||
-c log_duration=on \ | ||
-c log_statement=all \ | ||
| tee postgresql.log | ||
|
||
cleandb:: | ||
rm -rf $(PGDATA) | ||
|
||
freshdb:: cleandb initdb startdb | ||
|
||
test:: | ||
2>&1 PGSSLMODE=disable PGHOST=/tmp PGUSER=postgres make -C ../../.. testacc TEST=./builtin/providers/postgresql | tee test.log | ||
|
||
psql:: | ||
$(PSQL) -E postgres postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package postgresql | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
// pqQuoteLiteral returns a string literal safe for inclusion in a PostgreSQL | ||
// query as a parameter. The resulting string still needs to be wrapped in | ||
// single quotes in SQL (i.e. fmt.Sprintf(`'%s'`, pqQuoteLiteral("str"))). See | ||
// quote_literal_internal() in postgresql/backend/utils/adt/quote.c:77. | ||
func pqQuoteLiteral(in string) string { | ||
in = strings.Replace(in, `\`, `\\`, -1) | ||
in = strings.Replace(in, `'`, `''`, -1) | ||
return in | ||
} | ||
|
||
func validateConnLimit(v interface{}, key string) (warnings []string, errors []error) { | ||
value := v.(int) | ||
if value < -1 { | ||
errors = append(errors, fmt.Errorf("%s can not be less than -1", key)) | ||
} | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.