-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use Terraform 0.12 Beta 1 * Upgrade to config to HCL2 and Heroku provider 1.8.0-dev (included) * Configure & ensure the workspace exists * 📚 0.12 Beta 1 info
- Loading branch information
Showing
7 changed files
with
34 additions
and
16 deletions.
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
Binary file added
BIN
+21.8 MB
.terraform.d/plugins/darwin_amd64/terraform-provider-heroku_v1.8.0-dev20190216H00-dev_x4
Binary file not shown.
Binary file added
BIN
+20 MB
.terraform.d/plugins/linux_amd64/terraform-provider-heroku_v1.8.0-dev20190216H00-dev_x4
Binary file not shown.
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
Terraforming 🌱 Heroku app | ||
=========================== | ||
|
||
[Terraform](https://www.terraform.io/) as a [Heroku](https://www.heroku.com/) app. | ||
[Terraform](https://www.terraform.io/) [0.12 Beta 1](https://www.hashicorp.com/blog/announcing-terraform-0-1-2-beta1) as a [Heroku](https://www.heroku.com/) app. | ||
|
||
Includes a [0.12 dev snapshot](http://terraform-0.12.0-dev-snapshots.s3-website-us-west-2.amazonaws.com/terraform-provider-heroku/) of [Heroku Provider version 1.8.0](https://www.terraform.io/docs/providers/heroku/index.html). | ||
|
||
Run Terraform CLI in the cloud: | ||
|
||
|
@@ -11,7 +13,7 @@ heroku run terraform apply | |
|
||
🔬🚧 This is a community proof-of-concept, [MIT license](LICENSE), provided "as is", without warranty of any kind. | ||
|
||
🌲🔥 To enable the [Postgres backend](https://github.com/mars/terraform/blob/v0.11.9-pg.02/website/docs/backends/types/pg.html.md) for Terraform, this app uses the `terraform` binary built from an unmerged pull request to Terraform (see: [hashicorp/terraform #19070](https://github.com/hashicorp/terraform/pull/19070)). | ||
🌲🔥 To enable the [Postgres backend](https://github.com/mars/terraform/blob/postgres-backend/website/docs/backends/types/pg.html.md) for Terraform, this app uses the [`terraform` 0.12 Beta binary](https://releases.hashicorp.com/terraform/0.12.0-beta1/), which includes this new feature (see: [hashicorp/terraform #19070](https://github.com/hashicorp/terraform/pull/19070)). | ||
|
||
Set-up | ||
------ | ||
|
@@ -170,10 +172,10 @@ cd terraforming-app/ | |
heroku create $APP_NAME --buildpack mars/terraforming | ||
heroku addons:create heroku-postgresql | ||
|
||
# Use our fork of Terraform that supports Postgres backend | ||
# Use 0.12 Beta of Terraform that supports Postgres backend | ||
# https://github.com/hashicorp/terraform/pull/19070 | ||
# | ||
heroku config:set TERRAFORM_BIN_URL=https://terraforming-buildpack.s3.amazonaws.com/terraform_0.11.9-pg.02_linux_amd64.zip | ||
heroku config:set TERRAFORM_BIN_URL=https://releases.hashicorp.com/terraform/0.12.0-beta1/terraform_0.12.0-beta1_linux_amd64.zip | ||
|
||
# Set credentials for the Terraform Heroku provider | ||
heroku config:set HEROKU_API_KEY=xxxxx [email protected] | ||
|
@@ -186,14 +188,16 @@ git push heroku master | |
|
||
### Run Terraform locally w/ Heroku Postgres backend | ||
|
||
🌲🔥 Requires local `terraform` binary built with the [pre-release Postgres backend](https://github.com/mars/terraform/releases/tag/v0.11.9-pg.02). | ||
🌲🔥 Requires using [Terraform 0.12 Beta](https://www.hashicorp.com/blog/announcing-terraform-0-1-2-beta1). | ||
|
||
```bash | ||
# First-time for each terminal | ||
export DATABASE_URL=`heroku config:get DATABASE_URL` | ||
$GOPATH/src/github.com/hashicorp/terraform/pkg/darwin_amd64/terraform init -backend-config="conn_str=$DATABASE_URL" | ||
terraform init -backend-config="conn_str=$DATABASE_URL" | ||
# …or use a local database with SSL disabled | ||
terraform init -backend-config="conn_str=postgres://localhost/terraform_backend?sslmode=disable" | ||
|
||
# Continue using Terraform with the Heroku app's Postgres backend | ||
$GOPATH/src/github.com/hashicorp/terraform/pkg/darwin_amd64/terraform plan | ||
$GOPATH/src/github.com/hashicorp/terraform/pkg/darwin_amd64/terraform apply | ||
terraform plan | ||
terraform apply | ||
``` |
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 |
---|---|---|
@@ -1,40 +1,41 @@ | ||
terraform { | ||
backend "pg" {} | ||
backend "pg" { | ||
} | ||
} | ||
|
||
provider "heroku" { | ||
version = "~> 1.7" | ||
} | ||
|
||
variable "example_app_name" { | ||
description = "Name of the Heroku app provisioned as an example" | ||
} | ||
|
||
resource "heroku_app" "example" { | ||
name = "${var.example_app_name}" | ||
name = var.example_app_name | ||
region = "us" | ||
} | ||
|
||
resource "heroku_build" "example" { | ||
app = "${heroku_app.example.name}" | ||
app = heroku_app.example.name | ||
|
||
source = { | ||
path = "app/" | ||
} | ||
} | ||
|
||
resource "heroku_formation" "example" { | ||
app = "${heroku_app.example.name}" | ||
app = heroku_app.example.name | ||
type = "web" | ||
quantity = 1 | ||
size = "Standard-1x" | ||
depends_on = ["heroku_build.example"] | ||
depends_on = [heroku_build.example] | ||
} | ||
|
||
output "example_app_url" { | ||
value = "https://${heroku_app.example.name}.herokuapp.com" | ||
} | ||
|
||
output "example_app_build_log_url" { | ||
value = "${heroku_build.example.output_stream_url}" | ||
value = heroku_build.example.output_stream_url | ||
} | ||
|
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,4 @@ | ||
|
||
terraform { | ||
required_version = ">= 0.12" | ||
} |