diff --git a/lib/manager/terraform/__fixtures__/1.tf b/lib/manager/terraform/__fixtures__/1.tf index 0b7561aace6ffccc6990f254ce4b6aacfa3d302c..793474273fa3b132077de7b1652ee96a97dddcb0 100644 --- a/lib/manager/terraform/__fixtures__/1.tf +++ b/lib/manager/terraform/__fixtures__/1.tf @@ -149,5 +149,13 @@ module "gittags_badversion" { } module "gittags_subdir" { - source = "git::https://bitbucket.com/hashicorp/example//subdir/test?ref=v1.0.0" + source = "git::https://bitbucket.com/hashicorp/example//subdir/test?ref=v1.0.1" +} + +module "gittags_http" { + source = "git::http://bitbucket.com/hashicorp/example?ref=v1.0.2" +} + +module "gittags_ssh" { + source = "git::ssh://git@bitbucket.com/hashicorp/example?ref=v1.0.3" } diff --git a/lib/manager/terraform/__snapshots__/extract.spec.ts.snap b/lib/manager/terraform/__snapshots__/extract.spec.ts.snap index 97a20c53e2686dbc772f5966303e8b91fd37d4ec..7fd0c2231ce5d8ceda95f15ff734825cfa81e740 100644 --- a/lib/manager/terraform/__snapshots__/extract.spec.ts.snap +++ b/lib/manager/terraform/__snapshots__/extract.spec.ts.snap @@ -169,13 +169,29 @@ Object { "skipReason": "unsupported-version", }, Object { - "currentValue": "v1.0.0", + "currentValue": "v1.0.1", "datasource": "git-tags", "depName": "bitbucket.com/hashicorp/example", "depNameShort": "hashicorp/example", "depType": "gitTags", "lookupName": "https://bitbucket.com/hashicorp/example", }, + Object { + "currentValue": "v1.0.2", + "datasource": "git-tags", + "depName": "bitbucket.com/hashicorp/example", + "depNameShort": "hashicorp/example", + "depType": "gitTags", + "lookupName": "http://bitbucket.com/hashicorp/example", + }, + Object { + "currentValue": "v1.0.3", + "datasource": "git-tags", + "depName": "bitbucket.com/hashicorp/example", + "depNameShort": "hashicorp/example", + "depType": "gitTags", + "lookupName": "ssh://git@bitbucket.com/hashicorp/example", + }, ], } `; diff --git a/lib/manager/terraform/extract.spec.ts b/lib/manager/terraform/extract.spec.ts index 6ffae997d85baeb30ffb21cbadbcab5a9cb5ad00..5e833e462e27cd65a722baf7485bba88ba2c249f 100644 --- a/lib/manager/terraform/extract.spec.ts +++ b/lib/manager/terraform/extract.spec.ts @@ -19,7 +19,7 @@ describe('lib/manager/terraform/extract', () => { it('extracts', () => { const res = extractPackageFile(tf1); expect(res).toMatchSnapshot(); - expect(res.deps).toHaveLength(25); + expect(res.deps).toHaveLength(27); expect(res.deps.filter((dep) => dep.skipReason)).toHaveLength(6); }); it('returns null if only local deps', () => { diff --git a/lib/manager/terraform/extract.ts b/lib/manager/terraform/extract.ts index 1fd99e81ff7ab1cdbac9f097960043c651506b27..1419501ef2957e82a714f3e48a954f4c3e0b104b 100644 --- a/lib/manager/terraform/extract.ts +++ b/lib/manager/terraform/extract.ts @@ -88,8 +88,7 @@ export function extractPackageFile(content: string): PackageFile | null { const githubRefMatch = /github.com(\/|:)([^/]+\/[a-z0-9-.]+).*\?ref=(.*)$/.exec( dep.managerData.source ); - // Regex would need to be updated to support ssh:// - const gitTagsRefMatch = /git::(http|https:\/\/(.*.*\/(.*\/.*)))(?:|\/\/.*)\?ref=(.*)$/.exec( + const gitTagsRefMatch = /git::((?:http|https|ssh):\/\/(?:.*@)?(.*.*\/(.*\/.*)))\?ref=(.*)$/.exec( dep.managerData.source ); /* eslint-disable no-param-reassign */