Open
Description
Module version
v1.13.0
Relevant provider source code
Schema generated from OpenAPI spec
"active_review": schema.SingleNestedAttribute{
Attributes: map[string]schema.Attribute{
"description": schema.StringAttribute{
Required: true,
},
"review_id": schema.StringAttribute{
Required: true,
},
"review_status": schema.StringAttribute{
Required: true,
},
},
CustomType: ActiveReviewType{
ObjectType: types.ObjectType{
AttrTypes: ActiveReviewValue{}.AttributeTypes(ctx),
},
},
Optional: true,
Computed: true,
},
Relevant part of OpenAPI spec
"activeReview": {
"type": "object",
"properties": {
"reviewID": {
"type": "string"
},
"reviewStatus": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": [
"reviewID",
"reviewStatus",
"description"
]
}
},
"required": [
"id",
"description",
"lastModifierID",
"lastModifiedTime",
"lastModifierEmail",
"lastModifierName",
"createdTime",
"creatorName",
"checksPerHour",
"status",
"type",
"typeReason",
"isEnabled",
"rules"
]
Terraform Configuration Files
resource "statsig_experiment" "full_experiment" {
name = "full_experiment"
description = "A short description of what we are experimenting on."
id_type = "userID"
allocation = 12.3
status = "setup"
hypothesis = "Move some metrics"
layer_id = "a_layer"
tags = [
"test-tag-a",
"test-tag-b"
]
primary_metrics = [
{
name = "d1_retention_rate"
type = "user"
}
]
primary_metric_tags = [
"test-tag-a"
]
secondary_metrics = [
{
name = "new_dau"
type = "user"
}
]
secondary_metric_tags = [
"test-tag-b"
]
groups = [
{
name = "Test A"
size = 33.3
parameter_values = { "a_string" : "test_a" }
},
{
name = "Test B"
size = 33.3
parameter_values = { "a_string" : "test_b" }
},
{
name = "Control"
size = 33.4
parameter_values = { "a_string" : "control" }
}
]
default_confidence_interval = "80"
bonferroni_correction = true
duration = 10
launched_group_id = ""
targeting_gate_id = "targeting_gate"
}
Debug Output
https://gist.github.com/kenny-statsig/37655ad084167fe70fd327da27bb72ae
Expected Behavior
I expected the attribute active_review
to be treated as optional. And only if provided in the configuration, would the attributes description
, review_id
, review_status
be required.
Actual Behavior
My acceptance test failed due to the missing attributes active_review.description
, active_review.review_id
, active_review.review_status
supposedly marked as required by my provider.
Error: Missing Configuration for Required Attribute
with statsig_experiment.full_experiment,
on experiment_full.tf line 3, in resource "statsig_experiment" "full_experiment":
3: description = "A short description of what we are experimenting on."
Must set a configuration value for the active_review.description attribute as
the provider has marked it as required.
Steps to Reproduce
Provider is still in development so cannot be reproduced externally.
But it's a simple acceptance test
func TestAccExperimentFull_MUX(t *testing.T) {
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: protoV6ProviderFactories(),
PreCheck: func() { testAccPreCheck(t) },
Steps: []resource.TestStep{
{
ConfigFile: config.StaticFile("test_resources/experiment_full.tf"),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectEmptyPlan(),
},
},
},
},
})
}