@@ -1593,6 +1593,31 @@ func (wr *WorkloadResource) OptionsSchema(description string) schema.ListNestedB
15931593 listvalidator .SizeAtMost (1 ),
15941594 },
15951595 },
1596+ "fallback" : schema.ListNestedBlock {
1597+ Description : "Fallback configuration for KEDA." ,
1598+ NestedObject : schema.NestedBlockObject {
1599+ Attributes : map [string ]schema.Attribute {
1600+ "failure_threshold" : schema.Int32Attribute {
1601+ Description : "Number of consecutive failures required to trigger fallback behavior." ,
1602+ Required : true ,
1603+ },
1604+ "replicas" : schema.Int32Attribute {
1605+ Description : "Number of replicas to scale to when fallback is triggered." ,
1606+ Required : true ,
1607+ },
1608+ "behavior" : schema.StringAttribute {
1609+ Description : "Behavior to apply when fallback is triggered." ,
1610+ Optional : true ,
1611+ Validators : []validator.String {
1612+ stringvalidator .OneOf ("static" , "currentReplicas" , "currentReplicasIfHigher" , "currentReplicasIfLower" ),
1613+ },
1614+ },
1615+ },
1616+ },
1617+ Validators : []validator.List {
1618+ listvalidator .SizeAtMost (1 ),
1619+ },
1620+ },
15961621 },
15971622 },
15981623 Validators : []validator.List {
@@ -2783,11 +2808,12 @@ func (wro *WorkloadResourceOperator) buildOptionsAutoscalingKeda(state types.Lis
27832808
27842809 // Construct and return the output
27852810 return & client.WorkloadOptionsAutoscalingKeda {
2811+ Triggers : wro .buildOptionsAutoscalingKedaTrigger (block .Triggers ),
2812+ Advanced : wro .buildOptionsAutoscalingKedaAdvanced (block .Advanced ),
2813+ Fallback : wro .buildOptionsAutoscalingKedaFallback (block .Fallback ),
27862814 PollingInterval : BuildInt (block .PollingInterval ),
27872815 CooldownPeriod : BuildInt (block .CooldownPeriod ),
27882816 InitialCooldownPeriod : BuildInt (block .InitialCooldownPeriod ),
2789- Triggers : wro .buildOptionsAutoscalingKedaTrigger (block .Triggers ),
2790- Advanced : wro .buildOptionsAutoscalingKedaAdvanced (block .Advanced ),
27912817 }
27922818}
27932819
@@ -2884,6 +2910,27 @@ func (wro *WorkloadResourceOperator) buildOptionsAutoscalingKedaAdvancedScalingM
28842910 }
28852911}
28862912
2913+ // buildOptionsAutoscalingKedaFallback constructs a WorkloadOptionsAutoscalingKedaFallback from the given Terraform state.
2914+ func (wro * WorkloadResourceOperator ) buildOptionsAutoscalingKedaFallback (state types.List ) * client.WorkloadOptionsAutoscalingKedaFallback {
2915+ // Convert Terraform list into model blocks using generic helper
2916+ blocks , ok := BuildList [models.OptionsAutoscalingKedaFallbackModel ](wro .Ctx , wro .Diags , state )
2917+
2918+ // Return nil if conversion failed or list was empty
2919+ if ! ok {
2920+ return nil
2921+ }
2922+
2923+ // Take the first (and only) block
2924+ block := blocks [0 ]
2925+
2926+ // Construct and return the output
2927+ return & client.WorkloadOptionsAutoscalingKedaFallback {
2928+ FailureThreshold : BuildInt (block .FailureThreshold ),
2929+ Replicas : BuildInt (block .Replicas ),
2930+ Behavior : BuildString (block .Behavior ),
2931+ }
2932+ }
2933+
28872934// buildOptionsMultiZone constructs a WorkloadOptionsMultiZone from the given Terraform state.
28882935func (wro * WorkloadResourceOperator ) buildOptionsMultiZone (state types.List ) * client.WorkloadOptionsMultiZone {
28892936 // Convert Terraform list into model blocks using generic helper
@@ -3907,11 +3954,12 @@ func (wro *WorkloadResourceOperator) flattenOptionsAutoscalingKeda(input *client
39073954
39083955 // Build a single block
39093956 block := models.OptionsAutoscalingKedaModel {
3957+ Triggers : wro .flattenOptionsAutoscalingKedaTrigger (input .Triggers ),
3958+ Advanced : wro .flattenOptionsAutoscalingKedaAdvanced (input .Advanced ),
3959+ Fallback : wro .flattenOptionsAutoscalingKedaFallback (input .Fallback ),
39103960 PollingInterval : FlattenInt (input .PollingInterval ),
39113961 CooldownPeriod : FlattenInt (input .CooldownPeriod ),
39123962 InitialCooldownPeriod : FlattenInt (input .InitialCooldownPeriod ),
3913- Triggers : wro .flattenOptionsAutoscalingKedaTrigger (input .Triggers ),
3914- Advanced : wro .flattenOptionsAutoscalingKedaAdvanced (input .Advanced ),
39153963 }
39163964
39173965 // Return the successfully created types.List
@@ -4015,6 +4063,28 @@ func (wro *WorkloadResourceOperator) flattenOptionsAutoscalingKedaAdvancedScalin
40154063 return FlattenList (wro .Ctx , wro .Diags , []models.OptionsAutoscalingKedaAdvancedScalingModifiersModel {block })
40164064}
40174065
4066+ // flattenOptionsAutoscalingKedaFallback transforms *client.WorkloadOptionsAutoscalingKedaFallback into a types.List.
4067+ func (wro * WorkloadResourceOperator ) flattenOptionsAutoscalingKedaFallback (input * client.WorkloadOptionsAutoscalingKedaFallback ) types.List {
4068+ // Get attribute types
4069+ elementType := models.OptionsAutoscalingKedaFallbackModel {}.AttributeTypes ()
4070+
4071+ // Check if the input is nil
4072+ if input == nil {
4073+ // Return a null list
4074+ return types .ListNull (elementType )
4075+ }
4076+
4077+ // Build a single block
4078+ block := models.OptionsAutoscalingKedaFallbackModel {
4079+ FailureThreshold : FlattenInt (input .FailureThreshold ),
4080+ Replicas : FlattenInt (input .Replicas ),
4081+ Behavior : types .StringPointerValue (input .Behavior ),
4082+ }
4083+
4084+ // Return the successfully created types.List
4085+ return FlattenList (wro .Ctx , wro .Diags , []models.OptionsAutoscalingKedaFallbackModel {block })
4086+ }
4087+
40184088// flattenOptionsMultiZone transforms *client.WorkloadOptionsMultiZone into a types.List.
40194089func (wro * WorkloadResourceOperator ) flattenOptionsMultiZone (input * client.WorkloadOptionsMultiZone ) types.List {
40204090 // Get attribute types
0 commit comments