Hello. I'm trying to use cloud-init templating wit...
# general
Hello. I'm trying to use cloud-init templating with pulumi (for proxmox) and I've come across this: https://www.pulumi.com/registry/packages/cloudinit/api-docs/config/ But it says it's deprecated:
This resource is deprecated Please use the cloudinit.Config data source instead.
I've no idea what is meant by 'data source' here. Maybe someone can point me to the right resource. It would be great if the documentation contained an actual reference/link to it.
My guess is that I have to use something to the effect of:
Copy code
import pulumi_cloudinit as cloudinit

# Generate a cloud-init config
config = cloudinit.Config("example",
  - name: pulumi
      - your_public_ssh_key_here
But this is just something I've found on the internet, it's not something I've inferred in anyway. Eh...
looks like the pulumi package for cloud-init just tracks the terraform provider. the same deprecation message is here on the config resource page in the provider docs https://registry.terraform.io/providers/hashicorp/cloudinit/latest/docs/resources/config
definitely confusing without adding context on the pulumi docs
i think you'd want to use the getConfig function in the pulumi package, it seems to match up to the terraform data source. this github issue comment has some example code that might be useful https://github.com/pulumi/pulumi-cloudinit/issues/33#issuecomment-1039064729
for me
is just misleading or I don't understand it. It leads me to believe that there's an existing config that I'm retrieving somehow and I'm not creating it there.
But from the link you're offering, yeah, that's not the case. It works more or less like with terraform, where you define it in parts.
I'm slowing trying to understand how I can go from terraform (which is exceedingly and frustratingly limiting) to pulumi, which is much more powerful, but it also means taking more responsibility, as it were, and being more creative/capable.
Anyway, there's also https://www.pulumi.com/registry/packages/cloudinit/ (which is consistent to my solution, as far as I understand). I don't understand the difference.
its frustrating that the example is using the deprecated resource. functionally, there doesn't appear to be any difference between the deprecated resource and the data source apart from how they would both be maintained in state by the provider. they both return a config object rendered from the config parts you provide
I've just realised that this is part of the same package, all that. So there's the overview (the link above), there's
(deprecated) and there
, what you've suggested. So the overview uses
, which is deprecated then, as you've mentioned, they just haven't updated the documentation, right? I'm mislead by that because in the overview
is used differently than in the "Config" section. So
is the only non-deprecated version, if I understand correctly.
yep, thats my understanding as well. they just need to update example wherever its being generated from
Do you happen to know how I could generate an actual cloud-init file from this? I need this as a proxmox snippet and there's no other way than having the file as such. You can't do it through the Proxmox API.
sorry, i haven't used proxmox before and i don't have a definite answer for you. but, can you talk a little more about your use-case? You could create a file and write the rendered config output from getConfig to it. though that might be too oversimplified depending on where you're running pulumi and where you need the file to go
Thanks, I have it, it took a while to understand how I could test it as such. I tried testing it python cli, but it doesn't work that way (because of async, await, future and all sorts of stuff 😄 ). Testing it with
pulumi up
did work, and yes,
seems to be outputting what I want. I just need to create a file out of that.
awesome! glad to hear you got it working 🙌