pulumi / pulumi-yaml

YAML language provider for Pulumi
Apache License 2.0
39 stars 12 forks source link

Beta plugin versions are used over stable versions #414

Closed danielrbradley closed 1 year ago

danielrbradley commented 1 year ago

What happened?

When running a program when having the follwing plugins installed:

    resource awsx-1.0.0
    resource awsx-1.0.0-beta.11

The YAML language used the beta package instead of the stable and newer 1.0.0 package.

Steps to reproduce

  1. pulumi plugin install resource awsx 1.0.0-beta.11
  2. pulumi plugin install resource awsx 1.0.0
  3. Attempt to run the following program
resources:
  cluster:
    type: aws:ecs:Cluster
  lb:
    type: awsx:lb:ApplicationLoadBalancer
  service:
    type: awsx:ecs:FargateService
    properties:
      cluster: ${cluster.arn}
      assignPublicIp: true
      desiredCount: 2
      taskDefinitionArgs:
        container:
          image: nginx:latest
          cpu: 512
          memory: 128
          essential: true
          portMappings:
            targetGroup: ${lb.defaultTargetGroup}

Expected Behavior

Should use 1.0.0 and pass correctly

Actual Behavior

Fails with error due to property not existing in beta version

Output of pulumi about

No response

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

aq17 commented 1 year ago

Hey @danielrbradley , it looks like this isn't actually a plugin issue. portMappings is an array – changing it to

          portMappings:
            - targetGroup: ${lb.defaultTargetGroup}

seems to work.

danielrbradley commented 1 year ago

Yes, that does look like a typo there too, although the error I was seeing was actually complaining about assignPublicIp not existing (which was new in 1.0.0)

aq17 commented 1 year ago

Hm I didn't see that error, even after removing 1.0.0 and only having 1.0.0-beta.11 installed

danielrbradley commented 1 year ago

Hmm, perhaps there's some kind of caching going on as that program is correctly invalid for 1.0.0-beta.11 and should fail.

aq17 commented 1 year ago

@danielrbradley apologies but I'm still unable to repro, even when explicitly using the beta version i.e.

resources:
  awsx: 
    type: pulumi:providers:awsx
    defaultProvider: true
    options:
      version: 1.0.0-beta.11

Would be super helpful if we could sync on this next week and try to root cause the issue.

AaronFriel commented 1 year ago

I think the bug may be that even though a provider version is selected via $resource.options.version, that version is not utilized during type checking of the program. Instead, a nil version was used to load the package, which could select a version that was incompatible with the program as written.

423 should solve this, though I'd still be curious to see if we could produce a test case for the incorrect behavior.