Applying Application Feature Toggles to infrastructure
- Terraform 0.13+
- Consul 1.8+
- Docker
- CDK for Terraform 0.0.14+
- Google Cloud Platform account and project
- Terraform Cloud (for remote backend storage only)
-
Create a service account key in GCP and save it under
key.json
. -
Set the
CLOUDSDK_CORE_PROJECT
environment variable to your GCP project. -
Create a directory called
secrets
and add the following files with secrets:.terraformrc
: This contains the Terraform Cloud CLI configuration file.key.json
: This is the Google Service Account Keyproject
: This file contains the project name for GCP.
Run docker-compose -f docker-compose-tf.yaml up
.
This creates a set of toggles in a Consul instance and uses consul-template to output variables.
Update a toggle under cluster/toggles
and you'll see consul-template
output Terraform plan.
Go into the cdk
directory and run cdktf get
to generate the Typescript
classes for the providers.
Warning: CDK for Terraform is in alpha. As a result, you might find some classes may not compile.
Run docker-compose -f docker-compose-cdktf.yaml up
.
This creates a set of toggles in a Consul instance and uses consul-template to output variables.
Update a toggle under cluster/toggles
and you'll see consul-template
output the CDK for Terraform deployment.