Affected: Terraform Integration
Overview
This topic explains how LaunchDarkly handles flag deletion in Terraform when the flag is referenced in an experiment. If you attempt to delete a flag that is part of an experiment, the terraform plan
command completes successfully, but terraform apply
fails. This is because LaunchDarkly retains flags used in experiments to preserve their results, which prevents complete deletion during the apply phase.
Solution
Deleting a flag that was previously tied to an experiment is not currently possible.
As a workaround, archive the flag instead. Archiving removes the flag from evaluation in your SDK implementation, which effectively mimics deletion. However, unlike deletion, archiving retains the ability to restore the flag in the future if needed.