* `providers = { aws = aws.east, aws.dns = aws.dns }` in a module block maps * the child's provider slots (keys) to THIS scope's provider configurations * (values) — reference each value.
( body: SyntaxNode, ctx: Parameters<NonNullable<LanguageExtractor['visitNode']>>[1], fromNodeId: string )
| 601 | * (values) — reference each value. |
| 602 | */ |
| 603 | function emitModuleProvidersRefs( |
| 604 | body: SyntaxNode, |
| 605 | ctx: Parameters<NonNullable<LanguageExtractor['visitNode']>>[1], |
| 606 | fromNodeId: string |
| 607 | ): void { |
| 608 | for (const attr of body.namedChildren) { |
| 609 | if (!attr || attr.type !== 'attribute') continue; |
| 610 | const idNode = attr.namedChildren.find((c) => c?.type === 'identifier'); |
| 611 | if (!idNode || getNodeText(idNode, ctx.source) !== 'providers') continue; |
| 612 | // Find every object_elem and read its `val` side only — the key names the |
| 613 | // CHILD module's provider requirement, not a configuration here. |
| 614 | const queue: SyntaxNode[] = [attr]; |
| 615 | while (queue.length) { |
| 616 | const n = queue.shift()!; |
| 617 | if (n.type === 'object_elem') { |
| 618 | const val = getChildByField(n, 'val'); |
| 619 | const sel = val ? providerSelectionFromExpr(val, ctx.source) : null; |
| 620 | if (sel) { |
| 621 | ctx.addUnresolvedReference({ |
| 622 | fromNodeId, |
| 623 | referenceName: `provider.${sel}`, |
| 624 | referenceKind: 'references', |
| 625 | line: n.startPosition.row + 1, |
| 626 | column: n.startPosition.column, |
| 627 | }); |
| 628 | } |
| 629 | continue; |
| 630 | } |
| 631 | for (const c of n.namedChildren) { |
| 632 | if (c) queue.push(c); |
| 633 | } |
| 634 | } |
| 635 | return; |
| 636 | } |
| 637 | } |
| 638 | |
| 639 | /** |
| 640 | * Read a provider-configuration address (`aws`, `aws.east`, `google-beta`) |
no test coverage detected