diff --git a/internal/service/ce/cost_category.go b/internal/service/ce/cost_category.go index 3e788023b18..1161a3f2d3e 100644 --- a/internal/service/ce/cost_category.go +++ b/internal/service/ce/cost_category.go @@ -280,9 +280,9 @@ func schemaCostCategoryRule() *schema.Resource { } func schemaCostCategoryRuleLevel(level int) *schema.Resource { - var elem interface{} = schemaCostCategoryRuleLevel(level + 1) - if level == costCategoryRuleMaxNesting { - elem = schemaCostCategoryRuleExpression() + var elem interface{} = schemaCostCategoryRuleExpression() + if level < costCategoryRuleMaxNesting { + elem = schemaCostCategoryRuleLevel(level + 1) } return &schema.Resource{ Schema: map[string]*schema.Schema{