1. Packages
  2. Mongodbatlas Provider
  3. API Docs
  4. MaintenanceWindow
MongoDB Atlas v3.30.0 published on Friday, Mar 21, 2025 by Pulumi

mongodbatlas.MaintenanceWindow

Explore with Pulumi AI

# Resource: mongodbatlas.MaintenanceWindow

mongodbatlas.MaintenanceWindow provides a resource to schedule the maintenance window for your MongoDB Atlas Project and/or set to defer a scheduled maintenance up to two times. Please refer to Maintenance Windows documentation for more details.

NOTE: Only a single maintenance window resource can be defined per project.

NOTE: Groups and projects are synonymous terms. You may find groupId in the official documentation.

Maintenance Window Considerations:

  • Urgent Maintenance Activities Cannot Wait: Urgent maintenance activities such as security patches cannot wait for your chosen window. Atlas will start those maintenance activities when needed.

Once maintenance is scheduled for your cluster, you cannot change your maintenance window until the current maintenance efforts have completed.

  • Maintenance Requires Replica Set Elections: Atlas performs maintenance the same way as the manual maintenance procedure. This requires at least one replica set election during the maintenance window per replica set.
  • Maintenance Starts As Close to the Hour As Possible: Maintenance always begins as close to the scheduled hour as possible, but in-progress cluster updates or expected system issues could delay the start time.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";

const test = new mongodbatlas.MaintenanceWindow("test", {
    projectId: "<your-project-id>",
    dayOfWeek: 3,
    hourOfDay: 4,
});
Copy
import pulumi
import pulumi_mongodbatlas as mongodbatlas

test = mongodbatlas.MaintenanceWindow("test",
    project_id="<your-project-id>",
    day_of_week=3,
    hour_of_day=4)
Copy
package main

import (
	"github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := mongodbatlas.NewMaintenanceWindow(ctx, "test", &mongodbatlas.MaintenanceWindowArgs{
			ProjectId: pulumi.String("<your-project-id>"),
			DayOfWeek: pulumi.Int(3),
			HourOfDay: pulumi.Int(4),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

return await Deployment.RunAsync(() => 
{
    var test = new Mongodbatlas.MaintenanceWindow("test", new()
    {
        ProjectId = "<your-project-id>",
        DayOfWeek = 3,
        HourOfDay = 4,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mongodbatlas.MaintenanceWindow;
import com.pulumi.mongodbatlas.MaintenanceWindowArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var test = new MaintenanceWindow("test", MaintenanceWindowArgs.builder()
            .projectId("<your-project-id>")
            .dayOfWeek(3)
            .hourOfDay(4)
            .build());

    }
}
Copy
resources:
  test:
    type: mongodbatlas:MaintenanceWindow
    properties:
      projectId: <your-project-id>
      dayOfWeek: 3
      hourOfDay: 4
Copy
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";

const test = new mongodbatlas.MaintenanceWindow("test", {
    projectId: "<your-project-id>",
    defer: true,
});
Copy
import pulumi
import pulumi_mongodbatlas as mongodbatlas

test = mongodbatlas.MaintenanceWindow("test",
    project_id="<your-project-id>",
    defer=True)
Copy
package main

import (
	"github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := mongodbatlas.NewMaintenanceWindow(ctx, "test", &mongodbatlas.MaintenanceWindowArgs{
			ProjectId: pulumi.String("<your-project-id>"),
			Defer:     pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

return await Deployment.RunAsync(() => 
{
    var test = new Mongodbatlas.MaintenanceWindow("test", new()
    {
        ProjectId = "<your-project-id>",
        Defer = true,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mongodbatlas.MaintenanceWindow;
import com.pulumi.mongodbatlas.MaintenanceWindowArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var test = new MaintenanceWindow("test", MaintenanceWindowArgs.builder()
            .projectId("<your-project-id>")
            .defer(true)
            .build());

    }
}
Copy
resources:
  test:
    type: mongodbatlas:MaintenanceWindow
    properties:
      projectId: <your-project-id>
      defer: true
Copy

Create MaintenanceWindow Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new MaintenanceWindow(name: string, args: MaintenanceWindowArgs, opts?: CustomResourceOptions);
@overload
def MaintenanceWindow(resource_name: str,
                      args: MaintenanceWindowArgs,
                      opts: Optional[ResourceOptions] = None)

@overload
def MaintenanceWindow(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      day_of_week: Optional[int] = None,
                      project_id: Optional[str] = None,
                      auto_defer: Optional[bool] = None,
                      auto_defer_once_enabled: Optional[bool] = None,
                      defer: Optional[bool] = None,
                      hour_of_day: Optional[int] = None,
                      start_asap: Optional[bool] = None)
func NewMaintenanceWindow(ctx *Context, name string, args MaintenanceWindowArgs, opts ...ResourceOption) (*MaintenanceWindow, error)
public MaintenanceWindow(string name, MaintenanceWindowArgs args, CustomResourceOptions? opts = null)
public MaintenanceWindow(String name, MaintenanceWindowArgs args)
public MaintenanceWindow(String name, MaintenanceWindowArgs args, CustomResourceOptions options)
type: mongodbatlas:MaintenanceWindow
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. MaintenanceWindowArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. MaintenanceWindowArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. MaintenanceWindowArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. MaintenanceWindowArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. MaintenanceWindowArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var maintenanceWindowResource = new Mongodbatlas.MaintenanceWindow("maintenanceWindowResource", new()
{
    DayOfWeek = 0,
    ProjectId = "string",
    AutoDefer = false,
    AutoDeferOnceEnabled = false,
    Defer = false,
    HourOfDay = 0,
    StartAsap = false,
});
Copy
example, err := mongodbatlas.NewMaintenanceWindow(ctx, "maintenanceWindowResource", &mongodbatlas.MaintenanceWindowArgs{
	DayOfWeek:            pulumi.Int(0),
	ProjectId:            pulumi.String("string"),
	AutoDefer:            pulumi.Bool(false),
	AutoDeferOnceEnabled: pulumi.Bool(false),
	Defer:                pulumi.Bool(false),
	HourOfDay:            pulumi.Int(0),
	StartAsap:            pulumi.Bool(false),
})
Copy
var maintenanceWindowResource = new MaintenanceWindow("maintenanceWindowResource", MaintenanceWindowArgs.builder()
    .dayOfWeek(0)
    .projectId("string")
    .autoDefer(false)
    .autoDeferOnceEnabled(false)
    .defer(false)
    .hourOfDay(0)
    .startAsap(false)
    .build());
Copy
maintenance_window_resource = mongodbatlas.MaintenanceWindow("maintenanceWindowResource",
    day_of_week=0,
    project_id="string",
    auto_defer=False,
    auto_defer_once_enabled=False,
    defer=False,
    hour_of_day=0,
    start_asap=False)
Copy
const maintenanceWindowResource = new mongodbatlas.MaintenanceWindow("maintenanceWindowResource", {
    dayOfWeek: 0,
    projectId: "string",
    autoDefer: false,
    autoDeferOnceEnabled: false,
    defer: false,
    hourOfDay: 0,
    startAsap: false,
});
Copy
type: mongodbatlas:MaintenanceWindow
properties:
    autoDefer: false
    autoDeferOnceEnabled: false
    dayOfWeek: 0
    defer: false
    hourOfDay: 0
    projectId: string
    startAsap: false
Copy

MaintenanceWindow Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The MaintenanceWindow resource accepts the following input properties:

DayOfWeek This property is required. int
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
ProjectId This property is required. string
The unique identifier of the project for the Maintenance Window.
AutoDefer bool
Defer any scheduled maintenance for the given project for one week.
AutoDeferOnceEnabled bool
Defer bool
Defer the next scheduled maintenance for the given project for one week.
HourOfDay int
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
StartAsap bool
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.
DayOfWeek This property is required. int
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
ProjectId This property is required. string
The unique identifier of the project for the Maintenance Window.
AutoDefer bool
Defer any scheduled maintenance for the given project for one week.
AutoDeferOnceEnabled bool
Defer bool
Defer the next scheduled maintenance for the given project for one week.
HourOfDay int
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
StartAsap bool
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.
dayOfWeek This property is required. Integer
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
projectId This property is required. String
The unique identifier of the project for the Maintenance Window.
autoDefer Boolean
Defer any scheduled maintenance for the given project for one week.
autoDeferOnceEnabled Boolean
defer Boolean
Defer the next scheduled maintenance for the given project for one week.
hourOfDay Integer
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
startAsap Boolean
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.
dayOfWeek This property is required. number
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
projectId This property is required. string
The unique identifier of the project for the Maintenance Window.
autoDefer boolean
Defer any scheduled maintenance for the given project for one week.
autoDeferOnceEnabled boolean
defer boolean
Defer the next scheduled maintenance for the given project for one week.
hourOfDay number
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
startAsap boolean
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.
day_of_week This property is required. int
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
project_id This property is required. str
The unique identifier of the project for the Maintenance Window.
auto_defer bool
Defer any scheduled maintenance for the given project for one week.
auto_defer_once_enabled bool
defer bool
Defer the next scheduled maintenance for the given project for one week.
hour_of_day int
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
start_asap bool
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.
dayOfWeek This property is required. Number
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
projectId This property is required. String
The unique identifier of the project for the Maintenance Window.
autoDefer Boolean
Defer any scheduled maintenance for the given project for one week.
autoDeferOnceEnabled Boolean
defer Boolean
Defer the next scheduled maintenance for the given project for one week.
hourOfDay Number
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
startAsap Boolean
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.

Outputs

All input properties are implicitly available as output properties. Additionally, the MaintenanceWindow resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
NumberOfDeferrals int
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.
Id string
The provider-assigned unique ID for this managed resource.
NumberOfDeferrals int
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.
id String
The provider-assigned unique ID for this managed resource.
numberOfDeferrals Integer
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.
id string
The provider-assigned unique ID for this managed resource.
numberOfDeferrals number
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.
id str
The provider-assigned unique ID for this managed resource.
number_of_deferrals int
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.
id String
The provider-assigned unique ID for this managed resource.
numberOfDeferrals Number
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.

Look up Existing MaintenanceWindow Resource

Get an existing MaintenanceWindow resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: MaintenanceWindowState, opts?: CustomResourceOptions): MaintenanceWindow
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        auto_defer: Optional[bool] = None,
        auto_defer_once_enabled: Optional[bool] = None,
        day_of_week: Optional[int] = None,
        defer: Optional[bool] = None,
        hour_of_day: Optional[int] = None,
        number_of_deferrals: Optional[int] = None,
        project_id: Optional[str] = None,
        start_asap: Optional[bool] = None) -> MaintenanceWindow
func GetMaintenanceWindow(ctx *Context, name string, id IDInput, state *MaintenanceWindowState, opts ...ResourceOption) (*MaintenanceWindow, error)
public static MaintenanceWindow Get(string name, Input<string> id, MaintenanceWindowState? state, CustomResourceOptions? opts = null)
public static MaintenanceWindow get(String name, Output<String> id, MaintenanceWindowState state, CustomResourceOptions options)
resources:  _:    type: mongodbatlas:MaintenanceWindow    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AutoDefer bool
Defer any scheduled maintenance for the given project for one week.
AutoDeferOnceEnabled bool
DayOfWeek int
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
Defer bool
Defer the next scheduled maintenance for the given project for one week.
HourOfDay int
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
NumberOfDeferrals int
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.
ProjectId string
The unique identifier of the project for the Maintenance Window.
StartAsap bool
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.
AutoDefer bool
Defer any scheduled maintenance for the given project for one week.
AutoDeferOnceEnabled bool
DayOfWeek int
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
Defer bool
Defer the next scheduled maintenance for the given project for one week.
HourOfDay int
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
NumberOfDeferrals int
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.
ProjectId string
The unique identifier of the project for the Maintenance Window.
StartAsap bool
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.
autoDefer Boolean
Defer any scheduled maintenance for the given project for one week.
autoDeferOnceEnabled Boolean
dayOfWeek Integer
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
defer Boolean
Defer the next scheduled maintenance for the given project for one week.
hourOfDay Integer
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
numberOfDeferrals Integer
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.
projectId String
The unique identifier of the project for the Maintenance Window.
startAsap Boolean
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.
autoDefer boolean
Defer any scheduled maintenance for the given project for one week.
autoDeferOnceEnabled boolean
dayOfWeek number
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
defer boolean
Defer the next scheduled maintenance for the given project for one week.
hourOfDay number
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
numberOfDeferrals number
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.
projectId string
The unique identifier of the project for the Maintenance Window.
startAsap boolean
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.
auto_defer bool
Defer any scheduled maintenance for the given project for one week.
auto_defer_once_enabled bool
day_of_week int
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
defer bool
Defer the next scheduled maintenance for the given project for one week.
hour_of_day int
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
number_of_deferrals int
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.
project_id str
The unique identifier of the project for the Maintenance Window.
start_asap bool
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.
autoDefer Boolean
Defer any scheduled maintenance for the given project for one week.
autoDeferOnceEnabled Boolean
dayOfWeek Number
Day of the week when you would like the maintenance window to start as a 1-based integer: Su=1, M=2, T=3, W=4, T=5, F=6, Sa=7.
defer Boolean
Defer the next scheduled maintenance for the given project for one week.
hourOfDay Number
Hour of the day when you would like the maintenance window to start. This parameter uses the 24-hour clock, where midnight is 0, noon is 12 (Time zone is UTC). Defaults to 0.
numberOfDeferrals Number
Number of times the current maintenance event for this project has been deferred, there can be a maximum of 2 deferrals.
projectId String
The unique identifier of the project for the Maintenance Window.
startAsap Boolean
Flag indicating whether project maintenance has been directed to start immediately. If you request that maintenance begin immediately, this field returns true from the time the request was made until the time the maintenance event completes.

Import

Maintenance Window entries can be imported using project project_id, in the format PROJECTID, e.g.

$ pulumi import mongodbatlas:index/maintenanceWindow:MaintenanceWindow test 5d0f1f73cf09a29120e173cf
Copy

For more information see: MongoDB Atlas API Reference.

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
MongoDB Atlas pulumi/pulumi-mongodbatlas
License
Apache-2.0
Notes
This Pulumi package is based on the mongodbatlas Terraform Provider.