diff --git a/lib/manager/terraform/lockfile/hash.spec.ts b/lib/manager/terraform/lockfile/hash.spec.ts
index 875ee609f8db891e2356d4bcd94b90168e3477cf..8c17ee4c2083fc263c182030d71e96ae4bd5d8d9 100644
--- a/lib/manager/terraform/lockfile/hash.spec.ts
+++ b/lib/manager/terraform/lockfile/hash.spec.ts
@@ -1,4 +1,5 @@
 import { createReadStream } from 'fs';
+import { join } from 'upath';
 import * as httpMock from '../../../../test/http-mock';
 import { getFixturePath, getName, loadFixture } from '../../../../test/util';
 import { TerraformProviderDatasource } from '../../../datasource/terraform-provider';
@@ -7,14 +8,11 @@ import createHashes from './hash';
 const terraformProviderDatasource = new TerraformProviderDatasource();
 const releaseBackendUrl = terraformProviderDatasource.defaultRegistryUrls[1];
 const releaseBackendAzurerm = loadFixture('releaseBackendAzurerm_2_56_0.json');
+const cacheDir = join('/tmp/renovate/cache');
 
 describe(getName(), () => {
   it('returns null if a non hashicorp release is found ', async () => {
-    const result = await createHashes(
-      'test/gitlab',
-      '2.56.0',
-      '/tmp/renovate/cache'
-    );
+    const result = await createHashes('test/gitlab', '2.56.0', cacheDir);
     expect(result).toBeNull();
   });
 
@@ -24,11 +22,7 @@ describe(getName(), () => {
       .get('/terraform-provider-azurerm/2.59.0/index.json')
       .reply(403, '');
 
-    const result = await createHashes(
-      'hashicorp/azurerm',
-      '2.59.0',
-      '/tmp/renovate/cache'
-    );
+    const result = await createHashes('hashicorp/azurerm', '2.59.0', cacheDir);
     expect(result).toBeNull();
     expect(httpMock.getTrace()).toMatchSnapshot();
   });
@@ -39,7 +33,7 @@ describe(getName(), () => {
       .get('/terraform-provider-azurerm/2.56.0/index.json')
       .replyWithError('');
 
-    const result = await createHashes('hashicorp/azurerm', '2.56.0', '/tmp');
+    const result = await createHashes('hashicorp/azurerm', '2.56.0', cacheDir);
     expect(result).toBeNull();
     expect(httpMock.getTrace()).toMatchSnapshot();
   });
@@ -64,7 +58,7 @@ describe(getName(), () => {
       )
       .reply(200, readStreamDarwin);
 
-    const result = await createHashes('hashicorp/azurerm', '2.56.0', '/tmp');
+    const result = await createHashes('hashicorp/azurerm', '2.56.0', cacheDir);
     expect(result).toBeNull();
     expect(httpMock.getTrace()).toMatchSnapshot();
   });
@@ -89,7 +83,7 @@ describe(getName(), () => {
       )
       .reply(200, readStreamDarwin);
 
-    const result = await createHashes('hashicorp/azurerm', '2.56.0', '/tmp');
+    const result = await createHashes('hashicorp/azurerm', '2.56.0', cacheDir);
     expect(result).not.toBeNull();
     expect(result).toBeArrayOfSize(2);
     expect(result).toMatchSnapshot();
diff --git a/lib/manager/terraform/lockfile/hash.ts b/lib/manager/terraform/lockfile/hash.ts
index 4d101a47176e6815a7cd6fcb13e82256438547df..f659a60fee02d95c87a3c3badb8794db32b5d328 100644
--- a/lib/manager/terraform/lockfile/hash.ts
+++ b/lib/manager/terraform/lockfile/hash.ts
@@ -1,6 +1,7 @@
 import crypto from 'crypto';
 import extract from 'extract-zip';
 import pMap from 'p-map';
+import { join } from 'upath';
 import { TerraformProviderDatasource } from '../../../datasource/terraform-provider';
 import type {
   TerraformBuild,
@@ -80,8 +81,8 @@ export async function calculateHashes(
   const hashes = await pMap(
     builds,
     async (build) => {
-      const downloadFileName = `${cacheDir}/${build.filename}`;
-      const extractPath = `${cacheDir}/extract/${build.filename}`;
+      const downloadFileName = join(cacheDir, build.filename);
+      const extractPath = join(cacheDir, 'extract', build.filename);
       logger.trace(
         `Downloading archive and generating hash for ${build.name}-${build.version}...`
       );