terragrunt icon indicating copy to clipboard operation
terragrunt copied to clipboard

terragrunt fails with JSON error in Mac M1 machine [version 0.37.1]

Open sharath-sequoia opened this issue 2 years ago • 8 comments

I am using terragrunt in M1 Mac, and the version 0.37.1 fails with below error when I run terragrunt init. We use remote s3 backend for terraform state. The error is as below: % terragrunt init
ERRO[0011] json: cannot unmarshal string into Go struct field Statement.Statement.Resource of type []string ERRO[0011] Unable to determine underlying exit code, so Terragrunt will exit with error code 1

It is not clear what exactly is the issue. The same terragrunt config works fine with older version of terragrunt (v0.36.12). I'll be happy to provide any other details needed.

sharath-sequoia avatar Jun 01 '22 07:06 sharath-sequoia

Hi, I think this may be same issue as: https://github.com/gruntwork-io/terragrunt/issues/2109

denis256 avatar Jun 01 '22 07:06 denis256

Hi, I have Mac on Intel chip and is experiencing the same.

daftkid avatar Jun 01 '22 10:06 daftkid

Same problem on intel mac mini. Problem is intermittent. Occurs also on terragrunt plan and terragrunt apply.

opichon avatar Jun 01 '22 12:06 opichon

fwiw I see the same on x86_64 docker in linux

terragrunt --version
terragrunt version v0.37.1
terraform --version
Terraform v1.2.2
on linux_amd64
DEBU[0005] Initializing remote state for the s3 backend  prefix=[/apps/<redacted>] 
DEBU[0007] Checking if SSE is enabled for AWS S3 bucket <redacted>  prefix=[/apps/<redacted>] 
DEBU[0007] Checking if bucket <redacted is have root access  prefix=[/apps/<redacted>] 
ERRO[0007] json: cannot unmarshal string into Go struct field Statement.Statement.Resource of type []string 
ERRO[0007] Unable to determine underlying exit code, so Terragrunt will exit with error code 1 

This is for remote state that doesn't exist yet (i.e. the first run, and also for things that don't touch the state e.g. terragrunt validate . If I run these versions against state that does exist (created with terraform 1.0.9 and terragrunt 0.36.something) they run just fine.

regarding being the same as #2109 the user that this runs at has full privileges for the state bucket. I'm going to continue debugging...

stephgosling avatar Jun 08 '22 08:06 stephgosling

ok the thing I don't understand having read the release notes that I can init with 0.36.12 without setting disable_bucket_update = true

stephgosling avatar Jun 08 '22 09:06 stephgosling

ok reading closer setting disable_bucket_update = true does resolve it for me however I don't understand what would be different about checking the bucket stuff for a state path that doesn't exist vs one that does?

stephgosling avatar Jun 08 '22 09:06 stephgosling

I ran into this issue on an AWS t4g instance (ARM based Graviton2 processor). The suggested fix for adding disable_bucket_update = true worked for me. This happened after upgrading to Terragrunt 0.37.1, and 0.37.2 since I noticed that got released today.

bisoncloudsolutions avatar Jun 08 '22 16:06 bisoncloudsolutions

This stacktrace is horrible :'( I am lucky I could find this issue through googling to fix the terragrunt upgrade. In the future could we have a better log so we can actually find the root of the problem? The golang stacktrace failing in JSON parsing is hell, it should at least show the String that it failed to parse.

The new requirement in IAM to have permission to use s3:GetBucketPublicAccessBlock breaks everything if you have restrictive policies.

bhoudu avatar Aug 10 '22 15:08 bhoudu

This issue was resolved in #2113

levkohimins avatar Aug 18 '23 19:08 levkohimins