Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mikhailshilkov opened this issue Jul 25, 2024 · 3 comments
Closed
Assignees
Labels
customer/feedback Feedback from customers kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Milestone

Comments

@mikhailshilkov
Copy link
Member

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).

@mikhailshilkov mikhailshilkov added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team customer/feedback Feedback from customers labels Jul 25, 2024
@justinvp justinvp removed the needs-triage Needs attention from the triage team label Jul 29, 2024
@justinvp justinvp added this to the 0.110 milestone Sep 16, 2024
@brandonpollack23
Copy link
Contributor

Ok after some digging it seems the topological sort is not aware of the dependency of alb on the aws provider here. Looking into how to pivot on that information if its there and if it isn't figuring out how to add it (perhaps this is an aws provider specific issue but I doubt it)

@brandonpollack23
Copy link
Contributor

More progress: if you explicitly set the provider in the config section it works out. the topological sort doesn't work because it doesn't detect "default provider" I bet I could add a special case for that in topological sort to always put that first so any other resources that expect it will work

brandonpollack23 added a commit that referenced this issue Sep 24, 2024
The topological sort will not sort default providers first as is, so
this adds in a check to detect it and not allow implicit providers to be
complete until the default provider is declared.

Remote-Ref: brandonpollack23/f91181f4
Bug: #604
brandonpollack23 added a commit that referenced this issue Sep 24, 2024
The topological sort will not sort default providers first as is, so
this adds in a check to detect it and not allow implicit providers to be
complete until the default provider is declared.
Bug: #604

Remote-Ref: brandonpollack23/f91181f4
brandonpollack23 added a commit that referenced this issue Sep 25, 2024
The topological sort will not sort default providers first as is, so
this adds in a check to detect it and not allow implicit providers to be
complete until the default provider is declared.
Bug: #604

Remote-Ref: brandonpollack23/f91181f4
brandonpollack23 added a commit that referenced this issue Sep 25, 2024
The topological sort will not sort default providers first as is, so
this adds in a check to detect it and not allow implicit providers to be
complete until the default provider is declared.
Bug: #604

Remote-Ref: brandonpollack23/f91181f4
brandonpollack23 added a commit that referenced this issue Sep 25, 2024
The topological sort will not sort default providers first as is, so
this adds in a check to detect it and not allow implicit providers to be
complete until the default provider is declared.
Bug: #604

Remote-Ref: brandonpollack23/f91181f4
brandonpollack23 added a commit that referenced this issue Sep 27, 2024
The topological sort will not sort default providers first as is, so
this adds in a check to detect it and not allow implicit providers to be
complete until the default provider is declared.
Bug: #604

Remote-Ref: brandonpollack23/f91181f4
@justinvp justinvp added the resolution/fixed This issue was fixed label Sep 30, 2024
@justinvp
Copy link
Member

Fixed by #652

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer/feedback Feedback from customers kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

3 participants