-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Bug]: Terraform apply command freezes during AWS provider initialization #39523
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
I forgot to add, reverting to provider 5.68.0 works like a champ. |
I have the same issue with v5.69.0. UPD: Chip - Apple M1 Pro |
What we found for our team is that only x86 provider did not work as it should. Mac with intel or arm doesn't matter, if you use 5.69.0_x86 (with Rosseta on arm) there will be some kind of problems. |
I have the same issue with v5.69.0(hashicorp/aws/5.69.0/darwin_amd64/terraform-provider-aws_v5.69.0_x5) and chip Apple M3 with Rosetta 2. |
Same issue on Apple M3 |
It seems to be an issue only with Apple M chips, the version Also, it works fine when I use the same version in the CDKTF. Quite odd. |
I was trying to figure this out for 3 hours today what it was. Was convinced it was a provider and here we are. Thanks for whoever reported this. |
Looks like these projects have had similar errors recently: |
I’m using an Apple M3 with tfenv configured to the amd64 architecture in my TFENV_ARCH environment variable. This is because, in the projects I work on with my team, not everyone uses Apple M3; most of them are on Linux. To stay aligned with the rest of the team, I always configure my Terraform binary to work in amd64. Therefore, in my case, I’m on Apple M3 and using Rosetta 2. This issue only started happening with the latest version of the AWS provider (5.69.0). With version 5.68.0, everything works perfectly, only get the error that @law mentioned with version 5.69.0. @cailen I tried running the command with the environment variable you suggested (
While this reduced the number of log lines, the issue persists and fails at the same elements. Below is an excerpt from the logs:
|
@jotasixto The binaries are all made with the same code. I would think you could use the native copies (darwin arm64) to run anything locally on your computer and the other users could use darwin amd64 or whatever other flavor without issue. We do this where I work. Some are still on older Intel Macs. We also run things via Github Actions using Linux Amd64. I'm not at all discounting that it is broken, but you may be better off using the native version for your system unless there is no compatible one (like for very old versions of Terraform). |
@cailen Unfortunately, some of our legacy projects (which we are currently working on updating) use version 3 of the AWS provider, which doesn't have a compiled version for ARM to download. Therefore, I am unable to work with them locally on my machine. This is why I also have the Terraform binary configured to use |
@jotasixto makes sense then! Are you sure they don't have ARM copies though? From 3.30.0 there are ARM versions for Darwin. https://releases.hashicorp.com/terraform-provider-aws/3.30.0/. Maybe you are stuck using a version less than 3.30.0, but it may be worth trying to upgrade to the latest 3.x version if you can. The ARM version of Terraform also runs a lot faster. |
@cailen I apologize for the confusion earlier. I was replying from my phone at the time and recalling from memory, as it had been a few months since I last worked on this issue. Now that I’ve had the chance to check it again on my laptop, I can confirm that the problem was actually related to HashiCorp providers and not AWS providers.
I should have verified this before responding. However, this issue is causing a similar kind of blockage in legacy projects, as I can't remove the providers without following the proper migration process. Additionally, using the darwin_arm64 binary in my case is not a viable solution to work on the migration of these projects. Thank you for your understanding, and I appreciate your suggestion! |
Since Terraform Cloud runners are all x64, I lock my arch to that anyway on my M macs... helps with the lock file hashes as well. Maybe this is overkill but until this issue it's been working well for me. |
If I'm not mistaken, in the past Pulumi use terraform providers in the end, not sure if they still do it for some cases like this. If so, could be it. I'm not sure about stt 🤔
And about this, I just double checked and that CDKTF was using |
Same issue Downgrade to v5.68 fixed the issue. Also I want to emphasize on a comment above on how hard the problematic v5.70 providers hit your CPU and memory |
I find it crazy that this has not been triaged yet. What is going on, maintainers? @marcosentino @breathingdust @justinretzolk |
Just chiming in: back-pinning to Macbook Pro M3 And the |
Could anyone who is experiencing this with v5.69.0 or v5.70.0 see if they have the same problem with v5.65.0 or v5.66.0? |
after more than two weeks we still have the same problem, which is being a real problem for those of us who deploy infra every day, please help us. |
GODEBUG=asyncpreemptoff=1 helped me get around the issue for now. Thanks for sharing @justinretzolk |
@JnMik > GODEBUG=asyncpreemptoff=1 me ayudó a solucionar el problema por ahora. Gracias por compartir ¿Lo probaste ? |
As you can see in this thread, the issue is not yet resolved, no. Just put the variable in front of your terraform apply and see if it works
|
@JnMik Thank you very much for trying to help me, but it doesn't work for me, same problem and same error: |
With version 5.73.0 also gives problems, and the same failure. |
@bschaatsbergen Thanks for your answer, but the link that you have provided me does not tell me anything, I do not know if it is a problem or solution or if it has to do with the problem that we are having all those who manage terraform with a Mac with an apple chip. We have been more than a month with this problem, and after 6 or more versions of the provider, we still have the same problem, just tell you that it is an important problem for people who deploy infrastructure in AWS every day, and I am giving me the feeling that this problem is not being taken with the importance it requires. I just ask you please to solve it as soon as possible, because this depends on our work and day to day. |
I am not sure why, but it happens a lot less frequently if I put terraform into debugging log mode.
But I am maybe a special case because I need to deploy for a customer with an older terraform version. Maybe some timing differences (through log output) already help to make the problem less severe. |
Hey @mmadrono 👋 Due to the nature of this issue, we don't expect that it will be resolved in the short term. This seems to be a bug in Rosetta2, so we're keeping an eye out for any updates that might address it, and will update this thread accordingly so that everyone following is notified. If your setup differs significantly from what's been laid out in the thread so far, it may be worth opening a new Issue so that we can address that separately. In the meantime, releases will continue to be effected, so you don't need to worry about letting us know that you're continuing to see the same behavior when a new version is released. I noticed that you're using Terragrunt and that your screenshots seem to indicate that you're running @thomaspeitz thanks for the addition information! |
Thanks for your answer, and for the time spent, but tell you that the version of terraform that is used in my organization is 0.14.11 and this version is not Darwin_arm64 architecture, there is only amd64, so using the binary terraform in this architecture. there is no other. But I have never had any problems with this binary until now, well until provider version 5.69.0 and later. |
I am also not convinced this issue is solely related to rosetta as I have explained already my workflow does not include any Apple CPUs and I am both facing the same issue and benefit from the same workaround. The only thing I can think of is perhaps if the root cause is actually related to virtualization in some way and that a rosetta fix in golang or this module may also fix what we're experiencing on AWS. |
Thanks for the data point on why you're using the @gvoss: Just to confirm, since you're the only report we've seen that wasn't tied to MacOS/Rosetta: are you receiving the same error, or just similar behavior? To save you searching this thread, the relevant error was: 2024-09-27T13:46:40.034-0600 [DEBUG] provider.terraform-provider-aws_v5.69.0_x5: assertion failed [arm_interval().contains(address)]: code fragment does not contain the given arm address
2024-09-27T13:46:40.034-0600 [DEBUG] provider.terraform-provider-aws_v5.69.0_x5: (CodeFragmentMetadata.cpp:48 instruction_extents_for_arm_address) If it's similar behavior without that exact error, you'll want to open a new issue so that we can look into that separately. If it's the same error and you're able to provide any debug logging, that would be quite helpful. |
@justinretzolk for another datapoint, some older providers don't have arm builds still and we'd rather not compile them ourselves (this is less of an issue lately), however we also feel that since Terraform Cloud uses amd runners, we might as well run that locally just in case. This also allows us to align our lock files better with TFC runners. |
Indeed, that's the situation for us. We have to use the AMD64 version of the GCP provider, and that forces us to use AMD64 for all providers, when on ARM Mac hardware. |
I originally created #39627 but it was triaged and closed to defer to this issue. It sounds like perhaps the workaround is the same but maybe these two issues differ? |
Never mind, in my experiments I accidentally compiled provider for arm64 instead of amd64. So, no new information: darwin-amd64 crashes, darwin-arm64 works as expected. Edit 2: I have compiled v5.68.0 with |
Encountered the same issue, but don't know how I can help. Downgraded to 5.68 and it seems working. Please let me know if you'd like any additional details. |
Same here with M3, with 5.68 works fine. |
Had this issue and seems tfenv defaults to To fix this, add the following to export TFENV_ARCH=arm64 Then run the following commands to reinstall: tfenv uninstall 1.10.0
tfenv use 1.10.0 |
An additional data point - I have been encountering this issue for a while now starting with AWS provider
|
this one worked for me, thank you |
do you know if this works with terraform version 0.14.11? |
Confifmed
and reinstall terraform using tfenv solved this. |
Terraform Core Version
1.5.7
AWS Provider Version
5.69.0
Affected Resource(s)
n/a
Expected Behavior
'terraform apply' should continue, and ask me for confirmation before applying changes
Actual Behavior
When running `terraform apply, the process freezes during the initialization of the AWS provider. The command does not complete and requires manual termination.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
https://gist.github.com/law/62b9c75214c18a015c37f16285a13ba4
Steps to Reproduce
TF_LOG=debug terraform apply
(orterragrunt init
) when using the above providerDebug Output
https://gist.github.com/law/5271d0e0cd052d438a194eb50c11da63
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: