-
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
Adding autodefer parameter to automatically defer any maintenance #499
Conversation
Hi @vgarcia-te, thank you for the submission and for signing the CLA. We'll get this reviewed by the team. |
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.
Looking good, I have added a nit.
@@ -90,6 +96,13 @@ func resourceMongoDBAtlasMaintenanceWindowCreate(ctx context.Context, d *schema. | |||
} | |||
} | |||
|
|||
if autoDeferValue := d.Get("auto_defer").(bool); autoDeferValue { | |||
_, err := conn.MaintenanceWindows.AutoDefer(context.Background(), projectID) |
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.
[nit] conn.MaintenanceWindows.Defer(ctx, projectID)
-> I see that we are using ctx
as parameter for defer.
So just to be consistent, could you use ctx
as parameter to AutoDefer
instead of context.Background()
_, err := conn.MaintenanceWindows.AutoDefer(context.Background(), projectID) | |
_, err := conn.MaintenanceWindows.AutoDefer(ctx, projectID) |
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.
Good catch, wrong copy paste from a previous version i was working on. Fixed
@@ -166,6 +179,13 @@ func resourceMongoDBAtlasMaintenanceWindowUpdate(ctx context.Context, d *schema. | |||
} | |||
} | |||
|
|||
if d.HasChange("auto_defer") { | |||
_, err := conn.MaintenanceWindows.AutoDefer(context.Background(), d.Id()) |
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.
[nit] Same suggestion as previous one
_, err := conn.MaintenanceWindows.AutoDefer(context.Background(), d.Id()) | |
_, err := conn.MaintenanceWindows.AutoDefer(ctx, d.Id()) |
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, I'm not sure if we need tests for this change or not.
@coderGo93 wdyt? Please help me out here.
I didn't include tests given that there were no tests for the |
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 don't see major changes and the behavior it's similar to parameter defer
so LGTM
Yes @threebee , it would be nice to have tests but like @vgarcia-te said, it doesn't have a test for parameter defer
.
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.
Added internal ticket to update maintenance window data source in next release: INTMDB-230. Approving work that is here. Thank you @vgarcia-te !
@themantissa do you know when the next will happen approximately? I would like to know when we can use this auto_defer parameter in our Terraform infrastructure (without having to install the development version) |
@vgarcia-te We are working on the final major piece (cloud backup) so other than that just final testing. Within the next week or two is reasonable, baring any major issues surfacing. |
Description
This PR adds the parameter
autodefer
to automatically defer any maintenance for a given project as explained here https://docs.atlas.mongodb.com/reference/api/maintenance-window-auto-defer/Type of change:
Required Checklist:
Further comments