-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
SAM build crashes using terraform #7038
Comments
Hey @danielbojczuk-jumbo thanks for raising the issue. I couldn't reproduce the issue on my own. Can you help clarify the followings:
|
Hi, thanks in advance for your help. Yes, I'm creating the local image during the GH Action run. I created this public repo with an example of the problem. It has a failed github action workflow: Thid is the full log from the failed action:
This code works fine in my local machine (macOS) If you have any further question, just let me know. |
@hawflau, could reproduce it? |
@danielbojczuk-jumbo I saw that in your GH action definition, you are running Running this locally worked for me. |
Hi @mndeveci, I was expecting using the hook in the samconfig.yml was enough. Anyway, I merged your pull request and run the pipeline. The issue still happens.
|
|
Hi @mndeveci and @hawflau, I took the day today to debug the sam-cli terraform hooker and found the problem. The sam-cli executes the terraform in a subprocess. In the last step, it gets the output of the show plan as json to translate it to a SAM/Cloudformation template. The problem is GitHub, by default, adds a wrapper script to the terraform command. Probably to enhance the logging. Since the sam-cli dosn't know that, it tries to parse a json, that actually is not a json. terraform show plan -json with wrapper:
terraform show plan -json without wrapper:
The solution is to disable the wrapper when configuring the terraform github action:
Maybe it is worth mentioning this in any documentation? |
Thanks for suggesting this, I can consult with our documentation friends about adding a note indicating that the output should be untouched by runners or other processes. For now, I'm going to close this issue as the root cause has been found and a workaround exists when using that action. Feel free to create a new issue if something else arises. |
|
Description:
Running the
sam build
command in theubuntu-latest
, amd64, github action runner, crashes with an unexpected error on json parsing. Running the locally using macOS, arm64, works as expected.Steps to reproduce:
Use GitHub Actions with ubuntu-latest with the following tool versions:
Use the following directory structure
sam build
inside the terraform directoryObserved result:
SAM cli starts building without using the container or raising some error/warning.
Expected result:
Start building in a container as it happens locally using macOS (arm64) using the folowwing versions
Paste the output of
sam --info
hereSAM info from github action runner (Crashes)
SAM info from local
The text was updated successfully, but these errors were encountered: