Terraforming Infrastructure

Using Terraform with Concourse

  • terraform - ljfranklin's terraform resource doesn't ship as a standard container with Concourse, and therefore must be declared as a resource type. It's very important to pin the resource to a tag; things in terraform world keep evolving. If you don't pin your terraform resource to a tag, concourse will get the latest version which at some point might become backwards-incompatible with your *.tf files.
  • terraform - definition of the resource, not to be confused with the resource type above,
  • tf-repo - git repo containing the terraform declarations. The sample pipeline below assumes the *.tf files are located in the terraform/ directory at the root of the repo
resource_types:
- name: terraform
type: docker-image
source:
repository: ljfranklin/terraform-resource
tag: 1.0.6
resources:
- name: terraform
type: terraform
source:
env_name: my-infrastructure-env
backend_type: s3
backend_config:
bucket: infra-bucket
key: terraform.tfstate
region: ((aws_region))
access_key: ((aws_access))
secret_key: ((aws_secret))
vars:
domain: mywebsite.com
- name: tf-repo
type: git
source:
branch: master
private_key: ((deploy_key))
uri: git@gitlab.com:oozie/myrepo.git
paths: [ terraform ]
jobs:
- name: terraform
serial_groups: [ terraform ]
plan:
- get: tf-repo
trigger: true
- put: terraform
params:
terraform_source: tf-repo/terraform