@@ -329,7 +329,7 @@ func HandleYamlProjectGeneration(config *DiggerConfigYaml, terraformDir string,
329329 slog .Warn ("terragrunt generation using top level config is deprecated" ,
330330 "recommendation" , "https://docs.digger.dev/howto/generate-projects#blocks-syntax-with-terragrunt" )
331331
332- err := hydrateDiggerConfigYamlWithTerragrunt (config , * config .GenerateProjectsConfig .TerragruntParsingConfig , terraformDir )
332+ err := hydrateDiggerConfigYamlWithTerragrunt (config , * config .GenerateProjectsConfig .TerragruntParsingConfig , terraformDir , "" )
333333 if err != nil {
334334 slog .Error ("failed to hydrate config with terragrunt" , "error" , err )
335335 return err
@@ -338,7 +338,7 @@ func HandleYamlProjectGeneration(config *DiggerConfigYaml, terraformDir string,
338338 slog .Warn ("terragrunt generation using top level config is deprecated" ,
339339 "recommendation" , "https://docs.digger.dev/howto/generate-projects#blocks-syntax-with-terragrunt" )
340340
341- err := hydrateDiggerConfigYamlWithTerragrunt (config , TerragruntParsingConfig {}, terraformDir )
341+ err := hydrateDiggerConfigYamlWithTerragrunt (config , TerragruntParsingConfig {}, terraformDir , "" )
342342 if err != nil {
343343 slog .Error ("failed to hydrate config with terragrunt" , "error" , err )
344344 return err
@@ -408,16 +408,19 @@ func HandleYamlProjectGeneration(config *DiggerConfigYaml, terraformDir string,
408408 workflow = b .Workflow
409409 }
410410
411- tgParsingConfig := TerragruntParsingConfig {
412- CreateProjectName : true ,
413- DefaultWorkflow : workflow ,
414- WorkflowFile : b .WorkflowFile ,
415- FilterPath : path .Join (terraformDir , * b .RootDir ),
416- AwsRoleToAssume : b .AwsRoleToAssume ,
417- AwsCognitoOidcConfig : b .AwsCognitoOidcConfig ,
411+ // load the parsing config and override the block values
412+ tgParsingConfig := b .TerragruntParsingConfig
413+ if tgParsingConfig == nil {
414+ tgParsingConfig = & TerragruntParsingConfig {}
418415 }
419-
420- err := hydrateDiggerConfigYamlWithTerragrunt (config , tgParsingConfig , terraformDir )
416+ tgParsingConfig .CreateProjectName = true
417+ tgParsingConfig .DefaultWorkflow = workflow
418+ tgParsingConfig .WorkflowFile = b .WorkflowFile
419+ tgParsingConfig .FilterPath = path .Join (terraformDir , * b .RootDir )
420+ tgParsingConfig .AwsRoleToAssume = b .AwsRoleToAssume
421+ tgParsingConfig .AwsCognitoOidcConfig = b .AwsCognitoOidcConfig
422+
423+ err := hydrateDiggerConfigYamlWithTerragrunt (config , * tgParsingConfig , terraformDir , b .BlockName )
421424 if err != nil {
422425 slog .Error ("failed to hydrate config with terragrunt" ,
423426 "error" , err ,
@@ -696,7 +699,7 @@ func ValidateDiggerConfig(config *DiggerConfig) error {
696699 return nil
697700}
698701
699- func hydrateDiggerConfigYamlWithTerragrunt (configYaml * DiggerConfigYaml , parsingConfig TerragruntParsingConfig , workingDir string ) error {
702+ func hydrateDiggerConfigYamlWithTerragrunt (configYaml * DiggerConfigYaml , parsingConfig TerragruntParsingConfig , workingDir string , blockName string ) error {
700703 slog .Info ("hydrating config with terragrunt projects" ,
701704 "workingDir" , workingDir ,
702705 "filterPath" , parsingConfig .FilterPath )
@@ -803,6 +806,7 @@ func hydrateDiggerConfigYamlWithTerragrunt(configYaml *DiggerConfigYaml, parsing
803806 "workspace" , atlantisProject .Workspace )
804807
805808 diggerProject := & ProjectYaml {
809+ BlockName : blockName ,
806810 Name : atlantisProject .Name ,
807811 Dir : projectDir ,
808812 Workspace : atlantisProject .Workspace ,
0 commit comments