Skip to content

Commit

Permalink
Merge pull request #29 from stashconsulting/terraform-cloud
Browse files Browse the repository at this point in the history
Terraform cloud
  • Loading branch information
sjortiz committed Aug 27, 2020
2 parents cec2a48 + a6c9cac commit 1090590
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Using the terraform cloud for the purpose of managing the status.

stages:
- deploy

deploy:
image:
name: stashconsulting/terraform-docker:gcloud-latest
name: stashconsulting/terraform-docker:gcloud-f326556
entrypoint: [""]
stage: deploy
script:
- gcloud auth configure-docker
- sed -i "s/TOKEN_TO_BE_REPLACED/${token}/g" .terraform.d/credentials.tfrc.json
- mkdir ~/.terraform.d/ && cp .terraform.d/credentials.tfrc.json ~/.terraform.d/
- terraform init
- gsutil rsync gs:https://tfstatebackup .
- terraform apply -auto-approve -var image_id=$image -var project=$project || echo "failure"
tags:
- docker_image
7 changes: 7 additions & 0 deletions .terraform.d/credentials.tfrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"credentials": {
"app.terraform.io": {
"token": "TOKEN_TO_BE_REPLACED"
}
}
}
9 changes: 9 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
terraform {
backend "remote" {
organization = "stashconsulting-labs"
workspaces {
name = "cloudstorage-rssfeed-python-cloudfunction"
}
}
}

locals {
region = "us-central1"
zone = "us-central1-c"
Expand Down

0 comments on commit 1090590

Please sign in to comment.