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-10-02 20:06:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/terragrunt (Old) and /work/SRC/openSUSE:Factory/.terragrunt.new.28202 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "terragrunt" Mon Oct 2 20:06:39 2023 rev:69 rq:1114654 version:0.51.7 Changes: -------- --- /work/SRC/openSUSE:Factory/terragrunt/terragrunt.changes 2023-10-02 20:06:19.530500407 +0200 +++ /work/SRC/openSUSE:Factory/.terragrunt.new.28202/terragrunt.changes 2023-10-02 20:09:24.465151184 +0200 @@ -1,0 +2,6 @@ +Fri Sep 29 19:18:17 UTC 2023 - ka...@b1-systems.de + +- Update to version 0.51.7: + * State file handling improvements (#2735) + +------------------------------------------------------------------- Old: ---- terragrunt-0.51.6.obscpio New: ---- terragrunt-0.51.7.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ terragrunt.spec ++++++ --- /var/tmp/diff_new_pack.ZxXTZL/_old 2023-10-02 20:09:26.097209878 +0200 +++ /var/tmp/diff_new_pack.ZxXTZL/_new 2023-10-02 20:09:26.097209878 +0200 @@ -19,7 +19,7 @@ %define __arch_install_post export NO_BRP_STRIP_DEBUG=true Name: terragrunt -Version: 0.51.6 +Version: 0.51.7 Release: 0 Summary: Thin wrapper for Terraform for working with multiple Terraform modules License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.ZxXTZL/_old 2023-10-02 20:09:26.125210884 +0200 +++ /var/tmp/diff_new_pack.ZxXTZL/_new 2023-10-02 20:09:26.125210884 +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.51.6</param> + <param name="revision">v0.51.7</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.ZxXTZL/_old 2023-10-02 20:09:26.145211604 +0200 +++ /var/tmp/diff_new_pack.ZxXTZL/_new 2023-10-02 20:09:26.149211748 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/gruntwork-io/terragrunt</param> - <param name="changesrevision">dc534bd7e517a2bbcf34e02b17fd0f6e5bc6351f</param></service></servicedata> + <param name="changesrevision">7765fafc434af4089a388148ddfe27e62d35c40d</param></service></servicedata> (No newline at EOF) ++++++ terragrunt-0.51.6.obscpio -> terragrunt-0.51.7.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.51.6/remote/terraform_state_file.go new/terragrunt-0.51.7/remote/terraform_state_file.go --- old/terragrunt-0.51.6/remote/terraform_state_file.go 2023-09-28 15:16:54.000000000 +0200 +++ new/terragrunt-0.51.7/remote/terraform_state_file.go 2023-09-29 15:33:57.000000000 +0200 @@ -3,7 +3,7 @@ import ( "encoding/json" "fmt" - "io/ioutil" + "os" "github.com/gruntwork-io/go-commons/errors" "github.com/gruntwork-io/terragrunt/util" @@ -62,20 +62,27 @@ } } -// Parse the Terraform .tfstate file at the given path +// ParseTerraformStateFile Parse the Terraform .tfstate file at the given path func ParseTerraformStateFile(path string) (*TerraformState, error) { - bytes, err := ioutil.ReadFile(path) + bytes, err := os.ReadFile(path) if err != nil { return nil, errors.WithStackTrace(CantParseTerraformStateFile{Path: path, UnderlyingErr: err}) } - - return parseTerraformState(bytes) + state, err := parseTerraformState(bytes) + if err != nil { + return nil, errors.WithStackTrace(CantParseTerraformStateFile{Path: path, UnderlyingErr: err}) + } + return state, nil } // Parse the Terraform state file data in the given byte slice func parseTerraformState(terraformStateData []byte) (*TerraformState, error) { terraformState := &TerraformState{} + if len(terraformStateData) == 0 { + return terraformState, nil + } + if err := json.Unmarshal(terraformStateData, terraformState); err != nil { return nil, errors.WithStackTrace(err) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.51.6/test/fixture-empty-state/main.tf new/terragrunt-0.51.7/test/fixture-empty-state/main.tf --- old/terragrunt-0.51.6/test/fixture-empty-state/main.tf 1970-01-01 01:00:00.000000000 +0100 +++ new/terragrunt-0.51.7/test/fixture-empty-state/main.tf 2023-09-29 15:33:57.000000000 +0200 @@ -0,0 +1 @@ + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.51.6/test/integration_test.go new/terragrunt-0.51.7/test/integration_test.go --- old/terragrunt-0.51.6/test/integration_test.go 2023-09-28 15:16:54.000000000 +0200 +++ new/terragrunt-0.51.7/test/integration_test.go 2023-09-29 15:33:57.000000000 +0200 @@ -173,6 +173,7 @@ TEST_FIXTURE_DISABLED_PATH = "fixture-disabled-path/" TEST_FIXTURE_NO_SUBMODULES = "fixture-no-submodules/" TEST_FIXTURE_DISABLED_MODULE = "fixture-disabled/" + TEST_FIXTURE_EMPTY_STATE = "fixture-empty-state/" TERRAFORM_BINARY = "terraform" TERRAFORM_FOLDER = ".terraform" TERRAFORM_STATE = "terraform.tfstate" @@ -6121,6 +6122,21 @@ require.NotContains(t, stderr.String(), util.JoinPath(tmpEnvPath, TEST_FIXTURE_DISABLED_MODULE, "m2")) } +func TestTerragruntHandleEmptyStateFile(t *testing.T) { + t.Parallel() + + tmpEnvPath := copyEnvironment(t, TEST_FIXTURE_EMPTY_STATE) + cleanupTerraformFolder(t, tmpEnvPath) + testPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_EMPTY_STATE) + + // create empty terraform.tfstate file + file, err := os.Create(util.JoinPath(testPath, TERRAFORM_STATE)) + require.NoError(t, err) + require.NoError(t, file.Close()) + + runTerragrunt(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s", testPath)) +} + 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.ZxXTZL/_old 2023-10-02 20:09:26.881238073 +0200 +++ /var/tmp/diff_new_pack.ZxXTZL/_new 2023-10-02 20:09:26.885238217 +0200 @@ -1,5 +1,5 @@ name: terragrunt -version: 0.51.6 -mtime: 1695907014 -commit: dc534bd7e517a2bbcf34e02b17fd0f6e5bc6351f +version: 0.51.7 +mtime: 1695994437 +commit: 7765fafc434af4089a388148ddfe27e62d35c40d ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/terragrunt/vendor.tar.gz /work/SRC/openSUSE:Factory/.terragrunt.new.28202/vendor.tar.gz differ: char 5, line 1