1. Packages
  2. CockroachDB Cloud
  3. API Docs
  4. MaintenanceWindow
CockroachDB v0.9.4 published on Friday, Mar 21, 2025 by pulumiverse

cockroach.MaintenanceWindow

Explore with Pulumi AI

Maintenance window configuration for a cluster. Maintenance Windows are supported for Advanced clusters only.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as cockroach from "@pulumiverse/cockroach";

const config = new pulumi.Config();
const clusterId = config.require("clusterId");
const offsetDuration = config.getNumber("offsetDuration") || 172800;
const windowDuration = config.getNumber("windowDuration") || 21600;
const example = new cockroach.MaintenanceWindow("example", {
    clusterId: clusterId,
    offsetDuration: offsetDuration,
    windowDuration: windowDuration,
});
Copy
import pulumi
import pulumiverse_cockroach as cockroach

config = pulumi.Config()
cluster_id = config.require("clusterId")
offset_duration = config.get_float("offsetDuration")
if offset_duration is None:
    offset_duration = 172800
window_duration = config.get_float("windowDuration")
if window_duration is None:
    window_duration = 21600
example = cockroach.MaintenanceWindow("example",
    cluster_id=cluster_id,
    offset_duration=offset_duration,
    window_duration=window_duration)
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
	"github.com/pulumiverse/pulumi-cockroach/sdk/go/cockroach"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		clusterId := cfg.Require("clusterId")
		offsetDuration := float64(172800)
		if param := cfg.GetFloat64("offsetDuration"); param != 0 {
			offsetDuration = param
		}
		windowDuration := float64(21600)
		if param := cfg.GetFloat64("windowDuration"); param != 0 {
			windowDuration = param
		}
		_, err := cockroach.NewMaintenanceWindow(ctx, "example", &cockroach.MaintenanceWindowArgs{
			ClusterId:      pulumi.String(clusterId),
			OffsetDuration: pulumi.Float64(offsetDuration),
			WindowDuration: pulumi.Float64(windowDuration),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cockroach = Pulumiverse.Cockroach;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var clusterId = config.Require("clusterId");
    var offsetDuration = config.GetDouble("offsetDuration") ?? 172800;
    var windowDuration = config.GetDouble("windowDuration") ?? 21600;
    var example = new Cockroach.MaintenanceWindow("example", new()
    {
        ClusterId = clusterId,
        OffsetDuration = offsetDuration,
        WindowDuration = windowDuration,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cockroach.MaintenanceWindow;
import com.pulumi.cockroach.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) {
        final var config = ctx.config();
        final var clusterId = config.get("clusterId");
        final var offsetDuration = config.get("offsetDuration").orElse(172800);
        final var windowDuration = config.get("windowDuration").orElse(21600);
        var example = new MaintenanceWindow("example", MaintenanceWindowArgs.builder()
            .clusterId(clusterId)
            .offsetDuration(offsetDuration)
            .windowDuration(windowDuration)
            .build());

    }
}
Copy
configuration:
  clusterId:
    type: string
  offsetDuration:
    type: number
    default: 172800
  windowDuration:
    type: number
    default: 21600
resources:
  example:
    type: cockroach:MaintenanceWindow
    properties:
      clusterId: ${clusterId}
      offsetDuration: ${offsetDuration}
      windowDuration: ${windowDuration}
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,
                      cluster_id: Optional[str] = None,
                      offset_duration: Optional[int] = None,
                      window_duration: Optional[int] = 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: cockroach: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 Cockroach.MaintenanceWindow("maintenanceWindowResource", new()
{
    ClusterId = "string",
    OffsetDuration = 0,
    WindowDuration = 0,
});
Copy
example, err := cockroach.NewMaintenanceWindow(ctx, "maintenanceWindowResource", &cockroach.MaintenanceWindowArgs{
	ClusterId:      pulumi.String("string"),
	OffsetDuration: pulumi.Int(0),
	WindowDuration: pulumi.Int(0),
})
Copy
var maintenanceWindowResource = new MaintenanceWindow("maintenanceWindowResource", MaintenanceWindowArgs.builder()
    .clusterId("string")
    .offsetDuration(0)
    .windowDuration(0)
    .build());
Copy
maintenance_window_resource = cockroach.MaintenanceWindow("maintenanceWindowResource",
    cluster_id="string",
    offset_duration=0,
    window_duration=0)
Copy
const maintenanceWindowResource = new cockroach.MaintenanceWindow("maintenanceWindowResource", {
    clusterId: "string",
    offsetDuration: 0,
    windowDuration: 0,
});
Copy
type: cockroach:MaintenanceWindow
properties:
    clusterId: string
    offsetDuration: 0
    windowDuration: 0
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:

ClusterId This property is required. string
Cluster ID.
OffsetDuration This property is required. int
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
WindowDuration This property is required. int
Duration in seconds that the maintenance window will remain active for after it starts.
ClusterId This property is required. string
Cluster ID.
OffsetDuration This property is required. int
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
WindowDuration This property is required. int
Duration in seconds that the maintenance window will remain active for after it starts.
clusterId This property is required. String
Cluster ID.
offsetDuration This property is required. Integer
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
windowDuration This property is required. Integer
Duration in seconds that the maintenance window will remain active for after it starts.
clusterId This property is required. string
Cluster ID.
offsetDuration This property is required. number
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
windowDuration This property is required. number
Duration in seconds that the maintenance window will remain active for after it starts.
cluster_id This property is required. str
Cluster ID.
offset_duration This property is required. int
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
window_duration This property is required. int
Duration in seconds that the maintenance window will remain active for after it starts.
clusterId This property is required. String
Cluster ID.
offsetDuration This property is required. Number
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
windowDuration This property is required. Number
Duration in seconds that the maintenance window will remain active for after it starts.

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.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

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,
        cluster_id: Optional[str] = None,
        offset_duration: Optional[int] = None,
        window_duration: Optional[int] = 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: cockroach: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:
ClusterId string
Cluster ID.
OffsetDuration int
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
WindowDuration int
Duration in seconds that the maintenance window will remain active for after it starts.
ClusterId string
Cluster ID.
OffsetDuration int
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
WindowDuration int
Duration in seconds that the maintenance window will remain active for after it starts.
clusterId String
Cluster ID.
offsetDuration Integer
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
windowDuration Integer
Duration in seconds that the maintenance window will remain active for after it starts.
clusterId string
Cluster ID.
offsetDuration number
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
windowDuration number
Duration in seconds that the maintenance window will remain active for after it starts.
cluster_id str
Cluster ID.
offset_duration int
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
window_duration int
Duration in seconds that the maintenance window will remain active for after it starts.
clusterId String
Cluster ID.
offsetDuration Number
Duration in seconds from the beginning of each Monday (UTC) after which the maintenance window starts.
windowDuration Number
Duration in seconds that the maintenance window will remain active for after it starts.

Import

format:

$ pulumi import cockroach:index/maintenanceWindow:MaintenanceWindow example 1f69fdd2-600a-4cfc-a9ba-16995df0d77d
Copy

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

Package Details

Repository
cockroach pulumiverse/pulumi-cockroach
License
Apache-2.0
Notes
This Pulumi package is based on the cockroach Terraform Provider.