Skip to main content

Terraform - Manage feature flags directly from HCL scripts

ConfigCat Feature Flags Provider allows you to configure and access ConfigCat resources via ConfigCat Public Management API with Terraform.

Installation

Please refer to the official documentation.

Sample usage

terraform {  required_providers {    configcat = {      source = "configcat/configcat"      version = "~> 1.0"    }  }}provider "configcat" {  version     = "~> 1.0"  // Get your ConfigCat Public API credentials at https://app.configcat.com/my-account/public-api-credentials  basic_auth_username = var.configcat_basic_auth_username  basic_auth_password = var.configcat_basic_auth_password}// Retrieve your Productdata "configcat_products" "my_products" {  name_filter_regex = "ConfigCat's product"}// Retrieve your Configdata "configcat_configs" "ny_configs" {  product_id = data.configcat_products.my_products.products.0.product_id  name_filter_regex = "Main Config"}// Retrieve your Environmentdata "configcat_environments" "my_environments" {  product_id = data.configcat_products.my_products.products.0.product_id  name_filter_regex = "Test"}// Create a Feature Flag/Settingresource "configcat_setting" "setting" {  config_id = data.configcat_configs.ny_configs.configs.0.config_id  key = "isAwesomeFeatureEnabled"  name = "My awesome feature flag"  hint = "This is the hint for my awesome feature flag"  setting_type = "boolean"}// Initialize the Feature Flag/Setting's valueresource "configcat_setting_value" "setting_value" {    environment_id = data.configcat_environments.my_environments.environments.0.environment_id    setting_id = configcat_setting.setting.id    value = "false"}