in the old `pulumi-azure-sdk`, there was a `comput...
# golang
d
in the old
pulumi-azure-sdk
, there was a
compute.DataDiskAttachment
method to attach external volumes to *compute.VirtualMachine's... how is this done using the newer
pulumi-azure-native-sdk
? I can't seem to find any method in the docs to attach a *compute.Disk to a *compute.VirtualMachine
s
I haven’t tried this, but it looks like
azure-native.compute.VirtualMachine
has
storageProfiles.dataDisks
that might allow this? https://www.pulumi.com/registry/packages/azure-native/api-docs/compute/virtualmachine/#create-a-platform-image-vm-with-unmanaged-os-and-data-disks
Oh, I see now that example isn’t listed for Golang. One sec, let me try something…
d
ahh ok.. I ended up using the old pulumi-azure sdk alongside the azure-native sdk and mix/matching .. but if I could use pure azure-native that would be 🤌
s
Pulumi AI isn’t perfect, but it suggested using
compute.NewDisk
and
compute.VirtualMachineDataDiskAttachment
to accomplish having an external data disk. You might try that. Here’s a conversation you could look at: https://www.pulumi.com/ai/?convid=b8821605-9600-4986-b49f-f0db3f424880
d
ty!
s
NP
d
did you guys use a ChatGPT embedding on the pulumi codebase for the AI? pretty nifty
s
It’s not perfect (LLMs have their limitations), but it can be quite useful at times
d
@salmon-account-74572 no dice, it turns out the LLM is hallucinating, there isn't a
compute.NewVirtualMachineDataDiskAttachment()
method
s
Haha! See, a prime example of it not being perfect. 🙂
d
it's all good, I think I can use the old terraform based provider for now until that functionality gets ported to azure-native-sdk
s
I asked Pulumi AI to fix the previous program; it came up with this:
Copy code
vm, err := compute.NewVirtualMachine(ctx, "vm", &compute.VirtualMachineArgs{
            ResourceGroupName: resourceGroup.Name,
            StorageProfile: compute.StorageProfileArgs{
                DataDisks: compute.VirtualMachineDataDiskArgsArray{
                    compute.VirtualMachineDataDiskArgs{
                        CreateOption: pulumi.String("Attach"),
                        Lun:          <http://pulumi.Int|pulumi.Int>(0),
                        ManagedDisk: compute.VirtualMachineManagedDiskParametersArgs{
                            Id: dataDisk.ID(),
                        },
                    },
                },
Have you tried
StorageProfile.DataDisks
with a separate
compute.NewDisk
resource?
d
ahh that seems to have worked 🙂
ok so attach the DD's right inside vm definition then.. much obliged @salmon-account-74572!
s
NP, happy to help