``` Do you want to perform this destroy? yes Destr...
# general
c
Copy code
Do you want to perform this destroy? yes
Destroying (dev):

     Type                               Name              Status                  Info
     pulumi:pulumi:Stack                pulumi-vault-dev                          
 -   ├─ azure:network:VirtualNetwork    puluminet         **deleting failed**     error: Plan apply failed: deleting urn:pulumi:dev::pulumi-vault::azure:network/virtualNetwork:VirtualNetwork::
 -   ├─ azure:msi:UserAssignedIdentity  consulmsi         deleted                 
 -   ├─ azure:network:NetworkInterface  vault-nic-0       deleting...             
 -   ├─ azure:network:NetworkInterface  consul-nic-1      deleting...             
 -   ├─ azure:network:NetworkInterface  vault-nic-2       deleting...             
 -   ├─ azure:core:ResourceGroup        vault-cluster-rg  deleting...             
 -   ├─ azure:network:NetworkInterface  vault-nic-1       deleting...             
 -   ├─ azure:msi:UserAssignedIdentity  vaultmsi          deleted                 
 -   ├─ azure:network:Subnet            hcsubnet          deleting...             
 -   ├─ azure:network:NetworkInterface  consul-nic-2      deleting...             
 -   ├─ azure:network:NetworkInterface  consul-nic-3      deleting...             
 -   ├─ azure:network:NetworkInterface  consul-nic-4      deleting...             
 -   └─ azure:network:NetworkInterface  consul-nic-0      deleting...
w
That should not happen if there is a true dependency between these resources. Is it possible you hardcoded in the name of the vnet instead of depending on the output of its name/or?
c
no, not hard-coded. Here is a snippet
Copy code
virtualNetwork, err := network.NewVirtualNetwork(ctx, vnetName, &network.VirtualNetworkArgs{
	Name:              vnetName,
	Location:          location,
	ResourceGroupName: resourceGroup.Name(),
	AddressSpaces:     VnetAddressSpaces,
})
if err != nil {
	return err
}

// Create hashicorp subnet
vaultSubnet, err := network.NewSubnet(ctx, HcSubnetName, &network.SubnetArgs{
	Name:               HcSubnetName,
	ResourceGroupName:  resourceGroup.Name(),
	VirtualNetworkName: virtualNetwork.Name(),
	AddressPrefix:      HcSubnetAddressSpaces,
})

// Create NICs for consul VMs
var consulcount [5]int
var consulNicobjects []interface{}
for i := range consulcount {
	consulnicename := fmt.Sprintf("consul-nic-%d", i)
	ipConfig := map[string]interface{}{
		"subnet_id":                     vaultSubnet.ID(),
		"name":                          fmt.Sprintf("consul-nic-ipc-%d", i),
		"private_ip_address_allocation": "Dynamic",
	}
	consulNic, err := network.NewNetworkInterface(ctx, consulnicename, &network.NetworkInterfaceArgs{
		Name:              consulnicename,
		ResourceGroupName: resourceGroup.Name(),
		Location:          location,
		IpConfigurations:  []interface{}{ipConfig},
	})
	if err != nil {
		return err
	}
	consulNicobjects := append(consulNicobjects, consulNic.ID())
	fmt.Println(consulNicobjects)
	ctx.Export("nic-name", consulNic.Name())
	ctx.Export("nic-Id", consulNic.ID())

}