diff --git a/lib/modules/manager/terraform/extractors/others/modules.spec.ts b/lib/modules/manager/terraform/extractors/others/modules.spec.ts index 82be37043c1387..845e7b7c46e008 100644 --- a/lib/modules/manager/terraform/extractors/others/modules.spec.ts +++ b/lib/modules/manager/terraform/extractors/others/modules.spec.ts @@ -148,6 +148,9 @@ describe('modules/manager/terraform/extractors/others/modules', () => { const subfolderWithDoubleSlash = bitbucketRefMatchRegex.exec( 'bitbucket.org/hashicorp/example.git//terraform?ref=v1.0.0', )?.groups; + const subfolderWithGitInName = bitbucketRefMatchRegex.exec( + 'bitbucket.org/hashicorp/example.git//terraform-git?ref=v1.0.0', + )?.groups; const depth = bitbucketRefMatchRegex.exec( 'git::https://git@bitbucket.org/hashicorp/example.git?depth=1&ref=v1.0.0', )?.groups; @@ -180,6 +183,11 @@ describe('modules/manager/terraform/extractors/others/modules', () => { project: 'example', tag: 'v1.0.0', }); + expect(subfolderWithGitInName).toMatchObject({ + workspace: 'hashicorp', + project: 'example', + tag: 'v1.0.0', + }); expect(depth).toMatchObject({ workspace: 'hashicorp', project: 'example', diff --git a/lib/modules/manager/terraform/extractors/others/modules.ts b/lib/modules/manager/terraform/extractors/others/modules.ts index c6d129dcf5cf5e..5ba4f31c3ca122 100644 --- a/lib/modules/manager/terraform/extractors/others/modules.ts +++ b/lib/modules/manager/terraform/extractors/others/modules.ts @@ -13,7 +13,7 @@ export const githubRefMatchRegex = regEx( /github\.com([/:])(?[^/]+\/[a-z0-9-_.]+).*\?(depth=\d+&)?ref=(?.*?)(&depth=\d+)?$/i, ); export const bitbucketRefMatchRegex = regEx( - /(?:git::)?(?(?:http|https|ssh)?(?::\/\/)?(?:.*@)?(?bitbucket\.org\/(?.*)\/(?.*).git\/?(?.*)))\?(depth=\d+&)?ref=(?.*?)(&depth=\d+)?$/, + /(?:git::)?(?(?:http|https|ssh)?(?::\/\/)?(?:.*@)?(?bitbucket\.org\/(?.*)\/(?.*)\.git\/?(?.*)))\?(depth=\d+&)?ref=(?.*?)(&depth=\d+)?$/, ); export const gitTagsRefMatchRegex = regEx( /(?:git::)?(?(?:(?:http|https|ssh):\/\/)?(?:.*@)?(?.*\/(?.*\/.*)))\?(depth=\d+&)?ref=(?.*?)(&depth=\d+)?$/,