Open MWS-TAI opened 4 months ago
Hi @MWS-TAI 👋
It seems like there are dots introduced into the name by cross stack references (which is not valid Terraform). Normally they'd be replaced by the built-in logical id logic I suppose – so that would be something that would need to be replaced in your get_logical_id
implementation.
I did not test cross stack references when I looked into how to solve the outputs id request, so it seems that they require some more adjustment there.
Expected Behavior
When overriding getLogicalId (get_logical_id py func) to simply return the node id (as per 3433's solution), I would expect for cross-stack output's to also have correctly formatted resource IDs just like the rest of the resources.
Override function is below:
Actual Behavior
The outputted cdk.tf.json correctly has a passable resource name, however, the following error is produced.
cdk.tf.json:
terminal output:
Steps to Reproduce
Versions
language: python cdktf-cli: 0.19.2 node: v21.5.0 cdktf: 0.20.3 constructs: 10.3.0 jsii: 1.94.0 terraform: 1.6.5 arch: arm64 os: darwin 23.2.0 python: Python 3.11.7 pip: pip 24.0 from /Users/mikeyscott/Documents/traffyk-ai-data-platform/.venv/lib/python3.11/site-packages/pip (python 3.11) pipenv: null
Providers
cdktf-cdktf-provider-archive (PREBUILT) terraform provider version: 2.4.2 prebuilt provider version: 10.0.1 cdktf version: ^0.20.0 cdktf-cdktf-provider-aws (PREBUILT) terraform provider version: 5.37.0 prebuilt provider version: 19.6.0 cdktf version: ^0.20.0 cdktf-cdktf-provider-tls (PREBUILT) terraform provider version: 4.0.5 prebuilt provider version: 10.0.0 cdktf version: ^0.20.0
Gist
No response
Possible Solutions
No response
Workarounds
Whilst not the best solution, adding a simple if condition to return the usual allocateLogicalId where the node id contains "cross-stack-output" (this doesn't seem to effect the "cross-stack-reference" id).
Anything Else?
I am using node 21 which throws the "untested node version warning". I don't suspect this would cause this issue.
This is also my first issue here so please let me know if I haven't don't anything correctly.
References
3433
Help Wanted
Community Note