pulumi / pulumi-yaml

YAML language provider for Pulumi
Apache License 2.0
38 stars 11 forks source link

Default Provider fails to apply if it's defined below its resource #604

Open mikhailshilkov opened 1 month ago

mikhailshilkov commented 1 month ago

What happened?

I assume the order of YAML resources should not matter. However, this program works:

name: aws-yaml
runtime: yaml
resources:
  provider:
    defaultProvider: true
    type: pulumi:providers:aws
    properties:
      region: us-west-2
  alb:
    type: aws:alb:LoadBalancer
    properties:
      tags: 
        Name: test-lb
      name: testing
      subnets: 
        - subnet-eacf3697
        - subnet-939b18f8

while the following one fails

name: aws-yaml
runtime: yaml
resources:
  alb:
    type: aws:alb:LoadBalancer
    properties:
      tags: 
        Name: test-lb
      name: testing
      subnets: 
        - subnet-eacf3697
        - subnet-939b18f8
  provider:
    defaultProvider: true
    type: pulumi:providers:aws
    properties:
      region: us-west-2

with

    error: resource or variable named "provider" could not be found
    error: Error registering resource [alb]: no diagnostics
    error: Error registering resource [provider]: no diagnostics

Example

see above

Output of pulumi about

CLI          
Version      3.126.0
Go Version   go1.22.5
Go Compiler  gc

Plugins
KIND      NAME  VERSION
resource  aws   unknown
language  yaml  unknown

Host     
OS       darwin
Version  14.5
Arch     arm64

This project is written in yaml

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).