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_sleeprequires, and how to declare it.Resource type: How to change
time_sleeptoharness_time_sleepwithout renaming the resource label.Dependency references: Which
depends_onentries 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_sleepis 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.
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: Prepare a local environment before you edit more templates.
Local testing using Make: Run the template tests after the resource type change.
harness_time_sleepresource: Review the provider arguments for the new resource.
Last updated
Was this helpful?