Pulumi is not creating the disk space properly. I ...
# typescript
g
Pulumi is not creating the disk space properly. I am using azure native to launch vm with 64 Gb space but its creating 30 GB instead. I have raised the issue in github at: https://github.com/pulumi/pulumi-azure-native/issues/3953. Can anyone help me out.
m
In the example code there, you have a line
Copy code
diskSizeGb: disk_space ? disk_space : 30,
You don't show where
disk_space
comes from, but if this value is not set, it will fall back to 30. So it looks like the "disk_space" input is not wired through correctly. For someone to help you, you'll need to show a (preferably small) complete example that shows where you're entering the desired disk size and how this value flows through your program.
g
@modern-zebra-45309 I realised its
diskSizeGB
not
diskSizeGb
my bad
@modern-zebra-45309 thanks for help, but I am facing with another issue. I created a vm with disk 30 GB attached, now i want to expand it, to 64 GB but its not working. It is creating a new disk instead of expanding. I added more info at: https://github.com/pulumi/pulumi-azure-native/issues/3952 My Code: It says resource already exists when diskName used. (This is given by pulumi copilot). When i remove diskName, its creating new disk instead of expanding. I have stopped vm to expand disk still did not work.
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const resourceGroupName = "myResourceGroup";
const diskName = `${prefix}-${region}-${vmConfig.name}-osdisk-plm`;

// Retrieve the existing disk
const existingDisk = azure_native.compute.getDisk({
    resourceGroupName: resourceGroupName,
    diskName: diskName,
});

// Update the disk size
const updatedDisk = new azure_native.compute.Disk(diskName, {
    resourceGroupName: resourceGroupName,
    diskName: diskName,
    diskSizeGB: 64,
}, { import: existingDisk.id });
m
You should be able to just run the original Pulumi program again with
disk_space
set to the desired size. I suggest you run a
pulumi preview
to check that this is indeed handled as an in-place update, which according to the documentation is the case (https://www.pulumi.com/registry/packages/azure-native/api-docs/compute/virtualmachine/#disksizegb_go)
The code you created looks a lot like an "update script" that you'd run once, which is not something Pulumi supports. Pulumi is an IaC tool that assumes that you have a resource under management in a stack, and you modify and re-run the program you used to create the stack to update and evolve the resources. Perhaps this helps to clear things up a bit.