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

Improve environment variable support for the pg backend #33045

Merged
merged 2 commits into from
Apr 21, 2023

Conversation

remilapeyre
Copy link
Contributor

This patch does two things:

  • it adds environment variable support to the parameters that did not have it (and uses PG_CONN_STR instead of PGDATABASE which is actually more appropriate to match the behavior of other PostgreSQL utilities)
  • better documents how to give the connection parameters as environment variables for the ones that were already supported based on the recommendation of @bsouth00

I will prepare a backport of the documentation part of this once it is merged.

Closes #33024

Target Release

1.5.0

Draft CHANGELOG entry

The pg backend now supports the PG_CONN_STR, PG_SCHEMA_NAME, PG_SKIP_SCHEMA_CREATION, PG_SKIP_TABLE_CREATION and PG_SKIP_INDEX_CREATION environment variables.

Documentation page

image

This patch does two things:
  - it adds environment variable support to the parameters that did
    not have it (and uses `PG_CONN_STR` instead of `PGDATABASE` which is
    actually more appropriate to match the behavior of other PostgreSQL
    utilities)
  - better documents how to give the connection parameters as environment
    variables for the ones that were already supported based on the
	recommendation of @bsouth00

I will prepare a backport of the documentation part of this once it is
merged.

Closes hashicorp#33024
@crw
Copy link
Collaborator

crw commented Apr 17, 2023

Thanks @remilapeyre, I'll send this through traige.

Copy link
Member

@liamcervante liamcervante left a comment

Choose a reason for hiding this comment

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

Hi @remilapeyre, this mostly looks fine to me. Just a single comment on the databaseName variable. I'm happy to merge once that's resolved!

internal/backend/remote-state/pg/backend_test.go Outdated Show resolved Hide resolved
@liamcervante liamcervante merged commit af571b2 into hashicorp:main Apr 21, 2023
4 checks passed
@github-actions
Copy link

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

@liamcervante
Copy link
Member

Thanks @remilapeyre! This is all ready to go as part of v1.5!

@remilapeyre remilapeyre deleted the doc-pg-env branch April 21, 2023 08:12
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 22, 2023
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.

Set PG Backend Connection String through an environment variable
3 participants