| page_title | configcat_setting_value_v2 Resource - terraform-provider-configcat |
|---|---|
| subcategory | |
| description | Initializes and updates Feature Flag or Setting values for V2 configs. Read more about the anatomy of a Feature Flag or Setting. https://configcat.com/docs/main-concepts |
Initializes and updates Feature Flag or Setting values for V2 configs. Read more about the anatomy of a Feature Flag or Setting.
variable "config_id" {
type = string
}
variable "environment_id" {
type = string
}
variable "beta_segment_id" {
type = string
}
resource "configcat_setting" "bool" {
config_id = var.config_id
key = "BoolSettingKey"
name = "Bool feature flag"
order = 1
}
resource "configcat_setting" "string" {
config_id = var.config_id
key = "StringSettingKey"
name = "String setting"
order = 2
setting_type = "string"
}
resource "configcat_setting_value_v2" "bool_setting_value" {
environment_id = var.environment_id
setting_id = configcat_setting.bool.id
mandatory_notes = "mandatory notes"
value = { bool_value = true }
targeting_rules = [
{
conditions = [
{
user_condition = {
comparison_attribute = "email"
comparator = "sensitiveTextEquals"
comparison_value = { string_value = "@configcat.com" }
}
},
{
user_condition = {
comparison_attribute = "color"
comparator = "isOneOf"
comparison_value = {
list_values = [
{ value = "#000000", hint = "black" },
{ value = "red" },
]
}
}
},
{
segment_condition = {
segment_id = var.beta_segment_id
comparator = "isIn"
}
},
{
prerequisite_flag_condition = {
prerequisite_setting_id = configcat_setting.string.id
comparator = "doesNotEqual"
comparison_value = { string_value = "test" }
}
}
]
value = { bool_value = true }
},
{
conditions = [
{
user_condition = {
comparison_attribute = "county"
comparator = "sensitiveTextEquals"
comparison_value = { string_value = "Hungary" }
}
},
],
percentage_options = [
{
percentage = 50
value = { bool_value = true }
},
{
percentage = 50
value = { bool_value = false }
}
]
},
{
percentage_options = [
{
percentage = 30
value = { bool_value = true }
},
{
percentage = 70
value = { bool_value = false }
}
]
},
]
}
resource "configcat_setting_value_v2" "string_setting_value" {
environment_id = var.environment_id
setting_id = configcat_setting.string.id
value = { string_value = "test" }
targeting_rules = [
{
conditions = [
{
user_condition = {
comparison_attribute = "email"
comparator = "sensitiveTextEquals"
comparison_value = { string_value = "@configcat.com" }
}
},
]
value = { string_value = "custom" }
},
]
}environment_id(String) The ID of the Environment.setting_id(String) The ID of the Feature Flag or Setting.value(Attributes) Represents the value of a Feature Flag or Setting. (see below for nested schema)
init_only(Boolean) The main purpose of this resource to provide an initial value for the Feature Flag/Setting.
The init_only argument's default value is true. Meaning that the Feature Flag or Setting's value will be only be applied once during resource creation. If someone modifies the value on the ConfigCat Dashboard those modifications will not be overwritten by the Terraform script.
If you want to fully manage the Feature Flag/Setting's value from Terraform, set init_only argument to false. After setting theinit_only argument to false each terraform run will update the Feature Flag/Setting's value to the state provided in Terraform.
mandatory_notes(String) If the Product's "Mandatory notes" preference is turned on for the Environment the Mandatory note must be passed.percentage_evaluation_attribute(String) The user attribute used for percentage evaluation. If not set, it defaults to the Identifier user object attribute.targeting_rules(Attributes List) The targeting rules of the Feature Flag or Setting (see below for nested schema)
id(String) The unique ID of the Feature Flag or Setting value.setting_type(String) The type of the Feature Flag or Setting. Available values:boolean|string|int|double.
Optional:
bool_value(Boolean) The boolean representation of the value.double_value(Number) The decimal number representation of the value.int_value(Number) The whole number representation of the value.predefined_variation_id(String) The predefined variation's ID representation of the value in case of the setting has predefined variations. The feature is currently in closed beta state and cannot be used.string_value(String) The string representation of the value.
Optional:
conditions(Attributes List) The conditions that are combined with the AND logical operator. (see below for nested schema)percentage_options(Attributes List) The percentage options from where the evaluation process will choose a value based on the flag's percentage evaluation attribute. (see below for nested schema)value(Attributes) Represents the value of a Feature Flag or Setting. (see below for nested schema)
Optional:
prerequisite_flag_condition(Attributes) Describes a condition that is based on a prerequisite flag. (see below for nested schema)segment_condition(Attributes) Describes a condition that is based on a segment. (see below for nested schema)user_condition(Attributes) Describes a condition that is based on user attributes. (see below for nested schema)
Required:
comparator(String) Prerequisite flag comparison operator used during the evaluation process. Possible values:equals,doesNotEqualcomparison_value(Attributes) Represents the value of a Feature Flag or Setting. (see below for nested schema)prerequisite_setting_id(String) The prerequisite flag's identifier.
Optional:
bool_value(Boolean) The boolean representation of the value.double_value(Number) The decimal number representation of the value.int_value(Number) The whole number representation of the value.predefined_variation_id(String) The predefined variation's ID representation of the value in case of the setting has predefined variations. The feature is currently in closed beta state and cannot be used.string_value(String) The string representation of the value.
Required:
comparator(String) The segment comparison operator used during the evaluation process. Possible values:isIn,isNotInsegment_id(String) The segment's identifier.
Required:
comparator(String) The comparison operator which defines the relation between the comparison attribute and the comparison value. For possible values check the documentation.comparison_attribute(String) The User Object attribute that the condition is based on.comparison_value(Attributes) The value that the user object's attribute is compared to. (see below for nested schema)
Optional:
double_value(Number) The number representation of the comparison value.list_values(Attributes List) The list representation of the comparison value. (see below for nested schema)string_value(String) The string representation of the comparison value.
Required:
value(String) The actual comparison value.
Optional:
hint(String) An optional hint for the comparison value.
Required:
percentage(Number) A number between 0 and 100 that represents a randomly allocated fraction of the users.value(Attributes) Represents the value of a Feature Flag or Setting. (see below for nested schema)
Optional:
bool_value(Boolean) The boolean representation of the value.double_value(Number) The decimal number representation of the value.int_value(Number) The whole number representation of the value.predefined_variation_id(String) The predefined variation's ID representation of the value in case of the setting has predefined variations. The feature is currently in closed beta state and cannot be used.string_value(String) The string representation of the value.
Optional:
bool_value(Boolean) The boolean representation of the value.double_value(Number) The decimal number representation of the value.int_value(Number) The whole number representation of the value.predefined_variation_id(String) The predefined variation's ID representation of the value in case of the setting has predefined variations. The feature is currently in closed beta state and cannot be used.string_value(String) The string representation of the value.
Import is supported using the following syntax:
# Feature Flag/Setting values (V2) can be imported using a combined EnvironmentID:SettingId ID.
# Get the EnvironmentId using e.g. the [List Environments API](https://api.configcat.com/docs/#tag/Environments/operation/get-environments).
# Get the SettingId using e.g. the [List Flags API](https://api.configcat.com/docs/#tag/Feature-Flags-and-Settings/operation/get-settings).
terraform import configcat_setting_value_v2.example 08d86d63-2726-47cd-8bfc-59608ecb91e2:1234