Skip to content

Commit 0273b9a

Browse files
committed
remove fail_index_key_too_long & default_read_concern in advanced_configuration
1 parent 92bbb47 commit 0273b9a

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

internal/convert/adv2v2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func updateResource(resource *hclwrite.Block) (bool, error) {
5050
if err := fillTagsLabelsOpt(resourceb, nLabels); err != nil {
5151
return false, err
5252
}
53-
fillBlockOpt(resourceb, nAdvConf)
53+
fillAdvConfigOpt(resourceb, nAdvConf)
5454
fillBlockOpt(resourceb, nBiConnector)
5555
fillBlockOpt(resourceb, nPinnedFCV)
5656
fillBlockOpt(resourceb, nTimeouts)

internal/convert/clu2adv.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func fillCluster(resourceb *hclwrite.Body) error {
164164
if err := fillTagsLabelsOpt(resourceb, nLabels); err != nil {
165165
return err
166166
}
167-
fillBlockOpt(resourceb, nAdvConf)
167+
fillAdvConfigOpt(resourceb, nAdvConf)
168168
fillBlockOpt(resourceb, nBiConnector)
169169
fillBlockOpt(resourceb, nPinnedFCV)
170170
fillBlockOpt(resourceb, nTimeouts)
@@ -303,6 +303,20 @@ func fillBlockOpt(resourceb *hclwrite.Body, name string) {
303303
resourceb.SetAttributeRaw(name, hcl.TokensObject(block.Body()))
304304
}
305305

306+
func fillAdvConfigOpt(resourceb *hclwrite.Body, name string) {
307+
block := resourceb.FirstMatchingBlock(name, nil)
308+
if block == nil {
309+
return
310+
}
311+
blockBody := block.Body()
312+
313+
// Remove deprecated attributes from advanced_configuration
314+
blockBody.RemoveAttribute(nFailIndexKeyTooLong)
315+
blockBody.RemoveAttribute(nDefaultReadConcern)
316+
317+
fillBlockOpt(resourceb, name)
318+
}
319+
306320
// fillReplicationSpecsWithDynamicBlock used for dynamic blocks in replication_specs
307321
func fillReplicationSpecsWithDynamicBlock(resourceb *hclwrite.Body, root attrVals) (dynamicBlock, error) {
308322
dSpec, err := getDynamicBlock(resourceb, nRepSpecs)

internal/convert/const.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,6 @@ const (
7878
nContent = "content"
7979
nRegion = "region"
8080
nSpec = "spec"
81+
nFailIndexKeyTooLong = "fail_index_key_too_long"
82+
nDefaultReadConcern = "default_read_concern"
8183
)

0 commit comments

Comments
 (0)