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

Do once empty check on the outdir prior to TF run #180

Merged
merged 1 commit into from
Jul 22, 2022

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Jul 21, 2022

TF run with TF_LOG_PATH set to a local file will cause the empty check on the output dir return non-empty on the second check in the Init() (actually initProvider()) function. In this case, the existing logic will work in append mode, especially it creates the provider.tf with no terraform setting, i.e. no provider setting. This results into
inconsistent dependency lock issues when users are not opt in the dev_overrides.

Meanwhile, this commit explicitly set the TF_LOG and TF_LOG_PATH from the environment, for the terraform-exec library. So that users can inspect what is going on via Terraform.

The demo of the original issue is as below:

Peek 2022-07-21 19-47

TF run with `TF_LOG_PATH` set to a local file will cause the empty check
on the output dir return non-empty on the second check in the `Init()`
(actually `initProvider()`) function. In this case, the existing logic
will work in append mode, especially it creates the `provider.tf` with
no `terraform` setting, i.e. no provider setting.  This results into
inconsistent dependency lock issues when users are not opt in the
`dev_overrides`.

Meanwhile, this commit explicitly set the `TF_LOG` and `TF_LOG_PATH`
from the environment, for the terraform-exec library. So that users can
inspect what is going on via Terraform.
@magodo magodo added the bug Something isn't working label Jul 21, 2022
@magodo magodo requested a review from ms-henglu July 21, 2022 11:50
Copy link
Member

@ms-henglu ms-henglu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@magodo magodo merged commit 702278c into Azure:main Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants