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
Pretty same problem for me. It does not complain when var.tgw_id is referenced under transit_gateway_id, however it it shows error (No declaration found for "var.tgw_id") when referenced in depends_on clause.
I was able to reproduce this behaviour and I can confirm it is a bug just because Terraform CLI/Core doesn't raise it - so there's deviation.
The aws_subnet.tgw-subnet is already implied by the aws_subnet.tgw-subnet[*].id on the second line, so that entry in depends_on is not necessary. Similarly, dependency on var.tgw_id is already implied by the third line. Therefore, the whole depends_on attribute is redundant and can be removed.
That said, I have confirmed that there are valid use cases for referencing variables in depends_on although such valid use cases are relatively limited - as is the case of depends_on in general. One potential use case could involve variable validation. Therefore we'll need to relax the validation rules there by updating the schemas.
Side note: Given how often I've seen depends_on being over-used I think there is an opportunity for the extension to detect such duplication between implicit and explicit dependencies and raise these as separate diagnostics, although more advisory than as errors.
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 have 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.
Pretty same problem for me. It does not complain when
var.tgw_id
is referenced undertransit_gateway_id
, however it it shows error (No declaration found for "var.tgw_id") when referenced independs_on
clause.Originally posted by @mario-nc in #1592 (comment)
The text was updated successfully, but these errors were encountered: