Open marengaz opened 2 years ago
on a similar note cdk 0.9.0 introduces another warning, because it defaults the backend to be the directory where the synth took place
{
...
"terraform": {
"backend": {
"local": {
"path": "path/to/terraform.batch_ingest.tfstate"
}
},
...
},
...
}
β·
β Warning: Backend configuration ignored
β
β on .terraform/modules/MyStackModule/my_stack/cdk.tf.json line 1915, in terraform.backend:
β 1915: "local": {
β
β Any selected backend applies to the entire configuration, so Terraform expects provider configurations only in the root module.
β
β This is a warning rather than an error because it's sometimes convenient to temporarily call a root module as a child module for testing purposes, but this backend configuration block will have no effect.
β΅
The provider block needing to exist is mentioned here.
More specifically defining providers causes them to appear in both required_providers
and provider
within the output. The latter could potentially be omitted if empty, but doing some might obscure errors if configuration is required.
Could also potentially infer providers from resources and automatically add to required_providers
.
I worry about having too much hidden behavior with those options. Perhaps an explicit flag on the provider to omit would be better.
The backend warning is a result of https://github.com/hashicorp/terraform-cdk/pull/1461.
Perhaps we could allow the user to specify at the stack level that the output is intended to be used as a module and have that make any tweaks to synthesizing to make that work better.
Perhaps we could allow the user to specify at the stack level that the output is intended to be used as a module and have that make any tweaks to synthesizing to make that work better.
This would really have to be on a provider basis, since you might have other providers which are dedicated to that module. What would this special synth mode do then?
Could also potentially infer providers from resources and automatically add to
required_providers
.
This would be a lot of magic and I think user config might be required more often than not (don't have hard data on this though).
Hi there! π We haven't heard from you in 30 days and would like to know if the problem has been resolved or if you still need help. If we don't hear from you before then, I'll auto-close this issue in 30 days.
unresolved
We need this so bad to make cdktf + terraform hcl usage possible in our terraform workspaces. Writing terraform modules in CDKTF and using that in our existing TFE repositories is the most common use case.
Can't https://github.com/cdktf/cdktf-tf-module-stack integrated into cdktf itself? Currently HCL output is broken in this package.
Community Note
cdktf & Language Versions
python cdk 0.8.6
Affected Resource(s)
provider
Steps to Reproduce
main.py
synthesised cdk.tf.json
calling cdk.tf.json as a module from another tf instance
Actual Behavior
calling the synthesised cdk.tf.json as a module from another terraform instance cases the following warning to be raised
removing
google = GoogleProvider(self, "google")
from the cdk main.py raises the following error:Expected Behavior
either:
Important Factoids
References
0000