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

Terraform Debug Logging During GitHub Actions #6

Open
sprankhub opened this issue Oct 25, 2022 · 8 comments
Open

Terraform Debug Logging During GitHub Actions #6

sprankhub opened this issue Oct 25, 2022 · 8 comments

Comments

@sprankhub
Copy link
Contributor

We should consider using one of the following Terraform log levels during the GitHub Actions by default:

  • TRACE
  • DEBUG
  • INFO
  • WARN
  • ERROR

This is as easy as adding an environment variable TF_LOG to the respective value, see https://developer.hashicorp.com/terraform/internals/debugging.

The advantage would be that we have detailed information about issues, which may occur, without executing the actions locally.

Would appreciate your input, @bucha, @vitaliy-golomoziy if you think it makes sense and which log level we should use.

@vitaliy-golomoziy
Copy link

In my opinion, we should keep things simple. These error logs are only useful for debugging purposes, and I don't think we want to see tons of information about every step terraform is taking on every pull request. When something is going wrong, we can dig in and debug, but keeping the log verbose at all times will pollute the output. But, of course, this is only my opinion. As an option, we may think of persisting logs in some files, but then we have a question of where to keep these files and for how long. More exotic options are to enable logs conditionally in the workflow or even to think of logstash :)

@github-actions
Copy link

@sprankhub
Copy link
Contributor Author

Even though I now documented how to run Terraform locally, it is pretty much a PITA if you have not done it before. Especially, because you need lots of permissions, which you usually do not have. However, executing the actions locally is currently the only way to enable debug logging.

The logs from GitHub Actions are deleted after some time anyway, so a verbose output is not that bad. And IF you look at these logs, you probably want to have detailed information.

I currently still do not see a real disadvantage here 🤔 But agreed, we probably do not want TRACE, but rather something like WARN?

@github-actions
Copy link

@vitaliy-golomoziy
Copy link

That's fine. ButWARN won't tell us much :)

@github-actions
Copy link

@vitaliy-golomoziy
Copy link

And regarding running terraform locally, setting all vars in a command line is another option, perhaps more intuitive in the sense that we can provide a handy command where people just substitute the right values so that nothing important is forgotten.

@github-actions
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants