From 3d5de6d053e4197fa19655860245723d3d2be8c7 Mon Sep 17 00:00:00 2001 From: Ismael Taboada Rodero Date: Tue, 16 Jan 2024 17:27:37 +0100 Subject: [PATCH] fix(manager/terragrunt): add missing registry host Added registry url to extraction result at Terragrunt Manager when source uses tfr protocol and contains custom registry hostname. Fixes: #26668 --- lib/modules/manager/terragrunt/__fixtures__/1.hcl | 5 +++++ lib/modules/manager/terragrunt/extract.spec.ts | 7 +++++++ lib/modules/manager/terragrunt/modules.ts | 3 +++ 3 files changed, 15 insertions(+) diff --git a/lib/modules/manager/terragrunt/__fixtures__/1.hcl b/lib/modules/manager/terragrunt/__fixtures__/1.hcl index 61164ff13f4e93..d4b9a99394dfc0 100644 --- a/lib/modules/manager/terragrunt/__fixtures__/1.hcl +++ b/lib/modules/manager/terragrunt/__fixtures__/1.hcl @@ -37,3 +37,8 @@ terraform { terraform { source = "tfr://terraform-aws-modules/vpc/aws?version=3.3.0" } + +#with domain +terraform { + source = "tfr://registry.domain.com/abc/helloworld/aws?version=1.0.0" +} diff --git a/lib/modules/manager/terragrunt/extract.spec.ts b/lib/modules/manager/terragrunt/extract.spec.ts index 7dfae48e2f8f59..bcba2edcbf9efc 100644 --- a/lib/modules/manager/terragrunt/extract.spec.ts +++ b/lib/modules/manager/terragrunt/extract.spec.ts @@ -30,6 +30,13 @@ describe('modules/manager/terragrunt/extract', () => { depType: 'terragrunt', }, {}, + { + currentValue: '1.0.0', + datasource: 'terraform-module', + depName: 'abc/helloworld/aws', + depType: 'terragrunt', + registryUrls: ['https://registry.domain.com'], + }, ], }); }); diff --git a/lib/modules/manager/terragrunt/modules.ts b/lib/modules/manager/terragrunt/modules.ts index 2e22f7d3c1bbc8..01fc5b43562569 100644 --- a/lib/modules/manager/terragrunt/modules.ts +++ b/lib/modules/manager/terragrunt/modules.ts @@ -72,6 +72,9 @@ export function analyseTerragruntModule( tfrVersionMatch.groups.cloud; dep.currentValue = tfrVersionMatch.groups.currentValue; dep.datasource = TerraformModuleDatasource.id; + if (tfrVersionMatch.groups.registry) { + dep.registryUrls = [`https://${tfrVersionMatch.groups.registry}`]; + } } else if (source) { const moduleParts = source.split('//')[0].split('/'); if (moduleParts[0] === '..') {