import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages a VM replicated using Azure Site Recovery (Azure to Azure only). A replicated VM keeps a copiously updated image of the VM in another region in order to be able to start the VM in that region in case of a disaster. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const primary = new azure.core.ResourceGroup("primary", { * name: "tfex-replicated-vm-primary", * location: "West US", * }); * const secondary = new azure.core.ResourceGroup("secondary", { * name: "tfex-replicated-vm-secondary", * location: "East US", * }); * const primaryVirtualNetwork = new azure.network.VirtualNetwork("primary", { * name: "network1", * resourceGroupName: primary.name, * addressSpaces: ["192.168.1.0/24"], * location: primary.location, * }); * const primarySubnet = new azure.network.Subnet("primary", { * name: "network1-subnet", * resourceGroupName: primary.name, * virtualNetworkName: primaryVirtualNetwork.name, * addressPrefixes: ["192.168.1.0/24"], * }); * const primaryPublicIp = new azure.network.PublicIp("primary", { * name: "vm-public-ip-primary", * allocationMethod: "Static", * location: primary.location, * resourceGroupName: primary.name, * sku: "Basic", * }); * const vmNetworkInterface = new azure.network.NetworkInterface("vm", { * name: "vm-nic", * location: primary.location, * resourceGroupName: primary.name, * ipConfigurations: [{ * name: "vm", * subnetId: primarySubnet.id, * privateIpAddressAllocation: "Dynamic", * publicIpAddressId: primaryPublicIp.id, * }], * }); * const vm = new azure.compute.VirtualMachine("vm", { * name: "vm", * location: primary.location, * resourceGroupName: primary.name, * vmSize: "Standard_B1s", * networkInterfaceIds: [vmNetworkInterface.id], * storageImageReference: { * publisher: "Canonical", * offer: "0001-com-ubuntu-server-jammy", * sku: "22_04-lts", * version: "latest", * }, * storageOsDisk: { * name: "vm-os-disk", * osType: "Linux", * caching: "ReadWrite", * createOption: "FromImage", * managedDiskType: "Premium_LRS", * }, * osProfile: { * adminUsername: "test-admin-123", * adminPassword: "test-pwd-123", * computerName: "vm", * }, * osProfileLinuxConfig: { * disablePasswordAuthentication: false, * }, * }); * const vault = new azure.recoveryservices.Vault("vault", { * name: "example-recovery-vault", * location: secondary.location, * resourceGroupName: secondary.name, * sku: "Standard", * }); * const primaryFabric = new azure.siterecovery.Fabric("primary", { * name: "primary-fabric", * resourceGroupName: secondary.name, * recoveryVaultName: vault.name, * location: primary.location, * }); * const secondaryFabric = new azure.siterecovery.Fabric("secondary", { * name: "secondary-fabric", * resourceGroupName: secondary.name, * recoveryVaultName: vault.name, * location: secondary.location, * }); * const primaryProtectionContainer = new azure.siterecovery.ProtectionContainer("primary", { * name: "primary-protection-container", * resourceGroupName: secondary.name, * recoveryVaultName: vault.name, * recoveryFabricName: primaryFabric.name, * }); * const secondaryProtectionContainer = new azure.siterecovery.ProtectionContainer("secondary", { * name: "secondary-protection-container", * resourceGroupName: secondary.name, * recoveryVaultName: vault.name, * recoveryFabricName: secondaryFabric.name, * }); * const policy = new azure.siterecovery.ReplicationPolicy("policy", { * name: "policy", * resourceGroupName: secondary.name, * recoveryVaultName: vault.name, * recoveryPointRetentionInMinutes: 24 * 60, * applicationConsistentSnapshotFrequencyInMinutes: 4 * 60, * }); * const container_mapping = new azure.siterecovery.ProtectionContainerMapping("container-mapping", { * name: "container-mapping", * resourceGroupName: secondary.name, * recoveryVaultName: vault.name, * recoveryFabricName: primaryFabric.name, * recoverySourceProtectionContainerName: primaryProtectionContainer.name, * recoveryTargetProtectionContainerId: secondaryProtectionContainer.id, * recoveryReplicationPolicyId: policy.id, * }); * const secondaryVirtualNetwork = new azure.network.VirtualNetwork("secondary", { * name: "network2", * resourceGroupName: secondary.name, * addressSpaces: ["192.168.2.0/24"], * location: secondary.location, * }); * const network_mapping = new azure.siterecovery.NetworkMapping("network-mapping", { * name: "network-mapping", * resourceGroupName: secondary.name, * recoveryVaultName: vault.name, * sourceRecoveryFabricName: primaryFabric.name, * targetRecoveryFabricName: secondaryFabric.name, * sourceNetworkId: primaryVirtualNetwork.id, * targetNetworkId: secondaryVirtualNetwork.id, * }); * const primaryAccount = new azure.storage.Account("primary", { * name: "primaryrecoverycache", * location: primary.location, * resourceGroupName: primary.name, * accountTier: "Standard", * accountReplicationType: "LRS", * }); * const secondarySubnet = new azure.network.Subnet("secondary", { * name: "network2-subnet", * resourceGroupName: secondary.name, * virtualNetworkName: secondaryVirtualNetwork.name, * addressPrefixes: ["192.168.2.0/24"], * }); * const secondaryPublicIp = new azure.network.PublicIp("secondary", { * name: "vm-public-ip-secondary", * allocationMethod: "Static", * location: secondary.location, * resourceGroupName: secondary.name, * sku: "Basic", * }); * const vm_replication = new azure.siterecovery.ReplicatedVM("vm-replication", { * name: "vm-replication", * resourceGroupName: secondary.name, * recoveryVaultName: vault.name, * sourceRecoveryFabricName: primaryFabric.name, * sourceVmId: vm.id, * recoveryReplicationPolicyId: policy.id, * sourceRecoveryProtectionContainerName: primaryProtectionContainer.name, * targetResourceGroupId: secondary.id, * targetRecoveryFabricId: secondaryFabric.id, * targetRecoveryProtectionContainerId: secondaryProtectionContainer.id, * managedDisks: [{ * diskId: vm.storageOsDisk.apply(storageOsDisk => storageOsDisk.managedDiskId), * stagingStorageAccountId: primaryAccount.id, * targetResourceGroupId: secondary.id, * targetDiskType: "Premium_LRS", * targetReplicaDiskType: "Premium_LRS", * }], * networkInterfaces: [{ * sourceNetworkInterfaceId: vmNetworkInterface.id, * targetSubnetName: secondarySubnet.name, * recoveryPublicIpAddressId: secondaryPublicIp.id, * }], * }, { * dependsOn: [ * container_mapping, * network_mapping, * ], * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.RecoveryServices` - 2024-04-01 * * ## Import * * Site Recovery Replicated VM's can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:siterecovery/replicatedVM:ReplicatedVM vmreplication /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationFabrics/fabric-name/replicationProtectionContainers/protection-container-name/replicationProtectedItems/vm-replication-name * ``` */ export declare class ReplicatedVM extends pulumi.CustomResource { /** * Get an existing ReplicatedVM resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: ReplicatedVMState, opts?: pulumi.CustomResourceOptions): ReplicatedVM; /** * Returns true if the given object is an instance of ReplicatedVM. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is ReplicatedVM; /** * One or more `managedDisk` block as defined below. Changing this forces a new resource to be created. */ readonly managedDisks: pulumi.Output; /** * Name of group in which all machines will replicate together and have shared crash consistent and app-consistent recovery points when failed over. */ readonly multiVmGroupName: pulumi.Output; /** * The name of the replication for the replicated VM. Changing this forces a new resource to be created. */ readonly name: pulumi.Output; /** * One or more `networkInterface` block as defined below. */ readonly networkInterfaces: pulumi.Output; /** * Id of the policy to use for this replicated vm. Changing this forces a new resource to be created. */ readonly recoveryReplicationPolicyId: pulumi.Output; /** * The name of the vault that should be updated. Changing this forces a new resource to be created. */ readonly recoveryVaultName: pulumi.Output; /** * Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created. */ readonly resourceGroupName: pulumi.Output; /** * Name of fabric that should contain this replication. Changing this forces a new resource to be created. */ readonly sourceRecoveryFabricName: pulumi.Output; /** * Name of the protection container to use. Changing this forces a new resource to be created. */ readonly sourceRecoveryProtectionContainerName: pulumi.Output; /** * Id of the VM to replicate Changing this forces a new resource to be created. */ readonly sourceVmId: pulumi.Output; /** * Id of availability set that the new VM should belong to when a failover is done. */ readonly targetAvailabilitySetId: pulumi.Output; /** * Id of the storage account which the new VM should used for boot diagnostic when a failover is done. */ readonly targetBootDiagnosticStorageAccountId: pulumi.Output; /** * Id of the Capacity reservation group where the new VM should belong to when a failover is done. */ readonly targetCapacityReservationGroupId: pulumi.Output; /** * Specifies the Edge Zone within the Azure Region where this Managed Kubernetes Cluster should exist. Changing this forces a new resource to be created. */ readonly targetEdgeZone: pulumi.Output; /** * Network to use when a failover is done (recommended to set if any networkInterface is configured for failover). */ readonly targetNetworkId: pulumi.Output; /** * Id of Proximity Placement Group the new VM should belong to when a failover is done. */ readonly targetProximityPlacementGroupId: pulumi.Output; /** * Id of fabric where the VM replication should be handled when a failover is done. Changing this forces a new resource to be created. */ readonly targetRecoveryFabricId: pulumi.Output; /** * Id of protection container where the VM replication should be created when a failover is done. Changing this forces a new resource to be created. */ readonly targetRecoveryProtectionContainerId: pulumi.Output; /** * Id of resource group where the VM should be created when a failover is done. Changing this forces a new resource to be created. */ readonly targetResourceGroupId: pulumi.Output; /** * Id of the Virtual Machine Scale Set which the new Vm should belong to when a failover is done. */ readonly targetVirtualMachineScaleSetId: pulumi.Output; /** * Specifies the size the Virtual Machine should have. */ readonly targetVirtualMachineSize: pulumi.Output; /** * Specifies the Availability Zone where the Failover VM should exist. Changing this forces a new resource to be created. */ readonly targetZone: pulumi.Output; /** * Network to use when a test failover is done. */ readonly testNetworkId: pulumi.Output; /** * One or more `unmanagedDisk` block as defined below. Changing this forces a new resource to be created. */ readonly unmanagedDisks: pulumi.Output; /** * Create a ReplicatedVM resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: ReplicatedVMArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering ReplicatedVM resources. */ export interface ReplicatedVMState { /** * One or more `managedDisk` block as defined below. Changing this forces a new resource to be created. */ managedDisks?: pulumi.Input[]>; /** * Name of group in which all machines will replicate together and have shared crash consistent and app-consistent recovery points when failed over. */ multiVmGroupName?: pulumi.Input; /** * The name of the replication for the replicated VM. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * One or more `networkInterface` block as defined below. */ networkInterfaces?: pulumi.Input[]>; /** * Id of the policy to use for this replicated vm. Changing this forces a new resource to be created. */ recoveryReplicationPolicyId?: pulumi.Input; /** * The name of the vault that should be updated. Changing this forces a new resource to be created. */ recoveryVaultName?: pulumi.Input; /** * Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created. */ resourceGroupName?: pulumi.Input; /** * Name of fabric that should contain this replication. Changing this forces a new resource to be created. */ sourceRecoveryFabricName?: pulumi.Input; /** * Name of the protection container to use. Changing this forces a new resource to be created. */ sourceRecoveryProtectionContainerName?: pulumi.Input; /** * Id of the VM to replicate Changing this forces a new resource to be created. */ sourceVmId?: pulumi.Input; /** * Id of availability set that the new VM should belong to when a failover is done. */ targetAvailabilitySetId?: pulumi.Input; /** * Id of the storage account which the new VM should used for boot diagnostic when a failover is done. */ targetBootDiagnosticStorageAccountId?: pulumi.Input; /** * Id of the Capacity reservation group where the new VM should belong to when a failover is done. */ targetCapacityReservationGroupId?: pulumi.Input; /** * Specifies the Edge Zone within the Azure Region where this Managed Kubernetes Cluster should exist. Changing this forces a new resource to be created. */ targetEdgeZone?: pulumi.Input; /** * Network to use when a failover is done (recommended to set if any networkInterface is configured for failover). */ targetNetworkId?: pulumi.Input; /** * Id of Proximity Placement Group the new VM should belong to when a failover is done. */ targetProximityPlacementGroupId?: pulumi.Input; /** * Id of fabric where the VM replication should be handled when a failover is done. Changing this forces a new resource to be created. */ targetRecoveryFabricId?: pulumi.Input; /** * Id of protection container where the VM replication should be created when a failover is done. Changing this forces a new resource to be created. */ targetRecoveryProtectionContainerId?: pulumi.Input; /** * Id of resource group where the VM should be created when a failover is done. Changing this forces a new resource to be created. */ targetResourceGroupId?: pulumi.Input; /** * Id of the Virtual Machine Scale Set which the new Vm should belong to when a failover is done. */ targetVirtualMachineScaleSetId?: pulumi.Input; /** * Specifies the size the Virtual Machine should have. */ targetVirtualMachineSize?: pulumi.Input; /** * Specifies the Availability Zone where the Failover VM should exist. Changing this forces a new resource to be created. */ targetZone?: pulumi.Input; /** * Network to use when a test failover is done. */ testNetworkId?: pulumi.Input; /** * One or more `unmanagedDisk` block as defined below. Changing this forces a new resource to be created. */ unmanagedDisks?: pulumi.Input[]>; } /** * The set of arguments for constructing a ReplicatedVM resource. */ export interface ReplicatedVMArgs { /** * One or more `managedDisk` block as defined below. Changing this forces a new resource to be created. */ managedDisks?: pulumi.Input[]>; /** * Name of group in which all machines will replicate together and have shared crash consistent and app-consistent recovery points when failed over. */ multiVmGroupName?: pulumi.Input; /** * The name of the replication for the replicated VM. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * One or more `networkInterface` block as defined below. */ networkInterfaces?: pulumi.Input[]>; /** * Id of the policy to use for this replicated vm. Changing this forces a new resource to be created. */ recoveryReplicationPolicyId: pulumi.Input; /** * The name of the vault that should be updated. Changing this forces a new resource to be created. */ recoveryVaultName: pulumi.Input; /** * Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created. */ resourceGroupName: pulumi.Input; /** * Name of fabric that should contain this replication. Changing this forces a new resource to be created. */ sourceRecoveryFabricName: pulumi.Input; /** * Name of the protection container to use. Changing this forces a new resource to be created. */ sourceRecoveryProtectionContainerName: pulumi.Input; /** * Id of the VM to replicate Changing this forces a new resource to be created. */ sourceVmId: pulumi.Input; /** * Id of availability set that the new VM should belong to when a failover is done. */ targetAvailabilitySetId?: pulumi.Input; /** * Id of the storage account which the new VM should used for boot diagnostic when a failover is done. */ targetBootDiagnosticStorageAccountId?: pulumi.Input; /** * Id of the Capacity reservation group where the new VM should belong to when a failover is done. */ targetCapacityReservationGroupId?: pulumi.Input; /** * Specifies the Edge Zone within the Azure Region where this Managed Kubernetes Cluster should exist. Changing this forces a new resource to be created. */ targetEdgeZone?: pulumi.Input; /** * Network to use when a failover is done (recommended to set if any networkInterface is configured for failover). */ targetNetworkId?: pulumi.Input; /** * Id of Proximity Placement Group the new VM should belong to when a failover is done. */ targetProximityPlacementGroupId?: pulumi.Input; /** * Id of fabric where the VM replication should be handled when a failover is done. Changing this forces a new resource to be created. */ targetRecoveryFabricId: pulumi.Input; /** * Id of protection container where the VM replication should be created when a failover is done. Changing this forces a new resource to be created. */ targetRecoveryProtectionContainerId: pulumi.Input; /** * Id of resource group where the VM should be created when a failover is done. Changing this forces a new resource to be created. */ targetResourceGroupId: pulumi.Input; /** * Id of the Virtual Machine Scale Set which the new Vm should belong to when a failover is done. */ targetVirtualMachineScaleSetId?: pulumi.Input; /** * Specifies the size the Virtual Machine should have. */ targetVirtualMachineSize?: pulumi.Input; /** * Specifies the Availability Zone where the Failover VM should exist. Changing this forces a new resource to be created. */ targetZone?: pulumi.Input; /** * Network to use when a test failover is done. */ testNetworkId?: pulumi.Input; /** * One or more `unmanagedDisk` block as defined below. Changing this forces a new resource to be created. */ unmanagedDisks?: pulumi.Input[]>; }