I ran into a case where the resource name is aws_cloudfront_monitoring_subscription and it has a field called monitoring_subscription. The type builder generated MonitoringSubscriptionParameters and MonitoringSubscriptionObservation fields for both the main type and also its field. During printing, only one of them was printed which had no fields, hence we end up in the case where there is a single MonitoringSubscriptionObservation that has no ID field, which broke GetID function.
This change ensures that we add the generated type name to the package scope earlier so that look-ups in the recursive calls of the same type consider the name of the upper level type as well.
Description of your changes
I ran into a case where the resource name is
aws_cloudfront_monitoring_subscription
and it has a field calledmonitoring_subscription
. The type builder generatedMonitoringSubscriptionParameters
andMonitoringSubscriptionObservation
fields for both the main type and also its field. During printing, only one of them was printed which had no fields, hence we end up in the case where there is a singleMonitoringSubscriptionObservation
that has noID
field, which brokeGetID
function.This change ensures that we add the generated type name to the package scope earlier so that look-ups in the recursive calls of the same type consider the name of the upper level type as well.
I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR if necessary.How has this code been tested
Manually with Jet AWS.