https://pulumi.com logo
Title
b

big-architect-71258

07/21/2022, 11:49 AM
@tall-librarian-49374 How do I select a specific provider version in Pulumi YAML. So far I have not been able to find anything in the documentation or a corresponding example.
t

tall-librarian-49374

07/21/2022, 12:44 PM
I think you can either specify the
version
option on the resource itself, or define a provider resource and then refer to it from resource options
Something like
resources:
  something:
    type: aws:s3:Bucket
    properties:
      ...
    options:
      version: 5.6.0
b

big-architect-71258

07/21/2022, 12:58 PM
Okay I'll give both approaches a try and let you know πŸ‘πŸΌ
@tall-librarian-49374 so I tested both approaches: 1. adding a version tag via options works. Although it's kinda inconvenient because variable or configuration expansion isn't possible 2. Seems it's not possible to create an explicit provider instance via YAML. In any case, I don't see an area where you could define a provider. If this is done in the resources section, an error will occur, of course. A provider is not a resource.
t

tall-librarian-49374

07/21/2022, 8:05 PM
A provider is not a resource.
A provider is a resource! It should work. @orange-policeman-59119 do we have an example?
o

orange-policeman-59119

07/21/2022, 8:13 PM
I don't think we have an example with explicit versions, no
t

tall-librarian-49374

07/21/2022, 8:26 PM
Let me draft up one…
name: providertest
runtime: yaml
resources:
  provider:
    type: pulumi:providers:azure
    options:
      version: 5.1.0
  rg:
    type: azure:core:ResourceGroup
    properties:
      location: WestEurope
    options:
      provider: ${provider}
πŸ‘πŸΌ 1
πŸš€ 1
😊 1
b

big-architect-71258

07/21/2022, 9:38 PM
@tall-librarian-49374 Ah...okay I missed qualifying the provider with pulumi:providers. Many thanks for crafting the example. It's definitely worth to have such an example in the official docs about YAML.
t

tall-librarian-49374

07/21/2022, 9:41 PM
You bet! Do you mind filing an issue in https://github.com/pulumi/pulumi-yaml for the docs?
b

big-architect-71258

07/22/2022, 7:12 AM
Have the silly thought about adding some documentation via a PR 😁 Is the YAML Reference the correct place for this? https://github.com/pulumi/pulumi-hugo/blob/master/themes/default/content/docs/reference/yaml/_index.md
t

tall-librarian-49374

07/22/2022, 7:33 AM
Yes, I think we could add it there
b

big-architect-71258

07/22/2022, 9:33 AM
@tall-librarian-49374 There you go https://github.com/pulumi/pulumi-hugo/pull/1767
πŸŽ‰ 1
@tall-librarian-49374 sorry for bothering you again 😏 I disabled default providers and I'm happy with normal resources because, as you described, they work flawlessly with explicit provider instances. But I get an error about an
Fn::Invoke
that calls
getClientConfig
of the Azure Classic provider, stating that default providers are disabled. I don't see any possibility to specify the provider instance with an
Invoke
. https://www.pulumi.com/docs/reference/yaml/#fninvoke
t

tall-librarian-49374

07/22/2022, 12:34 PM
Yes, unfortunately that’s missing. It’s tracked in https://github.com/pulumi/pulumi-yaml/issues/246
πŸ‘πŸΌ 1
b

big-architect-71258

07/22/2022, 12:36 PM
Thanks for referencing the issue
t

tall-librarian-49374

07/22/2022, 12:37 PM
I believe we are actively working on a fix (cc @orange-policeman-59119 again)
b

big-architect-71258

07/22/2022, 12:38 PM
That would be awesome πŸ‘πŸΌ
f

full-artist-27215

07/28/2022, 7:54 PM
Sorry to resurrect a thread, but do you have to override the provider on every resource that uses a given provider, or can you define something globally? If I've got a Python project, for instance, I can just declare the version for the provider I want in a
requirements.txt
file and go from there.
o

orange-policeman-59119

07/28/2022, 7:58 PM
Definitely agree. We have a couple issues open tracking fixing this, so that you can declare a provider as the default for every resource.
f

full-artist-27215

07/28/2022, 8:00 PM
OK, so until then, each one has to be specified. Not a deal killer, as I'm generating things with Cue πŸ˜…. Good to know; thanks @orange-policeman-59119 πŸ™
o

orange-policeman-59119

07/28/2022, 8:00 PM
I expect we'll ship this in the next 2 releases (2-4 weeks). The team has next week off, so I won't over promise :) https://github.com/pulumi/pulumi-yaml/issues/293
😎 1