-
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
Postgres backend #19070
Postgres backend #19070
Conversation
ca6622c
to
43d508c
Compare
After fighting with master, I found the v0.11 branch to base this PR on until master (0.12.0-dev) stabilizes. |
43d508c
to
219bca0
Compare
25ac9bd
to
d369d18
Compare
d369d18
to
8894398
Compare
I've now rebased onto master (0.12) Running tests, it looks like there are a bunch of API/interface changes. Would someone with knowledge of the 0.12 changes, please give me some hints or docs to help figure this out?
|
e3859d2
to
0108cc3
Compare
With Postgres now setup in TravisCI and testing limited to only this new pg backend, this feature's tests are passing ✅ Of course, I will revert or undo that "Test only the pg backend in CI" commit before eventually merging. Please let me know what y'all think 😄 |
Hi @mars, Thank you for your patience. We're nearing the completion of the 0.12 work, and I'd like to evaluate merging this into the dev build for inclusion in the 0.12 release. Could you rebase this and verify that everything is working correctly? I'll can still start in on reviewing this in the meantime. For these tests, you can use the Thanks! |
1baf277
to
b9a91b7
Compare
Howdy @jbardin 😄 I switched this over to native Postgres locking and removed my special CI test commit that ran just these tests with I'll proceed with exercising this new version of the pg backend this week and follow up with any news. |
I've now exercised this backend locally with Terraform built from master/0.12-dev.
Otherwise, this appears to be working great ✅🙌 |
Thanks @mars. |
Sorry, one last thing, let's remove the travis changes altogether. |
🏁 |
Oops, looks like there's a test that's not flagged off with |
887506b
to
6d9e204
Compare
👌 thanks for the deep review @jbardin |
Thanks @mars! lets see if we can test this out in master! 👍 |
Hi again @jbardin 😄 I've been using this backend and reviewing its current implementation. Wondering if the implementation of locking using database transactions is working as Terraform expects. Currently, after calling Do you think this is a problem? If so, I can switch from transactional advisory locking to session advisory locking, so that interrupting errors leave the state's partial updates intact. |
Hi @mars, that's a good observation. Terraform doesn't assume the state storage is transactional in any way. While it currently only writes once at the end of each phase, it could in the future make more incremental writes to the storage, and we would want the last state written preserved. If we could do that with the session based locks, I think that would be preferable. Thanks! |
Okay, I'll open a new PR with that change very soon. |
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. |
Implements the Postgres relational database as a Terraform backend with support for locking and workspaces.
Motivation is to enable running Terraform in a Heroku app with the Heroku Postgres database add-on.
I gleaned most of the design from a combination of the inmem, s3, and consul backends, with a hefty dose of my own reasoning.