little-photographer-8552
05/31/2023, 11:53 AMautorest/azure: Service returned an error. Status=<nil> Code="PropertyChangeNotAllowed" Message="Changing property 'imageReference' is not allowed." Target="imageReference"
Now I changed our code and added this snippet:
, new CustomResourceOptions()
{
ReplaceOnChanges = new List<string>() { "imageReference" }
}
So that new our code looks like this:
DnsForwarder = new VirtualMachine($"{NamePrefix}-vm-dns-forwarder",
new VirtualMachineArgs
{
HardwareProfile = new HardwareProfileArgs
{
VmSize = VirtualMachineSizeTypes.Basic_A0
},
Location = PrimaryLocation,
NetworkProfile = new Pulumi.AzureNative.Compute.Inputs.NetworkProfileArgs
{
NetworkInterfaces =
{
new NetworkInterfaceReferenceArgs
{
Id = networkInterface.Id,
},
},
},
OsProfile = new OSProfileArgs
{
AdminPassword = vmAdminPassword.Result,
AdminUsername = "hubdnsvm-admin",
ComputerName = vmName
},
ResourceGroupName = args.ResourceGroupName,
StorageProfile = new StorageProfileArgs
{
ImageReference = new ImageReferenceArgs
{
Offer = "UbuntuServer",
Publisher = "Canonical",
Sku = "20.04-LTS",
Version = "latest",
},
OsDisk = new OSDiskArgs
{
Caching = CachingTypes.ReadWrite,
CreateOption = DiskCreateOptionTypes.FromImage
},
},
VmName = vmName,
Tags = GlobalTags,
AvailabilitySet = new Pulumi.AzureNative.Compute.Inputs.SubResourceArgs
{
Id = availabilitySet.Id
},
}, new CustomResourceOptions()
{
ReplaceOnChanges = new List<string>() { "imageReference" }
}
);
Yet, we keep getting the same error message. Any suggestions here on what we do wrong?fast-vr-6049
05/31/2023, 4:55 PMstorageProfile.imageReference
deleteBeforeReplace
with the same target, as mentioned in the docsclever-sunset-76585
06/01/2023, 4:35 AMdeleteBeforeReplace
, the reason you'll need to use that is, it seems you are setting the VM name explicitly instead of using auto-naming, so you can't have two VMs with the same name. But it means for a moment you won't have any VM running until the new is setup after the original one is deleted. Is there a reason you don't want to use Pulumi's auto-naming feature?little-photographer-8552
06/01/2023, 10:21 AM