I was trying to apply a messy terraform config recently and kept running across an issue where the AWS provider would seemingly just get itself hung, using ~150% CPU. Killing it, deleting the
terraform.tfstate and init/refresh/apply seemed to make it work sometimes. I thought I was having network connection issues, as it’d hang in random parts of a refresh or something like that.
Turns out it’s an issue with Rosetta 2 and golang fighting. There is more information in this comment from the Apple Developer-Ecosystem-Engineering account, where Rosetta’s handling of signals isn’t complete, but which has been fixed in recente versions of Rosetta.
These are the key log entries that helped me find the right bug reports:
2020-12-21T13:31:22.745+0530 [DEBUG] plugin.terraform-provider-aws_v3.22.0_x5: assertion failed [inst.has_value()]: failed to decode instruction: 0x0 2020-12-21T13:31:22.745+0530 [DEBUG] plugin.terraform-provider-aws_v3.22.0_x5: (StateRecovery.cpp:336 determine_state_recovery_action_forward_branches)
I was also seeing a lot of these too:
2020-12-21T13:31:21.467+0530 [WARN] plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
This workaround was found in golang/go #42700, adding it to
~/.zshrc made it permanent but you can also test it (without
export) in front of any