GoogleCloudPlatform / terraform-python-testing-helper

Simple Python test helper for Terraform.
https://pypi.org/project/tftest/
Apache License 2.0
214 stars 31 forks source link

How do I output the original log at the same time when I execute `tg.plan`? #35

Closed AtomAsking closed 2 years ago

AtomAsking commented 3 years ago

Excuse me, how do I output the original log at the same time when I execute tg.plan?

tg = tftest.TerragruntTest(fixtures_dir, env=env)
tg.setup()
plan_obj = tg.plan(output=True, tf_vars=tf_vars)
format_data = plan_obj.resource_changes

I want to format the output while also outputting the original execution log file. Thanks!

davidtam commented 3 years ago

hello are you using pytest? If you are have you had a look at this?

I remember using pytest --capture=tee-sys worked while not interfere with the internals of tftest so pls give it a try.

AtomAsking commented 3 years ago

@davidtam I am sorry to reply to you so late. The method you said is ok, but it may not meet my actual needs. The scenario I use is in the web service.Thank you still for the ideas. thanks