Workflows
Streamline Terraform deployments in your CI/CD pipelines.
Firefly Workflows is a powerful tool used to deploy Terraform within your CI/CD pipelines. Our documentation provides comprehensive guidance on creating and customizing workflows, in addition to integrating with existing pipelines.
Determining which type of workflow to integrate
The decision between creating a new workflow or integrating into an existing one depends on the specific requirements and structure of your project and CI/CD environment.
Managed workflows
Create a new workflow in Firefly when you need to establish a dedicated deployment process for a specific project or task. Ideal for:
Simplifying the setup and management of CI/CD pipelines
Automating Terraform deployments
Integrate into existing CI pipelines
This method is only for visualization and monitoring of your current deployment processes, improving efficiency and visibility without causing disruption to your existing workflow setup.
Creating Firefly workflows
To automate the deployment of your Terraform code, use our wizard to create a workflow within your CI/CD pipeline.
Each workflow corresponds to a workspace and facilitates the deployment of new resources or modifications to existing ones within your IaC stack.
For each workspace, we run
terraform plan
andapply
when making changes to your resources.Each row under Workspace represents a pull request in Git that contains your changes to the Terraform pipeline.
Creating a pull request automatically runs
terraform plan
.Merging a pull request automatically runs
terraform apply
.To edit attributes and/or modify variables, select the edit icon.
Procedure
Select Workflows > + Add New Workflow.
Select your IaC provisioning engine > Next.
Select Generate new IaC pipeline or Integrate into an existing pipeline > Next.
Generate Firefly key pair and store it in your CI variables.
In the Workspace Name field, enter the name of the workspace you want to create. Naming workspaces appropriately helps manage and distinguish between different deployment stages (like development, testing, or production) within the same Terraform configuration.
Under VCS integration, select the VCS (Git) integration where you want to create the workflow.
Select the Code repository where the workspace Terraform code is located.
Select the Default branch of the repository. Merging into this branch will apply the changed workspace (e.g., main).
(Optional) Enter the Working directory of the workspace. If it's empty, the working directory will run from the root folder.
Select Next.
Enter the Terraform version used to deploy your Workspace.
(Optional) In the TFvars file path field, enter the workspace tfvars file path relative to the working directory path.
(Optional) In the Terraform environment name field, enter the Terraform workspace name of your workspace. If using the same backend for multiple environments, you can set a Terraform workspace that changes the backend path to the environment name.
(Optional) Enter non-sensitive Terraform variables.
(Optional) Enter sensitive Terraform variables.
Select Next.
(Optional) In the Self-hosted runner labels field, enter the relevant labels to run the CI/CD pipeline on self-hosted runners.
(Optional) When using the AWS profile as the AWS provider authentication, enter the AWS profile configuration .
(Optional) When using environment variables as the provider authentication, enter the Provider credentials.
(Recommended) Enter the workspace labels for the workspace in Firefly. Naming workspace labels simplifies the management and filtering of deployments, domains, responsible teams, and other categorizations.
Select Next > Done. Your workflow has been created.
Integrating into an existing CI pipeline
To integrate your existing Terraform deployment pipelines, use Firefly's docker or CLI.
To create a custom workflow, you must be authenticated with Firefly. To authenticate your account, procure an access key and secret key from Firefly.
Use one of the methods below to send your data to Firefly:
Pass the keys as arguments (
--access-key
and--secret-key
)Pass the keys as environment variables (
FIREFLY_ACESS_KEY
andFIREFLY_SECRET_KEY
)
Downloading the CLI
To download, install, and use the Firefly CI CLI, follow the instructions below. If you encounter any issues, refer to the FAQ section and/or seek support from our support team.
Download the relevant CLI for your operating system using the links below:
MacOS
Linux
Microsoft Windows
Using cURL
Download the CLI using the cURL commands below:
Move the extracted binary to one of the directories in your $PATH
to make it executable from anywhere:
Docker image
The CLI is available as a Docker image:
Using the CLI
Post Plan
Post Apply
Procedure
Select Create key pair.
Store the access key and secret key in your secret manager that is accessible to your CI/CD tool.
In your pipeline, add the Firefly access key and secret key as Environment Variables as
FIREFLY_ACCESS_KEY
andFIREFLY_SECRET_KEY
.Modify your
terraform plan
to include file output toplan_log.json
andplan.json
. Example:terraform plan -json -out=tf.plan > plan_log.json && terraform show -json tf.plan > plan.json
Add a new pipeline step: Firefly CI Post Plan, which runs between
terraform plan
andterraform apply
. The step should execute the docker run command below:docker run --rm -e FIREFLY_ACCESS_KEY -e FIREFLY_ACCESS_KEY -v $(pwd):/app/cicd public.ecr.aws/firefly/fireflyci:latest post-plan -l /app/cicd/plan_log.json -f /app/cicd/plan.json -w <WORKSPACE_NAME>
-w
Workspace name displayed in Firefly, unique to this workflow for each Terraform workspace. Naming workspaces appropriately helps manage and distinguish between different deployment stages (like development, testing, or production) within the same Terraform configuration.
Modify your
terraform apply
to include file output toapply_log.json
. Example:terraform apply -auto-approve -json > apply_log.json
Add a new pipeline step: Firefly CI Post Apply, which runs after
terraform apply
.This should execute the docker run command below:
docker run --rm -e FIREFLY_ACCESS_KEY -e FIREFLY_ACCESS_KEY -v $(pwd):/app/cicd public.ecr.aws/firefly/fireflyci:latest post-apply -f /app/cicd/apply_log.json -w <WORKSPACE_NAME>
-w
Workspace name displayed in Firefly, unique to this workflow for each Terraform workspace. Use the same value you provided in step #5
Pull-request comments with plan summaries
Firefly automatically adds a pull-request comment that summarizes your terraform plan
. This summary includes a cost estimation, policy violations, tags coverage information, basic information on the changes made, and a link to the full plan from our platform. To enable this feature, integrate your VCS with Firefly.
Terraform Plan CLI
Using only Firefly credentials, the Terraform plan CLI allows you to execute Terraform plans from your local machine without committing changes to your VCS or storing credentials locally. The CLI works by sending the git-diffs from your default branch to Firefly. Firefly then creates a temporary branch, executes the necessary workflow, and returns the plan output to the CLI, which is displayed on your terminal.
To download and use the CLI to obtain Terraform outputs directly in your command line, refer to the instructions below:
Support Matrix
IaC type | CI tool | VCS integration with Firefly | Managed workflow |
---|---|---|---|
Terraform | GitHub actions | Necessary | Necessary |
Downloading the CLI
To download, install, and use the Firefly Plan CLI, follow the instructions below. If you encounter any issues, refer to the FAQ section and/or seek support from our support team.
Download the relevant CLI for your operating system using the links below:
MacOS
Linux
Microsoft Windows
Using cURL
Download the CLI using the cURL commands below:
Move the extracted binary to one of the directories in your $PATH
to make it executable from anywhere:
Docker image
The CLI is available as a Docker image:
Using the CLI
Procedure
Authenticate using your Firefly keys:
fireflyplan configure -p profilename
Run the Firefly plan:
Open the Git repository where your workspace is located.
Update your IaC files with the necessary changes.
To execute the plan, run the command below:
fireflyplan plan <WORKSPACE_NAME>
The output of the plan is displayed in your terminal.
Firefly Migration CLI
As a Terraform Enterprise (TFE) user, you can use the CLI tool to migrate to a generic CI/CD system and leverage Firefly's workflows. We map each workspace in TFE to a Firefly workflow and create a new, corresponding backend file. The CLI uses configured backend provider credentials to transfer the state file from TFE to the backend. TFE secrets and variables are mapped to corresponding concepts in the CI/CD system, with a Terraform module generated to set up these configurations. Secret values are used a place holder and must be replaced manually.
To download, install, and use the Firefly Migration CLI effectively, follow the instructions below. If you encounter any issues, refer to the FAQ section and/or seek support from our support team.
Support Matrix
IaC type | CI tool | Backend | VCS integration with Firefly |
---|---|---|---|
Terraform | GitHub actions | S3 | Necessary |
Downloading the CLI
Download the appropriate CLI for your operating system using the links below:
MacOS
Linux
Microsoft Windows
Using cURL
Download the CLI using the cURL commands below:
Move the extracted binary to one of the directories in your $PATH
to make it executable from anywhere:
Using the CLI
Procedure
Authenticate using your Firefly keys:
fireflymigration configure -p profilename
Run the Firefly migrate:
fireflymigration migrate
Configuration Prompts
After running the migrate command, you are prompted to provide the configuration information below:
Firefly access key and secret key
Name of S3 bucket to move the state file to
Name of DynamoDB table to use for locking Terraform states
(Optional) For OIDC to connect to AWS, an IAM role with a policy allowing GitHub to assume the role
(Optional) A comma-separated list of workspaces to migrate in the format `<organization>:<workspaceId>`
Output
The script produces a directory containing Terraform code to create the GitHub Actions environments, along with the variables and secrets. Non-sensitive values are be pre-filled, but sensitive values need to be input manually.
Table
Each Workspace represents one IaC stack and one Firefly Workflow.
Each Workspace deploys a few assets connected to each other. They can be in multiple providers or in one provider.
To view Workspace details, select the caret.
Column | Description |
---|---|
Started at | When the Terraform plan or apply was started |
Build ID | CI/CD pipeline run ID with link |
Title | CI/CD run title |
Commit ID | Commit used to run the CI/CD pipeline |
Branch | Branch used to run the CI/CD pipeline |
Summary | Resource actions (e.g. |
Policy Violations | Summary of the violations in your Terraform plan |
Cost Est | Estimated cost adjustment in your Terraform plan or apply |
Tags Coverage | Overview of the tagging status, indicating the percentage of resources that are tagged. |
Owner | Owner of the |
Status | Whether the |
Using AI-Generated Error Remediation Suggestions
Use this tool when an error is detected during the plan or apply stages of your deployment. When an error occurs, a Thinkerbell icon appears next to the diagnostic message. To view AI-generated suggestions and/or remediation steps that include detailed explanations and proposed code changes, select the Thinkerbell icon.
Viewing Run Logs
You can view the run details, which incorporate the logs from all stages of a run, including init
, plan
, and apply
.
Support Matrix
Type of Workflow | CI tools | IaC type | Integration method |
---|---|---|---|
Managed by Firefly | Azure Pipelines, GitHub actions | OpenTofu, Terraform | Firefly workflow wizard |
Integrated with an existing Workflow | Any | OpenTofu, Terraform | Self-service |
FAQ
Last updated