From 87abbebc1dadef142155b4ee04ffc40e1c44f5ae Mon Sep 17 00:00:00 2001 From: Sebastian Poxhofer Date: Sun, 5 Dec 2021 19:52:04 +0100 Subject: [PATCH] fix(terraform): check for missing version provider blocks (#12962) --- lib/manager/terraform/__snapshots__/extract.spec.ts.snap | 1 + lib/manager/terraform/extract.spec.ts | 2 +- lib/manager/terraform/providers.ts | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/manager/terraform/__snapshots__/extract.spec.ts.snap b/lib/manager/terraform/__snapshots__/extract.spec.ts.snap index c52332ad0d..af0195c598 100644 --- a/lib/manager/terraform/__snapshots__/extract.spec.ts.snap +++ b/lib/manager/terraform/__snapshots__/extract.spec.ts.snap @@ -212,6 +212,7 @@ Object { "depType": "provider", "lockedVersion": undefined, "lookupName": "hashicorp/helm", + "skipReason": "no-version", }, Object { "currentValue": "V1.9", diff --git a/lib/manager/terraform/extract.spec.ts b/lib/manager/terraform/extract.spec.ts index 1d4afed611..745489c41a 100644 --- a/lib/manager/terraform/extract.spec.ts +++ b/lib/manager/terraform/extract.spec.ts @@ -36,7 +36,7 @@ describe('manager/terraform/extract', () => { const res = await extractPackageFile(tf1, '1.tf', {}); expect(res).toMatchSnapshot(); expect(res.deps).toHaveLength(51); - expect(res.deps.filter((dep) => dep.skipReason)).toHaveLength(8); + expect(res.deps.filter((dep) => dep.skipReason)).toHaveLength(9); }); it('returns null if only local deps', async () => { diff --git a/lib/manager/terraform/providers.ts b/lib/manager/terraform/providers.ts index f82e1a05fa..e742b8837c 100644 --- a/lib/manager/terraform/providers.ts +++ b/lib/manager/terraform/providers.ts @@ -99,4 +99,8 @@ export function analyzeTerraformProvider( massageProviderLookupName(dep); dep.lockedVersion = getLockedVersion(dep, locks); + + if (!dep.currentValue) { + dep.skipReason = SkipReason.NoVersion; + } }