https://github.com/mars/terraform-pg-state-store
Terraform pg state store using Heroku Postgres
https://github.com/mars/terraform-pg-state-store
Last synced: 5 months ago
JSON representation
Terraform pg state store using Heroku Postgres
- Host: GitHub
- URL: https://github.com/mars/terraform-pg-state-store
- Owner: mars
- License: mit
- Created: 2020-05-22T21:46:09.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-22T22:24:23.000Z (about 6 years ago)
- Last Synced: 2025-09-06T15:44:14.630Z (11 months ago)
- Language: HCL
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Terraform pg state store using Heroku Postgres
===========================
Setup
-----
First, install & login to [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli).
π *Terraform will use Heroku CLI's authorization.*
```bash
heroku whoami
heroku login
```
π *Instead, optionally, [authorize Terraform with a specific API key](https://www.terraform.io/docs/providers/heroku/index.html#authentication)).*
Clone the repo:
```bash
git clone git@github.com:mars/terraform-pg-state-store.git
cd terraform-pg-state-store/
```
Initialize & apply the configuration with the required input variables:
```bash
terraform init
terraform apply -var name=my-terraform-state
```
Usage
-----
Once complete, get the Postgres credentials.
Always refresh first, to get the current credentials:
```bash
terraform refresh -var name=my-terraform-state
terraform output pg_connection_string
```
β¦and then, use that value to [configure the pg backend in your Terraform project](https://www.terraform.io/docs/backends/types/pg.html).
Safety
------
If you want to ensure no further Terraform actions accidently destroy the database, go ahead and delete the Terraform state:
```bash
rm terraform.tfstate*
```