> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-solutions-factory/use-hsf/configurations/migrating-from-time-sleep.md).

# Migrate from time\_sleep to harness\_time\_sleep

Replace the deprecated hashicorp time\_sleep resource in HSF templates with harness\_time\_sleep.

Move Harness Solutions Factory (HSF) templates off the deprecated `hashicorp.time_sleep` resource and onto [`harness_time_sleep`](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/time_sleep) from the Harness provider. `time_sleep` is marked **deprecated** in the HSF Primer.

All current HSF templates already use `harness_time_sleep`. Use this page when a template you maintain still declares `time_sleep`.

***

## What you will learn from this topic

* **Provider version:** Which Harness provider version `harness_time_sleep` requires, and how to declare it.
* **Resource type:** How to change `time_sleep` to `harness_time_sleep` without renaming the resource label.
* **Dependency references:** Which `depends_on` entries must change, and which resource addresses stay as they are.
* **Apply behavior:** Why Terraform destroys the old wait resource and creates the new one.

***

## Before you begin

Confirm the following before you edit a template:

* **Harness provider later than 0.45:** `harness_time_sleep` is not in provider versions 0.45 and earlier. Go to the [Harness provider on the Terraform Registry](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/time_sleep) to confirm the resource schema.
* **Template source access:** You can edit the Terraform files for the template that still references `time_sleep`.
* **Workspace apply access:** You can run plan and apply in the workspace that manages that template. Go to [RBAC in Harness](https://developer.harness.io/docs/platform/role-based-access-control/rbac-in-harness) to confirm your role includes that access.

{% hint style="warning" %}
**Deprecated resource**

Do not add new `time_sleep` resources. HSF templates that still declare `hashicorp/time` only for this wait should drop that provider as part of the migration below.
{% endhint %}

***

## Update the template

Work through the template in this order. Change the provider constraint first so the new resource type resolves, then update addresses, then apply.

{% stepper %}
{% step %}

### Set the provider version

Set the Harness provider constraint to a version later than 0.45. Remove the `hashicorp/time` provider when `time_sleep` is the only resource that used it.

```hcl
terraform {
  required_providers {
    harness = {
      source  = "harness/harness"
      version = "> 0.45"
    }
  }
}
```

{% endstep %}

{% step %}

### Update the resource type

Change the resource type from `time_sleep` to `harness_time_sleep`. Keep the resource label, for example `step_groups_v1`. Only the type changes.

```hcl
# Timer Manager for Dependency Controls
resource "harness_time_sleep" "step_groups_v1" {
  depends_on = [
    harness_platform_template.stg_code_smells_and_linting_v1,
    harness_platform_template.stg_build_and_scan_container_image_v1,
  ]
  destroy_duration = "15s"
}
```

{% endstep %}

{% step %}

### Update `depends_on` references

Point every `depends_on` entry that names `time_sleep.*` at the matching `harness_time_sleep.*` address. Leave other resource types, including `harness_platform_template.*`, unchanged.

```hcl
resource "harness_time_sleep" "step_groups" {
  depends_on = [
    harness_time_sleep.step_groups_v1
  ]
  destroy_duration = "15s"
}
```

{% endstep %}

{% step %}

### Apply the change

Run apply in the workspace that owns the template. Terraform treats `time_sleep` and `harness_time_sleep` as different resource types, so it destroys the old `time_sleep` resource and creates the `harness_time_sleep` resource with the same label.
{% endstep %}
{% endstepper %}

***

## Troubleshooting

### Provider does not support `harness_time_sleep`

Terraform reports that `harness_time_sleep` is not a valid resource type when the installed Harness provider is 0.45 or earlier. Set `version = "> 0.45"` in `required_providers`, then run `terraform init -upgrade` (or the OpenTofu equivalent) in that workspace and apply again.

### Plan still refers to `time_sleep`

A remaining `time_sleep.*` address in `depends_on`, or a resource block you did not rename, makes the plan fail because that address no longer exists. Search the template for `time_sleep` and update only those addresses to `harness_time_sleep`. Do not change `harness_platform_template.*` or other unrelated types.

### Apply destroys the existing wait resource

That destroy is expected. The two resource types do not share state, so Terraform removes `time_sleep` and creates `harness_time_sleep` in its place. Confirm the new resource uses the same label and the same `destroy_duration` before you approve the apply.

***

## Next steps

The template now waits with `harness_time_sleep` from the Harness provider.

* [Developer environment setup](/harness-solutions-factory/use-hsf/configurations/developer-env-setup.md): Prepare a local environment before you edit more templates.
* [Local testing using Make](/harness-solutions-factory/use-hsf/configurations/local-testing-using-make.md): Run the template tests after the resource type change.
* [`harness_time_sleep` resource](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/time_sleep): Review the provider arguments for the new resource.

{% @harness-feedback/feedback %}
