Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
HsfTerraform

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 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 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 to confirm your role includes that access.


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.

1

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.

2

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.

3

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.

4

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.


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.

Last updated

Was this helpful?