Introduction
-
Harness provides first class support for CloudFormation as an Infrastructure Provisioner
-
Leveraging CloudFormation in Harness, developers can provision infrastructure, deploy onto that provisioned infrastructure, and tear it down once the deployment checks out,
-
Infrastructure Teams may use Canary or Basic Workflows to Create a CloudFormation Stack, test out their infrastructure changes and then tear down the infrastructure after
Leveraging CloudFormation in Harness
- The CloudFormation Templates can be pasted in Harness directly
The Templates can be pulled from an S3 Bucket or Git Repository. The Git Repository will require a user to configure a connector to point to the CloudFormation Code.
Common Practices
- Customers also leverage Harness variables when creating a new stack, a common convention I have seen in the field
${service.name}-${env.name}
- A Common Workflow type we see our customers use is the Canary Workflow, in the Pre-Deployment Step our users provision the infrastructure, and in the post deployment they delete it. This use case is especially common for Infrastructure teams who are trying to test out their changes through Harness.
An Example CloudFormation Delete Stack Step
An End to End Workflow of Provisioning and Destroying Infrastructure in a Canary Workflow
Can we use ${workflow.variables.<my_var>} as inputs to our CloudFormation?
- Yes, you can. It can be achieved like so:
You would define the variable at the workflow level, at runtime you would pass input or leverage the default.
Why is Canary Workflow the best workflow to use CloudFormation?
-
Canary Workflow isn’t tied to a Service
-
Gives the users flexibility to deploy onto the Provisioned Infrastructure, a user can parse, the AWS Region, LoadBalancer, VPC, Tags, etc. into the Environment’s Infrastructure Definition.
(We have examples in our docs!) -
It allows users to only provision infrastructure without tying it to a service or a real environment
-
This works great for Infrastructure teams to test out infra changes and tear down their changes before a full rollout
More Documentation with Harness
- We have extensive documentation on CloudFormation Provisioners: CloudFormation How-tos - Harness.io Docs