Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package terragrunt for openSUSE:Factory checked in at 2023-07-18 22:08:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/terragrunt (Old) and /work/SRC/openSUSE:Factory/.terragrunt.new.3193 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "terragrunt" Tue Jul 18 22:08:23 2023 rev:56 rq:1099222 version:0.48.3 Changes: -------- --- /work/SRC/openSUSE:Factory/terragrunt/terragrunt.changes 2023-07-06 18:29:51.479574541 +0200 +++ /work/SRC/openSUSE:Factory/.terragrunt.new.3193/terragrunt.changes 2023-07-18 22:08:49.803225705 +0200 @@ -1,0 +2,15 @@ +Tue Jul 18 09:13:18 UTC 2023 - ka...@b1-systems.de + +- Update to version 0.48.3: + * Added handling of no outputs in render-json execution (#2635) + +------------------------------------------------------------------- +Tue Jul 18 04:49:58 UTC 2023 - ka...@b1-systems.de + +- Update to version 0.48.2: + * fix: include missing param in parsing cache key construction + (#2518) + * [skip ci] Removing former Grunts (#2640) + * Update scripts.html (#2638) + +------------------------------------------------------------------- Old: ---- terragrunt-0.48.1.obscpio New: ---- terragrunt-0.48.3.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ terragrunt.spec ++++++ --- /var/tmp/diff_new_pack.Z2BOku/_old 2023-07-18 22:08:50.871231675 +0200 +++ /var/tmp/diff_new_pack.Z2BOku/_new 2023-07-18 22:08:50.879231720 +0200 @@ -19,7 +19,7 @@ %define __arch_install_post export NO_BRP_STRIP_DEBUG=true Name: terragrunt -Version: 0.48.1 +Version: 0.48.3 Release: 0 Summary: Thin wrapper for Terraform for working with multiple Terraform modules License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.Z2BOku/_old 2023-07-18 22:08:50.907231877 +0200 +++ /var/tmp/diff_new_pack.Z2BOku/_new 2023-07-18 22:08:50.911231899 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/gruntwork-io/terragrunt</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v0.48.1</param> + <param name="revision">v0.48.3</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.Z2BOku/_old 2023-07-18 22:08:50.935232033 +0200 +++ /var/tmp/diff_new_pack.Z2BOku/_new 2023-07-18 22:08:50.935232033 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/gruntwork-io/terragrunt</param> - <param name="changesrevision">4398100979680eb57dbcfd12703dcc4152ebaf3c</param></service></servicedata> + <param name="changesrevision">11378302f0e70235cc1fa5cb1c3cacc127d44a40</param></service></servicedata> (No newline at EOF) ++++++ terragrunt-0.48.1.obscpio -> terragrunt-0.48.3.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.48.1/CODEOWNERS new/terragrunt-0.48.3/CODEOWNERS --- old/terragrunt-0.48.1/CODEOWNERS 2023-07-05 21:03:36.000000000 +0200 +++ new/terragrunt-0.48.3/CODEOWNERS 2023-07-18 11:07:44.000000000 +0200 @@ -1 +1 @@ -* @rhoboat @denis256 +* @denis256 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.48.1/config/config.go new/terragrunt-0.48.3/config/config.go --- old/terragrunt-0.48.1/config/config.go 2023-07-05 21:03:36.000000000 +0200 +++ new/terragrunt-0.48.3/config/config.go 2023-07-18 11:07:44.000000000 +0200 @@ -10,6 +10,8 @@ "reflect" "strings" + "github.com/zclconf/go-cty/cty/gocty" + "github.com/hashicorp/go-getter" "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/hclparse" @@ -791,6 +793,25 @@ ) (*terragruntConfigFile, error) { terragruntConfig := terragruntConfigFile{} err := decodeHcl(file, filename, &terragruntConfig, terragruntOptions, extensions) + // in case of render-json command and inputs reference error, we update the inputs with default value + if diagErr, ok := err.(hcl.Diagnostics); ok && isRenderJsonCommand(terragruntOptions) && isAttributeAccessError(diagErr) { + terragruntOptions.Logger.Warnf("Failed to decode inputs %v", diagErr) + // update unknown inputs with default value + updatedValue := map[string]cty.Value{} + for key, value := range terragruntConfig.Inputs.AsValueMap() { + if value.IsKnown() { + updatedValue[key] = value + } else { + updatedValue[key] = cty.StringVal("") + } + } + value, err := gocty.ToCtyValue(updatedValue, terragruntConfig.Inputs.Type()) + if err != nil { + return nil, err + } + terragruntConfig.Inputs = &value + return &terragruntConfig, nil + } if err != nil { return nil, err } @@ -808,6 +829,16 @@ return -1 } +// isAttributeAccessError returns true if the given diagnostics indicate an error accessing an attribute +func isAttributeAccessError(diagnostics hcl.Diagnostics) bool { + for _, diagnostic := range diagnostics { + if diagnostic.Severity == hcl.DiagError && strings.Contains(diagnostic.Summary, "Unsupported attribute") { + return true + } + } + return false +} + // Returns the index of the ErrorHook with the given name, // or -1 if no Hook have the given name. // TODO: Figure out more DRY way to do this diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.48.1/config/config_partial.go new/terragrunt-0.48.3/config/config_partial.go --- old/terragrunt-0.48.1/config/config_partial.go 2023-07-05 21:03:36.000000000 +0200 +++ new/terragrunt-0.48.3/config/config_partial.go 2023-07-18 11:07:44.000000000 +0200 @@ -159,7 +159,7 @@ var terragruntConfigCache = NewTerragruntConfigCache() // Wrapper of PartialParseConfigString which checks for cached configs. -// configString, includeFromChild and decodeList are used for the cache key, +// filename, configString, includeFromChild and decodeList are used for the cache key, // by getting the default value (%#v) through fmt. func TerragruntConfigFromPartialConfigString( configString string, @@ -169,11 +169,11 @@ decodeList []PartialDecodeSectionType, ) (*TerragruntConfig, error) { if terragruntOptions.UsePartialParseConfigCache { - var cacheKey = fmt.Sprintf("%#v-%#v-%#v", configString, includeFromChild, decodeList) + var cacheKey = fmt.Sprintf("%#v-%#v-%#v-%#v", filename, configString, includeFromChild, decodeList) var config, found = terragruntConfigCache.Get(cacheKey) if !found { - terragruntOptions.Logger.Debugf("Cache miss for '%s' (partial parsing).", filename) + terragruntOptions.Logger.Debugf("Cache miss for '%s' (partial parsing), decodeList: '%v'.", filename, decodeList) tgConfig, err := PartialParseConfigString(configString, terragruntOptions, includeFromChild, filename, decodeList) if err != nil { return nil, err @@ -181,7 +181,7 @@ config = *tgConfig terragruntConfigCache.Put(cacheKey, config) } else { - terragruntOptions.Logger.Debugf("Cache hit for '%s' (partial parsing).", filename) + terragruntOptions.Logger.Debugf("Cache hit for '%s' (partial parsing), decodeList: '%v'.", filename, decodeList) } return &config, nil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.48.1/config/dependency.go new/terragrunt-0.48.3/config/dependency.go --- old/terragrunt-0.48.1/config/dependency.go 2023-07-05 21:03:36.000000000 +0200 +++ new/terragrunt-0.48.3/config/dependency.go 2023-07-18 11:07:44.000000000 +0200 @@ -424,7 +424,7 @@ return &convertedOutput, isEmpty, errors.WithStackTrace(err) } -// This function will true if terragrunt was invoked with renderJsonCommand +// isRenderJsonCommand This function will true if terragrunt was invoked with render-json func isRenderJsonCommand(terragruntOptions *options.TerragruntOptions) bool { return util.ListContainsElement(terragruntOptions.TerraformCliArgs, renderJsonCommand) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.48.1/docs/_includes/scripts.html new/terragrunt-0.48.3/docs/_includes/scripts.html --- old/terragrunt-0.48.1/docs/_includes/scripts.html 2023-07-05 21:03:36.000000000 +0200 +++ new/terragrunt-0.48.3/docs/_includes/scripts.html 2023-07-18 11:07:44.000000000 +0200 @@ -27,3 +27,6 @@ <script src="{{site.baseurl}}{{ site.assets_base_url }}js/cookie.js" async></script> {% endif %} + +<!-- HubSpot Embed Code per https://knowledge.hubspot.com/reports/install-the-hubspot-tracking-code --> +<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/8376079.js"></script> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.48.1/test/fixture-render-json-inputs/app/main.tf new/terragrunt-0.48.3/test/fixture-render-json-inputs/app/main.tf --- old/terragrunt-0.48.1/test/fixture-render-json-inputs/app/main.tf 1970-01-01 01:00:00.000000000 +0100 +++ new/terragrunt-0.48.3/test/fixture-render-json-inputs/app/main.tf 2023-07-18 11:07:44.000000000 +0200 @@ -0,0 +1 @@ +variable "x" {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.48.1/test/fixture-render-json-inputs/app/terragrunt.hcl new/terragrunt-0.48.3/test/fixture-render-json-inputs/app/terragrunt.hcl --- old/terragrunt-0.48.1/test/fixture-render-json-inputs/app/terragrunt.hcl 1970-01-01 01:00:00.000000000 +0100 +++ new/terragrunt-0.48.3/test/fixture-render-json-inputs/app/terragrunt.hcl 2023-07-18 11:07:44.000000000 +0200 @@ -0,0 +1,11 @@ + +dependency "dep" { + config_path = "../dependency" + +} + +inputs = { + static_value = "static_value" + value = dependency.dep.outputs.value + not_existing_value = dependency.dep.outputs.not_existing_value +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.48.1/test/fixture-render-json-inputs/dependency/main.tf new/terragrunt-0.48.3/test/fixture-render-json-inputs/dependency/main.tf --- old/terragrunt-0.48.1/test/fixture-render-json-inputs/dependency/main.tf 1970-01-01 01:00:00.000000000 +0100 +++ new/terragrunt-0.48.3/test/fixture-render-json-inputs/dependency/main.tf 2023-07-18 11:07:44.000000000 +0200 @@ -0,0 +1,4 @@ + +output "value" { + value = "output_value" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.48.1/test/integration_test.go new/terragrunt-0.48.3/test/integration_test.go --- old/terragrunt-0.48.1/test/integration_test.go 2023-07-05 21:03:36.000000000 +0200 +++ new/terragrunt-0.48.3/test/integration_test.go 2023-07-18 11:07:44.000000000 +0200 @@ -134,6 +134,7 @@ TEST_FIXTURE_BROKEN_DEPENDENCY = "fixture-broken-dependency" TEST_FIXTURE_RENDER_JSON_METADATA = "fixture-render-json-metadata" TEST_FIXTURE_RENDER_JSON_MOCK_OUTPUTS = "fixture-render-json-mock-outputs" + TEST_FIXTURE_RENDER_JSON_INPUTS = "fixture-render-json-inputs" TEST_FIXTURE_STARTSWITH = "fixture-startswith" TEST_FIXTURE_TIMECMP = "fixture-timecmp" TEST_FIXTURE_TIMECMP_INVALID_TIMESTAMP = "fixture-timecmp-errors/invalid-timestamp" @@ -5636,6 +5637,47 @@ assert.Contains(t, stderr.String(), "Running command: terraform init") } +func TestRenderJsonWithInputsNotExistingOutput(t *testing.T) { + t.Parallel() + + tmpEnvPath := copyEnvironment(t, TEST_FIXTURE_RENDER_JSON_INPUTS) + cleanupTerraformFolder(t, tmpEnvPath) + dependencyPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_RENDER_JSON_INPUTS, "dependency") + appPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_RENDER_JSON_INPUTS, "app") + + runTerragrunt(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s", dependencyPath)) + runTerragrunt(t, fmt.Sprintf("terragrunt render-json --with-metadata --terragrunt-non-interactive --terragrunt-working-dir %s", appPath)) + + jsonOut := filepath.Join(appPath, "terragrunt_rendered.json") + + jsonBytes, err := ioutil.ReadFile(jsonOut) + require.NoError(t, err) + + var renderedJson = map[string]interface{}{} + require.NoError(t, json.Unmarshal(jsonBytes, &renderedJson)) + + var includeMetadata = map[string]interface{}{ + "found_in_file": util.JoinPath(appPath, "terragrunt.hcl"), + } + + var inputs = renderedJson[config.MetadataInputs] + var expectedInputs = map[string]interface{}{ + "static_value": map[string]interface{}{ + "metadata": includeMetadata, + "value": "static_value", + }, + "value": map[string]interface{}{ + "metadata": includeMetadata, + "value": "output_value", + }, + "not_existing_value": map[string]interface{}{ + "metadata": includeMetadata, + "value": "", + }, + } + assert.True(t, reflect.DeepEqual(expectedInputs, inputs)) +} + func validateOutput(t *testing.T, outputs map[string]TerraformOutput, key string, value interface{}) { t.Helper() output, hasPlatform := outputs[key] ++++++ terragrunt.obsinfo ++++++ --- /var/tmp/diff_new_pack.Z2BOku/_old 2023-07-18 22:08:51.599235745 +0200 +++ /var/tmp/diff_new_pack.Z2BOku/_new 2023-07-18 22:08:51.599235745 +0200 @@ -1,5 +1,5 @@ name: terragrunt -version: 0.48.1 -mtime: 1688583816 -commit: 4398100979680eb57dbcfd12703dcc4152ebaf3c +version: 0.48.3 +mtime: 1689671264 +commit: 11378302f0e70235cc1fa5cb1c3cacc127d44a40 ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/terragrunt/vendor.tar.gz /work/SRC/openSUSE:Factory/.terragrunt.new.3193/vendor.tar.gz differ: char 5, line 1