diff --git a/lib/manager/terraform/lockfile/hash.ts b/lib/manager/terraform/lockfile/hash.ts index 7bb24a491cd2842d348710a17ca0695e65676ea9..71e410116328586e1e10cd4ce89986bf4b9800ba 100644 --- a/lib/manager/terraform/lockfile/hash.ts +++ b/lib/manager/terraform/lockfile/hash.ts @@ -10,8 +10,9 @@ import type { import { logger } from '../../../logger'; import * as packageCache from '../../../util/cache/package'; import * as fs from '../../../util/fs'; +import { ensureCacheDir } from '../../../util/fs'; import { Http } from '../../../util/http'; -import { getCacheDir, repositoryRegex } from './util'; +import { repositoryRegex } from './util'; const http = new Http(TerraformProviderDatasource.id); const hashCacheTTL = 10080; // in seconds == 1 week @@ -75,7 +76,7 @@ async function getReleaseBackendIndex( export async function calculateHashes( builds: TerraformBuild[] ): Promise<string[]> { - const cacheDir = await getCacheDir(); + const cacheDir = await ensureCacheDir('./others/terraform'); // for each build download ZIP, extract content and generate hash for all containing files const hashes = await pMap( diff --git a/lib/manager/terraform/lockfile/util.ts b/lib/manager/terraform/lockfile/util.ts index ae2bfcbcbdeb7d7aeba7c7b3f23133674f12af08..4cb5443998e9d733945fd307b0b28ed6e76198e7 100644 --- a/lib/manager/terraform/lockfile/util.ts +++ b/lib/manager/terraform/lockfile/util.ts @@ -1,7 +1,4 @@ -import { join } from 'upath'; -import { getAdminConfig } from '../../../config/admin'; -import { logger } from '../../../logger'; -import { ensureDir, getSiblingFileName, readLocalFile } from '../../../util/fs'; +import { getSiblingFileName, readLocalFile } from '../../../util/fs'; import { get as getVersioning } from '../../../versioning'; import type { UpdateArtifactsResult } from '../../types'; import type { @@ -210,10 +207,3 @@ export function writeLockUpdates( }, }; } - -export async function getCacheDir(): Promise<string> { - const cacheDir = join(getAdminConfig().cacheDir, './others/terraform'); - await ensureDir(cacheDir); - logger.debug(`Using terraform cache: ${cacheDir}`); - return cacheDir; -}