Is it possible to create resource exactly once and then ignore any changes to any properties to that resource?

Hello,

I have resource of type azurerm_virtual_machine_extension, I need to create this resource once, pass some parameters to it but never check on it again and create another resource of the same type which needs to be tracked for state. The reason why I have to do that is because Azure VM allows to use only once any type of VM extensions and I need to execute DSC type extensions, 2 times where first time as long as successfull does not need to be tracked anymore.

Unfortunately is not possible yet, but the resource have few properties. I recommend to add then, and control the provider version for upgrades:

\

Well after fiddlind around with it for a day I found something which actually works. I documented it on blog but essentially it consists of first resource with lifecycle configured to ignore all changes, second resource which deletes first resource and then new resource being created with the same name as first one.

1 Like

What the purpose of the second resource when you apply the code?

It’s the same resource type as first one but have different settings in it and you can not have 2 of the same resource types in Azure VM

1 Like