-
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: Supports redact_client_log_data
in mongodbatlas_cluster
#2601
feat: Supports redact_client_log_data
in mongodbatlas_cluster
#2601
Conversation
APIx bot: a message has been sent to Docs Slack channel |
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
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.
minor improvements but overall LGTM
stateConf := &retry.StateChangeConf{ | ||
Pending: []string{"CREATING", "UPDATING", "REPAIRING"}, | ||
Target: []string{"IDLE"}, | ||
Refresh: ResourceClusterRefreshFunc(ctx, clusterName, projectID, conn), | ||
Timeout: timeout, | ||
MinTimeout: 30 * time.Second, | ||
Delay: 1 * time.Minute, | ||
} |
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 assume this was copied from existing update code, could we extract to a function just to make sure we have state transitions and timeout is single place?
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 guess we could use the CreateStateChangeConfig
from the advancedcluster
package?
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.
thank you both, I've followed @EspenAlbert suggestion and changed here 16f12f3
resource.TestCheckResourceAttr(resourceName, "redact_client_log_data", "false"), | ||
resource.TestCheckResourceAttr(dataSourceName, "redact_client_log_data", "false"), | ||
resource.TestCheckResourceAttr(dataSourcePluralName, "results.0.redact_client_log_data", "false"), |
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.
acc.CheckRSAndDS
can let you define this in a single call
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, thanks! changed in cef542a
Config: configRedactClientLogData(projectID, clusterName, nil), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
checkExists(resourceName), | ||
resource.TestCheckResourceAttr(resourceName, "redact_client_log_data", "false"), |
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 think if you duplicate this step and put it after step 3 the test will fail. Since it is optional-computed
removing the value will see no changes
and it will remain true
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.
yes, I think that's what we're doing in these cases. Removing the field won't be flagged as a change so current value will stay
This reverts commit ce69fa1.
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, thanks for follow ups
stateConf := advancedcluster.CreateStateChangeConfig(ctx, connV2, groupID, clusterName, 15*time.Minute) | ||
if _, err := stateConf.WaitForStateContext(ctx); err != 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.
I know this is unrelated but very strange why we verify cluster state transition as part of creating a backup snapshot
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.
true, I can imagine it's to support when a user defines a cluster and a snapshot without depends_on between them
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! Thanks for addressing all the comments!
* feat: Supports `redact_client_log_data` in `mongodbatlas_advanced_cluster` (#2600) * use SDK Preview * add redact_client_log_data to schema * plural ds * resource * tests * changelog * feat: Supports `redact_client_log_data` in `mongodbatlas_cluster` (#2601) * doc * changelog * new atlas functions * data sources * resource * tests * rename CRUD functions * wait for cluster changes * apply feedback for changelog * use acc.CheckRSAndDS * fix ret * additional comment in cluster * Revert "additional comment in cluster" This reverts commit ce69fa1. * additional comment in cluster * refactor StateChangeConf * remove ResourceClusterRefreshFunc * attribute not necessary * fix update in cluster * fix plural ds tests
Description
Supports
redact_client_log_data
inmongodbatlas_cluster
.Link to any related issue(s): CLOUDP-273790
Type of change:
Required Checklist:
Further comments