-
Notifications
You must be signed in to change notification settings - Fork 187
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: Supports change_stream_options_pre_and_post_images_expire_after_seconds in mongodbatlas_cluster
and mongodbatlas_advanced_cluster
#2528
Conversation
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.
overall approach LGTM, had some small doubts
@@ -206,6 +208,7 @@ func TestAccCluster_basic_DefaultWriteRead_AdvancedConf(t *testing.T) { | |||
resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.oplog_size_mb", "1000"), | |||
resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.sample_refresh_interval_bi_connector", "310"), | |||
resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.sample_size_bi_connector", "110"), | |||
resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.change_stream_options_pre_and_post_images_expire_after_seconds", "-1"), |
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.
nice test scenario
mongodbatlas_cluster
mongodbatlas_cluster
and mongodbatlas_advanced_cluster
APIx bot: a message has been sent to Docs Slack channel |
func flattenProcessArgs(p *admin20240530.ClusterDescriptionProcessArgs) []map[string]any { | ||
if p == nil { | ||
func flattenProcessArgs(p20240530 *admin20240530.ClusterDescriptionProcessArgs, p *admin.ClusterDescriptionProcessArgs20240805) []map[string]any { | ||
if p20240530 == nil { |
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.
names looks strange to me. I would go for a more generic: pOld
and pNew
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.
I did it like this to be consistent on how we handle different SDK version and also thinking in the future where we might only use the "new", so the refactor would be cleaner and we would only keep the p
(there wouldn't be a need to change from pNew
to p
)
if err != nil { | ||
return diag.FromErr(fmt.Errorf(errorConfigRead, clusterName, err)) | ||
} | ||
processArgs, _, err := connV2.ClustersApi.GetClusterAdvancedConfiguration(ctx, projectID, clusterName).Execute() |
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.
Why do we need both processArgs20240530
and processArgs
? Will the GetClusterAdvancedConfiguration
ever return nil?
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.
ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds is only available in processArgs
which is from the latest SDK versrion
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.
Can we not remove the processArgs20240530
?
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.
LGTM, just a final doubt on my end
"change_stream_options_pre_and_post_images_expire_after_seconds": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Default: -1, |
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.
Just to confirm, was the final agreement with the API team that we send the default of -1 if attribute is not defined?
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.
-1 and null(not set) is equivalent in this case for the API. Setting the default value to -1 in the schema is necessary for the case of the user wanting to go back to the default value(which might not always be the same) after having set a different value. This would means that the user would remove the attribute from the TF config, and if there's not default value, it wouldn't be updated in the server because if the value is null in a PATCH, it's not sent
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.
Nice. Some small nits. Also, got a bit confused about the schema for advanced configuration only lives in the advanced_cluster.
Merging. I ran the local build of the provider and advanced_cluster and cluster works as expected |
* master: doc: Adds 1.19.0 release upgrade guide (#2564) chore: Updates CHANGELOG.md for #2528 feat: Supports change_stream_options_pre_and_post_images_expire_after_seconds in `mongodbatlas_cluster` and `mongodbatlas_advanced_cluster` (#2528) chore: Disables preview mode for EAR private endpoint so it may be normally accessible (#2571) doc: Adds support for SDK_BRANCH in schema generation (#2562) update git workflow (#2572) chore: Updates CHANGELOG.md for #2566 feat: Adds `mongodbatlas_stream_processor` resource and data sources (#2566) chore: Updates CHANGELOG.md for #2569 chore: Merges Azure KMS Encryption at Rest Private Endpoint feature to master (#2569) chore: Updates CHANGELOG.md for #2568 doc: Includes sync_creation into mongodbatlas_online_archive resource documentation (#2567) fix: Sets correct `zone_id` when `use_replication_spec_per_shard` is false and refactors `replica_set_scaling_strategy` handling with old schema of advanced cluster (#2568) chore: Updates CHANGELOG.md for #2539 feat: Support `replica_set_scaling_strategy` in `mongodbatlas_advanced_cluster` (#2539) adding changelog entry for 1.18.1 to avoid confusion (#2561) # Conflicts: # internal/provider/provider.go
* master: doc: Adds 1.19.0 release upgrade guide (#2564) chore: Updates CHANGELOG.md for #2528 feat: Supports change_stream_options_pre_and_post_images_expire_after_seconds in `mongodbatlas_cluster` and `mongodbatlas_advanced_cluster` (#2528) chore: Disables preview mode for EAR private endpoint so it may be normally accessible (#2571) doc: Adds support for SDK_BRANCH in schema generation (#2562) update git workflow (#2572) chore: Updates CHANGELOG.md for #2566 feat: Adds `mongodbatlas_stream_processor` resource and data sources (#2566) chore: Updates CHANGELOG.md for #2569 chore: Merges Azure KMS Encryption at Rest Private Endpoint feature to master (#2569) chore: Updates CHANGELOG.md for #2568 doc: Includes sync_creation into mongodbatlas_online_archive resource documentation (#2567) fix: Sets correct `zone_id` when `use_replication_spec_per_shard` is false and refactors `replica_set_scaling_strategy` handling with old schema of advanced cluster (#2568) chore: Updates CHANGELOG.md for #2539 feat: Support `replica_set_scaling_strategy` in `mongodbatlas_advanced_cluster` (#2539) adding changelog entry for 1.18.1 to avoid confusion (#2561) # Conflicts: # internal/provider/provider.go
* master: doc: Adds 1.19.0 release upgrade guide (#2564) chore: Updates CHANGELOG.md for #2528 feat: Supports change_stream_options_pre_and_post_images_expire_after_seconds in `mongodbatlas_cluster` and `mongodbatlas_advanced_cluster` (#2528) chore: Disables preview mode for EAR private endpoint so it may be normally accessible (#2571) doc: Adds support for SDK_BRANCH in schema generation (#2562) update git workflow (#2572) chore: Updates CHANGELOG.md for #2566 feat: Adds `mongodbatlas_stream_processor` resource and data sources (#2566) chore: Updates CHANGELOG.md for #2569 chore: Merges Azure KMS Encryption at Rest Private Endpoint feature to master (#2569) chore: Updates CHANGELOG.md for #2568 doc: Includes sync_creation into mongodbatlas_online_archive resource documentation (#2567) fix: Sets correct `zone_id` when `use_replication_spec_per_shard` is false and refactors `replica_set_scaling_strategy` handling with old schema of advanced cluster (#2568) chore: Updates CHANGELOG.md for #2539 feat: Support `replica_set_scaling_strategy` in `mongodbatlas_advanced_cluster` (#2539) adding changelog entry for 1.18.1 to avoid confusion (#2561) # Conflicts: # internal/provider/provider.go
Description
Supports change_stream_options_pre_and_post_images_expire_after_seconds in mongodbatlas_cluster
Link to any related issue(s): CLOUDP-262696
Type of change:
Required Checklist:
Further comments