Terraform Release Workflows

Make the release foundation repeatable with Terraform.

Declare FeatBit resources as infrastructure as code, review a Terraform plan, and apply the approved change. Git gives the IaC a version history; runtime validation and promotion carry the release from Dev to Stage to Prod.

main.tfDEFINEPLANAPPLY

A practical walkthrough with checkout-experience

The story · A repeatable release foundation with Terraform

The next environment should inherit the same definitions, without copying resource IDs by hand.

A platform team needs matching projects, environments, and flag definitions before validating a checkout release. Terraform describes that resource graph as IaC. Git records the reviewed changes, and the team validates runtime behavior as it moves from Dev to Stage to Prod.

Terraform provider workflow · Documented HCL and dashboard example

Inside FeatBit · 3 steps

Define, plan, and apply the release foundation.

Use Terraform for repeatable FeatBit resource definitions, then validate and promote runtime behavior through your environments.

Provider scope · Terraform manages the supported resource definitions. Feature flag targeting, percentage rollouts, and enabled state remain managed in FeatBit. Git provides version history and review for the IaC.

  1. 01Step 01 / 03

    Declare the same flag definition for each environment.

    Model the project, environments, flag definitions, and supported segments in HCL. This excerpt creates checkout-experience for every ID in local.environment_ids. FeatBit creates Dev and Prod with a project; the tutorial explicitly adds Stage.

    Environment map
    Dev · Stage · Prod
    Flag definition
    checkout-experience · boolean
    Version control
    Review the HCL in Git

    One Terraform graph captures the dependencies and gives each environment a matching flag definition.

    feature-flags.tf · excerptTerraform · IaC
    resource "featbit_feature_flag" "checkout" {
      for_each = local.environment_ids
    
      environment_id = each.value
      key            = "checkout-experience"
      name           = "Checkout experience"
      variation_type = "boolean"
    
      variations = [
        { name = "Existing checkout", value = "false" },
        { name = "New checkout", value = "true" },
      ]
    }

    Define the flag once for each environment in the map. See the tutorial for the complete project and environment configuration.

    HCL definitions

    Dev · Stage · Prod

    Git versions the IaC; Terraform manages the resource graph
  2. 02Step 02 / 03

    Review the plan, then apply that exact plan.

    Initialize and validate the configuration, save a plan, and review its additions, replacements, and removals. Apply the reviewed plan locally or through your CI process, then require a second plan to report no changes. Definition fields such as variations can require replacement.

    Review artifact
    Saved Terraform plan
    After apply
    Second plan → No changes
    CI credential
    FEATBIT_ACCESS_TOKEN via secret storage

    The applied resource change is tied to a specific reviewed plan. The commands shown are a workflow example, not an executed deployment.

    Terraform workflow · command exampleTerraform · IaC
    terraform init
    terraform fmt -check
    terraform validate
    
    terraform plan -out=release.tfplan
    # Review additions, replacements, and removals.
    terraform apply release.tfplan
    
    terraform plan
    # Verify that the next plan reports no changes.

    Review and apply the saved plan. Git and CI can organize the reviews and execution; this panel does not show a real deployment.

    Reviewed plan

    Apply + verify

    Inspect replacements as well as additions
  3. 03Step 03 / 03

    Validate in Dev, then promote runtime behavior.

    Test the flag through the application in Dev. Use FeatBit Compare and Copy Settings to promote compatible runtime settings to Stage, validate again, then proceed to Prod. The dashboard example shows a 5% checkout canary; this allocation is configured in FeatBit, outside the Terraform flag definition.

    Definition owner
    Terraform
    Targeting and ON / OFF
    FeatBit runtime workflow
    Promotion
    Dev → Stage → Prod, with validation

    The provider leaves UI-owned runtime settings untouched. During an incident, disable or restore the flag in FeatBit while retaining its Terraform definition.

    Inside FeatBitLive app · Demo
    Swipe to inspect
    Dashboard example → Runtime rollout after IaC setup

    Dev validated

    Stage → Prod

    Promote compatible runtime settings in FeatBit

The next decision

Keep resource changes and runtime recovery clear.

Correct Terraform-owned changes through reviewed HCL and a new plan. Recover an unsafe runtime release through FeatBit’s flag controls; the feature flag resource leaves targeting, percentage rollout, and enabled state untouched.

Build your own release in FeatBit

Review the provider’s ownership contract

The feature flag resource updates name in place; fields such as key, environment, variation type, description, and variations require replacement. Targeting, percentage rollouts, enabled state, and cross-environment settings promotion remain FeatBit UI workflows.

All solutions