-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Adds new advanced_configuration.0.default_max_time_ms
attribute to mongodbatlas_advanced_cluster
resource and data sources
#2825
Merged
+166
−35
Merged
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ead56a2
add default max time attr
maastha 224e10a
update test
maastha 78e7a5f
make optional
maastha 646dd78
minor
maastha f7d3100
migration
maastha 667b347
cleanup
maastha b4b44d7
add changelog
maastha 6ff282f
update readme
maastha 1be1aba
mdb version check
maastha 87ec371
fmt
maastha 21d9cf0
add validation
maastha 78c5b23
minor
maastha a3d6327
doc
maastha 51b9938
min
maastha 2586a98
minor
maastha a087f24
Merge branch 'master' into CLOUDP-250898-defaultreadmaxtimeMS
maastha 638c4bf
doc
maastha eb961e5
minor
maastha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
```release-note:note | ||
resource/mongodbatlas_advanced_cluster: Adds new `advanced_configuration.0.default_max_time_ms` attribute | ||
``` | ||
|
||
```release-note:note | ||
data-source/mongodbatlas_advanced_cluster: Adds new `advanced_configuration.0.default_max_time_ms` attribute | ||
``` | ||
|
||
```release-note:note | ||
data-source/mongodbatlas_advanced_clusters: Adds new `advanced_configuration.0.default_max_time_ms` attribute | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ import ( | |
) | ||
|
||
const minVersionForChangeStreamOptions = 6.0 | ||
const minVersionForDefaultMaxTimeMS = 8.0 | ||
|
||
var ( | ||
DSTagsSchema = schema.Schema{ | ||
|
@@ -117,6 +118,10 @@ func SchemaAdvancedConfigDS() *schema.Schema { | |
Type: schema.TypeInt, | ||
Computed: true, | ||
}, | ||
"default_max_time_ms": { | ||
Type: schema.TypeInt, | ||
Computed: true, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
@@ -262,6 +267,10 @@ func SchemaAdvancedConfig() *schema.Schema { | |
Optional: true, | ||
Default: -1, | ||
}, | ||
"default_max_time_ms": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed with upstream this is expected to be user-managed, hence keeping optional |
||
}, | ||
}, | ||
}, | ||
} | ||
|
@@ -511,7 +520,12 @@ func flattenProcessArgs(p20240530 *admin20240530.ClusterDescriptionProcessArgs, | |
} else { | ||
flattenedProcessArgs[0]["change_stream_options_pre_and_post_images_expire_after_seconds"] = p.GetChangeStreamOptionsPreAndPostImagesExpireAfterSeconds() | ||
} | ||
|
||
if v := p.DefaultMaxTimeMS; v != nil { | ||
flattenedProcessArgs[0]["default_max_time_ms"] = p.GetDefaultMaxTimeMS() | ||
} | ||
} | ||
|
||
return flattenedProcessArgs | ||
} | ||
|
||
|
@@ -852,10 +866,19 @@ func expandProcessArgs(d *schema.ResourceData, p map[string]any, mongodbMajorVer | |
|
||
res.ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds = conversion.IntPtr(tmpInt) | ||
} | ||
|
||
if _, ok := d.GetOkExists("advanced_configuration.0.default_max_time_ms"); ok { | ||
if IsDefaultMaxTimeMinRequiredMajorVersion(mongodbMajorVersion) { | ||
res.DefaultMaxTimeMS = conversion.Pointer(cast.ToInt(p["default_max_time_ms"])) | ||
} else { | ||
log.Print(ErrorDefaultMaxTimeMinVersion) | ||
} | ||
} | ||
|
||
return res20240530, res | ||
} | ||
|
||
func IsChangeStreamOptionsMinRequiredMajorVersion(input *string) bool { | ||
func isMinRequiredMajorVersion(input *string, minVersion float64) bool { | ||
if input == nil || *input == "" { | ||
return true | ||
} | ||
|
@@ -869,7 +892,15 @@ func IsChangeStreamOptionsMinRequiredMajorVersion(input *string) bool { | |
return false | ||
} | ||
|
||
return value >= minVersionForChangeStreamOptions | ||
return value >= minVersion | ||
} | ||
|
||
func IsChangeStreamOptionsMinRequiredMajorVersion(input *string) bool { | ||
return isMinRequiredMajorVersion(input, minVersionForChangeStreamOptions) | ||
} | ||
|
||
func IsDefaultMaxTimeMinRequiredMajorVersion(input *string) bool { | ||
return isMinRequiredMajorVersion(input, minVersionForDefaultMaxTimeMS) | ||
} | ||
|
||
func expandLabelSliceFromSetSchema(d *schema.ResourceData) ([]admin20240805.ComponentLabel, diag.Diagnostics) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.