Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON Parsing Error in Terratest v0.47.1: Invalid character in boolean value #1442

Open
AyoubIssaad opened this issue Sep 3, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@AyoubIssaad
Copy link

Describe the bug
After upgrading to Terratest v0.47.1, we're encountering a JSON parsing error when trying to get output using the OutputForKeys function. This error does not occur with previous versions of Terratest. The error suggests an issue with parsing boolean values in the JSON output from Terragrunt.

To Reproduce

  1. Use Terratest v0.47.1
  2. Run tests that use OutputForKeys to parse Terragrunt output
  3. Observe the JSON parsing error
// This is the code that cause the issue
terraformOptions := &terraform.Options{
		TerraformDir:    config.TerraformDir,
		TerraformBinary: "terragrunt",
		Logger:          logger.Discard,
	}

outputMap := terraform.OutputForKeys(t, terraformOptions, []string{"virtual_machine_resource_group_name", "virtual_machine_name"})

This is the error that we get:

TestAzureXXX 2024-09-03T14:47:54Z retry.go:91: terragrunt [output -no-color -json virtual_machine_resource_group_name --terragrunt-non-interactive]
    output.go:19: 
        	Error Trace:	/go/pkg/mod/github.com/gruntwork-io/[email protected]/modules/terraform/output.go:19
        	            				/runner/_work/qa-azure/qa-azure/terratest/test-templates/vm_unit_test_template.go:43
        	            				/runner/_work/qa-azure/qa-azure/terratest/packages/triggers/unit.go:63
        	            				/runner/_work/qa-azure/qa-azure/terratest/unit-tests/redhat8_base_unit_test.go:9
        	Error:      	Received unexpected error:
        	            	invalid character 'i' in literal true (expecting 'r')
        	Test:       	TestAzureredhat8baseVm

Expected behavior
Terratest should successfully parse the JSON output from Terragrunt without errors, allowing the test to proceed with the parsed output.

Versions

  • Terratest version: v0.47.1
@AyoubIssaad AyoubIssaad added the bug Something isn't working label Sep 3, 2024
@tgeijg
Copy link

tgeijg commented Sep 3, 2024

Seeing the same with just Output.
actualArn := terraform.Output(t, terraformOptions, "arn") gives the same error on 0.47.1, but not 0.47.0.

@james03160927 james03160927 self-assigned this Sep 4, 2024
@james03160927 james03160927 reopened this Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants