@@ -219,8 +219,6 @@ func processRepSpecsClusterWithDynamicBlock(resourceb *hclwrite.Body, root attrV
219219 if err != nil {
220220 return dynamicBlock {}, err
221221 }
222-
223- // Check if we have a dynamic region_configs block that was successfully processed
224222 if dConfig .tokens != nil {
225223 forSpec := hcl .TokensFromExpr (buildForExpr (nSpec , hcl .GetAttrExpr (dSpec .forEach ), true ))
226224 forSpec = append (forSpec , dConfig .tokens ... )
@@ -231,31 +229,9 @@ func processRepSpecsClusterWithDynamicBlock(resourceb *hclwrite.Body, root attrV
231229
232230 // Handle static region_configs blocks inside dynamic replication_specs
233231 specBody := dSpec .content .Body ()
234-
235- // Collect static region_configs blocks
236232 staticConfigs := collectBlocks (specBody , nConfigSrc )
237- if len (staticConfigs ) == 0 {
238- // No static blocks found, check if there's also no dynamic block
239- hasDynamicBlock := false
240- for _ , block := range specBody .Blocks () {
241- if block .Type () == nDynamic && getResourceName (block ) == nConfigSrc {
242- hasDynamicBlock = true
243- break
244- }
245- }
246- if ! hasDynamicBlock {
247- return dynamicBlock {}, fmt .Errorf ("replication_specs must have at least one regions_config" )
248- }
249- // There's a dynamic block but fillConfigsWithDynamicRegion returned empty
250- return dynamicBlock {}, nil
251- }
252-
253233 repSpecb := hclwrite .NewEmptyFile ().Body ()
254-
255- // Handle zone_name attribute
256234 handleZoneName (repSpecb , specBody , nRepSpecs , nSpec )
257-
258- // Process static region_configs blocks
259235 var configs []* hclwrite.Body
260236 for _ , configBlock := range staticConfigs {
261237 config , err := getRegionConfig (configBlock , root , false )
@@ -264,16 +240,12 @@ func processRepSpecsClusterWithDynamicBlock(resourceb *hclwrite.Body, root attrV
264240 }
265241 configs = append (configs , config )
266242 }
267-
268243 configs = sortConfigsByPriority (configs )
269244 repSpecb .SetAttributeRaw (nConfig , hcl .TokensArray (configs ))
270-
271- // Handle num_shards attribute
272245 numShardsAttr := specBody .GetAttribute (nNumShards )
273246 forSpec := hcl .TokensFromExpr (buildForExpr (nSpec , hcl .GetAttrExpr (dSpec .forEach ), true ))
274247 numShardsTokens := buildNumShardsTokens (numShardsAttr , repSpecb , nRepSpecs , nSpec )
275248 dSpec .tokens = hcl .TokensFuncFlatten (append (forSpec , numShardsTokens ... ))
276-
277249 return dSpec , nil
278250}
279251
0 commit comments