You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If CDKTF_LOG_FILE_DIRECTORY is set on the system, then the cdktf init command errors out with the following message
Unknown argument: logFileDirectory
[The environment variable is specified with a path of an existing folder (with sufficient read/write access)]
However, if this environment variable is set aftercdktf init is executed, then:
All the other commands (get, synth, deploy, diff, destroy, etc.) support CDKTF_LOG_FILE_DIRECTORY & successfully log the content in the specified directory.
Expected Behavior
Is it intentional that CDKTF_LOG_FILE_DIRECTORY is not supported during init & it does not allow logging to a specific directory? If so:
Is it because logging is solely for debugging CDKTF applications, so we want to save the logs only after the application is created to debug it [Reference:Debugging]
Or is it because we want project-specific logs?
As CDKTF allows managing different projects, streaming logs from two different CDKTF projects to the same file is not a valid use case.
Therefore, the cdktf init does not stream logs and expects us to configure logging to separate directories for each application after initialization.
Step 2: In an empty directory, run cdktf init --template=typescript command.
[This returns an 'Unknown argument' error]
Versions
language: typescript
cdktf-cli: 0.17.3
npm: 8.19.4
node: 16.20.1
terraform: 1.4.5
Providers
No response
Gist
No response
Possible Solutions
No response
Workarounds
No response
Anything Else?
No response
References
No response
Help Wanted
I'm interested in contributing a fix myself
Community Note
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
The text was updated successfully, but these errors were encountered:
ShaheenK27
changed the title
CDKTF_LOG_FILE_DIRECTORY: 'cdktf init' errors our with 'Unknown argument' when this environment variable is set
CDKTF_LOG_FILE_DIRECTORY: 'cdktf init' errors out with 'Unknown argument' when this environment variable is set
Feb 8, 2024
…ommands (#3495)
<!--
Unless this is a very simple 1-line-of-code change, please create a new
issue describing the change you're proposing first, then link to it from
this PR.
Read more about our process in our contributing guide:
https://github.com/hashicorp/terraform-cdk/blob/main/CONTRIBUTING.md
-->
### Related issue
Fixes#3489
### Description
We were using `CDKTF_LOG_FILE_DIRECTORY` within our logger, but we never
made it into a supported CLI flag. CDKTF configures
[yargs](https://yargs.js.org/) in a way that all environment variables
with the `CDKTF_` prefix are treated as CLI flags. For commands that had
[`strict`](https://yargs.js.org/docs/#api-reference-strictenabledtrue)
enabled, that means that setting any non-supported flag with the
`CDKTF_` prefix would cause the command to fail. This PR now adds
support for this flag and it should work across all commands.
---------
Co-authored-by: Ansgar Mertens <ansgar@hashicorp.com>
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Actual Behavior
If CDKTF_LOG_FILE_DIRECTORY is set on the system, then the
cdktf init
command errors out with the following message[The environment variable is specified with a path of an existing folder (with sufficient read/write access)]
However, if this environment variable is set after
cdktf init
is executed, then:Expected Behavior
Is it because logging is solely for debugging CDKTF applications, so we want to save the logs only after the application is created to debug it [Reference: Debugging]
Or is it because we want project-specific logs?
As CDKTF allows managing different projects, streaming logs from two different CDKTF projects to the same file is not a valid use case.
Therefore, the
cdktf init
does not stream logs and expects us to configure logging to separate directories for each application after initialization.Steps to Reproduce
Step 1: export CDKTF_LOG_FILE_DIRECTORY=<path/to/logging/directory/>
Step 2: In an empty directory, run
cdktf init --template=typescript
command.[This returns an 'Unknown argument' error]
Versions
Providers
No response
Gist
No response
Possible Solutions
No response
Workarounds
No response
Anything Else?
No response
References
No response
Help Wanted
Community Note
The text was updated successfully, but these errors were encountered: