terraform-cdk
terraform-cdk copied to clipboard
Allow using CLI without having a config file
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
cdktf & Language Versions
- 0.5.0
Affected Resource(s)
- cli
Debug Output
cdktf watch --app 'npx tsc && node render-stack.js' --out cdktf.test.out
Error: Usage Error: /some/path is not a cdktf project directory, no cdktf.json found or cdktf.json is missing language / app keys
Expected Behavior
Using the cli without a cdktf.json config file should work as well
Actual Behavior
An error is thrown when cdkt.json config file isn't present
Oh I was not aware that a project without a cdktf.json is valid, I added this check with the intend to keep people from using cdktf outside of a cdk project context. What is the use-case for this behavior and is this documented anywhere yet?
What is the use-case for this behavior and is this documented anywhere yet?
Except for app, everything else is pretty much optional. There are some subtile differences right now which are tracked here https://github.com/hashicorp/terraform-cdk/issues/798
So, it's perfectly fine to do something like cdktf deploy --app 'npx tsc && node render-stack.js or even skipping the CLI entirely npx tsc && node render-stack.js. My specific use-case here is an integration test scenario.
Don't know to which extent that's documented (probably not at all)
we also have a similar use case.
Imagine we have two repos
- controller (it contains the
cdktf.jsonand this is where the cdktf generation logic live) - deployment (it contains all the output instances of cdktf apps/stacks)
- app1
- manifest.json
- stacks/*
- app2
- manifest.json
- stacks/*
- app1
we want to be able to run cdktf output within the deployment to retrieve the output programmatically, and this is not possible because cdktf-cli is completely couple with the cdktf.json.
alternative
- creates a dummy
cdktf.jsonin the deployment repo for each app - run cdktf from the
controllerrepo (not possible becausecdktf outputimplicitly runcdktf synth, but each app in deployment requires different command argumements to run the cdktf app)
We generate cdktf apps on the fly per folder and don't want to have cdktf.json everywhere. All the parameters are passed in via cli flags anyways. Since cdktf --app flag already exists why cdktf.json can't be optional?