<@UB39JFCKC> How do I select a specific provider v...
# yaml
b
@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
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
Copy code
resources:
  something:
    type: aws:s3:Bucket
    properties:
      ...
    options:
      version: 5.6.0
b
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
A provider is not a resource.
A provider is a resource! It should work. @orange-policeman-59119 do we have an example?
o
I don't think we have an example with explicit versions, no
t
Let me draft up one…
Copy code
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
@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
You bet! Do you mind filing an issue in https://github.com/pulumi/pulumi-yaml for the docs?
b
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
Yes, I think we could add it there
b
@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
Yes, unfortunately that’s missing. It’s tracked in https://github.com/pulumi/pulumi-yaml/issues/246
πŸ‘πŸΌ 1
b
Thanks for referencing the issue
t
I believe we are actively working on a fix (cc @orange-policeman-59119 again)
b
That would be awesome πŸ‘πŸΌ
f
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
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
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
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