published on Friday, Sep 18, 2026 by Pulumi
published on Friday, Sep 18, 2026 by Pulumi
Resource that introduces a time delay during create and/or destroy lifecycle phases.
Useful as a synchronization barrier — resources that dependsOn this resource will wait until the sleep completes before proceeding. This avoids race conditions with eventually-consistent resources without resorting to local-exec provisioners.
Duration values use Go duration format: ms (milliseconds), s (seconds), m (minutes), h (hours). Examples: "30s", "5m", "1h", "500ms".
Example Usage
Create delay - pause 30s after delegate is created before pipeline runs
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";
const mydelegate = new harness.index.PlatformDelegateToken("mydelegate", {
name: "my-delegate",
accountId: "YOUR_ACCOUNT_ID",
});
const waitForDelegate = new harness.TimeSleep("wait_for_delegate", {createDuration: "30s"}, {
dependsOn: [mydelegate],
});
import pulumi
import pulumi_harness as harness
mydelegate = harness.PlatformDelegateToken("mydelegate",
name=my-delegate,
account_id=YOUR_ACCOUNT_ID)
wait_for_delegate = harness.TimeSleep("wait_for_delegate", create_duration="30s",
opts = pulumi.ResourceOptions(depends_on=[mydelegate]))
package main
import (
"github.com/pulumi/pulumi-harness/sdk/go/harness"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
mydelegate, err := harness.NewPlatformDelegateToken(ctx, "mydelegate", &harness.PlatformDelegateTokenArgs{
Name: "my-delegate",
AccountId: "YOUR_ACCOUNT_ID",
})
if err != nil {
return err
}
_, err = harness.NewTimeSleep(ctx, "wait_for_delegate", &harness.TimeSleepArgs{
CreateDuration: pulumi.String("30s"),
}, pulumi.DependsOn([]pulumi.Resource{
mydelegate,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;
return await Deployment.RunAsync(() =>
{
var mydelegate = new Harness.PlatformDelegateToken("mydelegate", new()
{
Name = "my-delegate",
AccountId = "YOUR_ACCOUNT_ID",
});
var waitForDelegate = new Harness.TimeSleep("wait_for_delegate", new()
{
CreateDuration = "30s",
}, new CustomResourceOptions
{
DependsOn =
{
mydelegate,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.PlatformDelegateToken;
import com.pulumi.harness.PlatformDelegateTokenArgs;
import com.pulumi.harness.TimeSleep;
import com.pulumi.harness.TimeSleepArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
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 mydelegate = new PlatformDelegateToken("mydelegate", PlatformDelegateTokenArgs.builder()
.name("my-delegate")
.accountId("YOUR_ACCOUNT_ID")
.build());
var waitForDelegate = new TimeSleep("waitForDelegate", TimeSleepArgs.builder()
.createDuration("30s")
.build(), CustomResourceOptions.builder()
.dependsOn(mydelegate)
.build());
}
}
resources:
mydelegate:
type: harness:PlatformDelegateToken
properties:
name: my-delegate
accountId: YOUR_ACCOUNT_ID
waitForDelegate:
type: harness:TimeSleep
name: wait_for_delegate
properties:
createDuration: 30s
options:
dependsOn:
- ${mydelegate}
pulumi {
required_providers {
harness = {
source = "pulumi/harness"
}
}
}
resource "harness_platformdelegatetoken" "mydelegate" {
name = "my-delegate"
account_id = "YOUR_ACCOUNT_ID"
}
resource "harness_timesleep" "wait_for_delegate" {
depends_on = [harness_platformdelegatetoken.mydelegate]
create_duration = "30s"
}
Wait after destroying a delegate before tearing down dependents
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";
const mydelegate = new harness.index.PlatformDelegateToken("mydelegate", {
name: "my-delegate",
accountId: "YOUR_ACCOUNT_ID",
});
const drainDelegate = new harness.TimeSleep("drain_delegate", {destroyDuration: "10s"}, {
dependsOn: [mydelegate],
});
import pulumi
import pulumi_harness as harness
mydelegate = harness.PlatformDelegateToken("mydelegate",
name=my-delegate,
account_id=YOUR_ACCOUNT_ID)
drain_delegate = harness.TimeSleep("drain_delegate", destroy_duration="10s",
opts = pulumi.ResourceOptions(depends_on=[mydelegate]))
package main
import (
"github.com/pulumi/pulumi-harness/sdk/go/harness"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
mydelegate, err := harness.NewPlatformDelegateToken(ctx, "mydelegate", &harness.PlatformDelegateTokenArgs{
Name: "my-delegate",
AccountId: "YOUR_ACCOUNT_ID",
})
if err != nil {
return err
}
_, err = harness.NewTimeSleep(ctx, "drain_delegate", &harness.TimeSleepArgs{
DestroyDuration: pulumi.String("10s"),
}, pulumi.DependsOn([]pulumi.Resource{
mydelegate,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;
return await Deployment.RunAsync(() =>
{
var mydelegate = new Harness.PlatformDelegateToken("mydelegate", new()
{
Name = "my-delegate",
AccountId = "YOUR_ACCOUNT_ID",
});
var drainDelegate = new Harness.TimeSleep("drain_delegate", new()
{
DestroyDuration = "10s",
}, new CustomResourceOptions
{
DependsOn =
{
mydelegate,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.PlatformDelegateToken;
import com.pulumi.harness.PlatformDelegateTokenArgs;
import com.pulumi.harness.TimeSleep;
import com.pulumi.harness.TimeSleepArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
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 mydelegate = new PlatformDelegateToken("mydelegate", PlatformDelegateTokenArgs.builder()
.name("my-delegate")
.accountId("YOUR_ACCOUNT_ID")
.build());
var drainDelegate = new TimeSleep("drainDelegate", TimeSleepArgs.builder()
.destroyDuration("10s")
.build(), CustomResourceOptions.builder()
.dependsOn(mydelegate)
.build());
}
}
resources:
mydelegate:
type: harness:PlatformDelegateToken
properties:
name: my-delegate
accountId: YOUR_ACCOUNT_ID
drainDelegate:
type: harness:TimeSleep
name: drain_delegate
properties:
destroyDuration: 10s
options:
dependsOn:
- ${mydelegate}
pulumi {
required_providers {
harness = {
source = "pulumi/harness"
}
}
}
resource "harness_platformdelegatetoken" "mydelegate" {
name = "my-delegate"
account_id = "YOUR_ACCOUNT_ID"
}
resource "harness_timesleep" "drain_delegate" {
depends_on = [harness_platformdelegatetoken.mydelegate]
destroy_duration = "10s"
}
Both create and destroy delays
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";
const wait = new harness.TimeSleep("wait", {
createDuration: "30s",
destroyDuration: "10s",
});
import pulumi
import pulumi_harness as harness
wait = harness.TimeSleep("wait",
create_duration="30s",
destroy_duration="10s")
package main
import (
"github.com/pulumi/pulumi-harness/sdk/go/harness"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := harness.NewTimeSleep(ctx, "wait", &harness.TimeSleepArgs{
CreateDuration: pulumi.String("30s"),
DestroyDuration: pulumi.String("10s"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;
return await Deployment.RunAsync(() =>
{
var wait = new Harness.TimeSleep("wait", new()
{
CreateDuration = "30s",
DestroyDuration = "10s",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.TimeSleep;
import com.pulumi.harness.TimeSleepArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 wait = new TimeSleep("wait", TimeSleepArgs.builder()
.createDuration("30s")
.destroyDuration("10s")
.build());
}
}
resources:
wait:
type: harness:TimeSleep
properties:
createDuration: 30s
destroyDuration: 10s
pulumi {
required_providers {
harness = {
source = "pulumi/harness"
}
}
}
resource "harness_timesleep" "wait" {
create_duration = "30s"
destroy_duration = "10s"
}
Create TimeSleep Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new TimeSleep(name: string, args?: TimeSleepArgs, opts?: CustomResourceOptions);@overload
def TimeSleep(resource_name: str,
args: Optional[TimeSleepArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def TimeSleep(resource_name: str,
opts: Optional[ResourceOptions] = None,
create_duration: Optional[str] = None,
destroy_duration: Optional[str] = None,
triggers: Optional[Mapping[str, str]] = None)func NewTimeSleep(ctx *Context, name string, args *TimeSleepArgs, opts ...ResourceOption) (*TimeSleep, error)public TimeSleep(string name, TimeSleepArgs? args = null, CustomResourceOptions? opts = null)
public TimeSleep(String name, TimeSleepArgs args)
public TimeSleep(String name, TimeSleepArgs args, CustomResourceOptions options)
type: harness:TimeSleep
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "harness_time_sleep" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args TimeSleepArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args TimeSleepArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args TimeSleepArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TimeSleepArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args TimeSleepArgs
- 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 timeSleepResource = new Harness.TimeSleep("timeSleepResource", new()
{
CreateDuration = "string",
DestroyDuration = "string",
Triggers =
{
{ "string", "string" },
},
});
example, err := harness.NewTimeSleep(ctx, "timeSleepResource", &harness.TimeSleepArgs{
CreateDuration: pulumi.String("string"),
DestroyDuration: pulumi.String("string"),
Triggers: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
resource "harness_time_sleep" "timeSleepResource" {
lifecycle {
create_before_destroy = true
}
create_duration = "string"
destroy_duration = "string"
triggers = {
"string" = "string"
}
}
var timeSleepResource = new TimeSleep("timeSleepResource", TimeSleepArgs.builder()
.createDuration("string")
.destroyDuration("string")
.triggers(Map.of("string", "string"))
.build());
time_sleep_resource = harness.TimeSleep("timeSleepResource",
create_duration="string",
destroy_duration="string",
triggers={
"string": "string",
})
const timeSleepResource = new harness.TimeSleep("timeSleepResource", {
createDuration: "string",
destroyDuration: "string",
triggers: {
string: "string",
},
});
type: harness:TimeSleep
properties:
createDuration: string
destroyDuration: string
triggers:
string: string
TimeSleep 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 TimeSleep resource accepts the following input properties:
- Create
Duration string - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - Destroy
Duration string - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - Triggers Dictionary<string, string>
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- Create
Duration string - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - Destroy
Duration string - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - Triggers map[string]string
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- create_
duration string - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - destroy_
duration string - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - triggers map(string)
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- create
Duration String - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - destroy
Duration String - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - triggers Map<String,String>
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- create
Duration string - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - destroy
Duration string - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - triggers {[key: string]: string}
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- create_
duration str - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - destroy_
duration str - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - triggers Mapping[str, str]
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- create
Duration String - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - destroy
Duration String - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - triggers Map<String>
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
Outputs
All input properties are implicitly available as output properties. Additionally, the TimeSleep 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 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 TimeSleep Resource
Get an existing TimeSleep 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?: TimeSleepState, opts?: CustomResourceOptions): TimeSleep@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
create_duration: Optional[str] = None,
destroy_duration: Optional[str] = None,
triggers: Optional[Mapping[str, str]] = None) -> TimeSleepfunc GetTimeSleep(ctx *Context, name string, id IDInput, state *TimeSleepState, opts ...ResourceOption) (*TimeSleep, error)public static TimeSleep Get(string name, Input<string> id, TimeSleepState? state, CustomResourceOptions? opts = null)public static TimeSleep get(String name, Output<String> id, TimeSleepState state, CustomResourceOptions options)resources: _: type: harness:TimeSleep get: id: ${id}import {
to = harness_time_sleep.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Create
Duration string - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - Destroy
Duration string - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - Triggers Dictionary<string, string>
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- Create
Duration string - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - Destroy
Duration string - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - Triggers map[string]string
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- create_
duration string - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - destroy_
duration string - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - triggers map(string)
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- create
Duration String - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - destroy
Duration String - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - triggers Map<String,String>
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- create
Duration string - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - destroy
Duration string - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - triggers {[key: string]: string}
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- create_
duration str - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - destroy_
duration str - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - triggers Mapping[str, str]
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
- create
Duration String - Duration to sleep when the resource is created. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - destroy
Duration String - Duration to sleep when the resource is destroyed. Accepts Go duration strings:
ms,s,m,h. Example:"30s","5m". At least one ofcreateDurationordestroyDurationmust be set. - triggers Map<String>
- Arbitrary map of string values. Any change to this map forces replacement of the resource, re-triggering the create and destroy delays.
Package Details
- Repository
- harness pulumi/pulumi-harness
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
harnessTerraform Provider.
published on Friday, Sep 18, 2026 by Pulumi