import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages an Azure SQL Managed Instance Failover Group. * * ## Example Usage * * > **Note:** For a more complete example, see the `./examples/sql-azure/managed_instance_failover_group` directory within the GitHub Repository. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const name = "mymssqlmitest"; * const primaryName = `${name}-primary`; * const primaryLocation = "West Europe"; * const failoverName = `${name}-failover`; * const failoverLocation = "North Europe"; * //# Primary SQL Managed Instance * const primary = new azure.core.ResourceGroup("primary", { * name: primaryName, * location: primaryLocation, * }); * const exampleZone = new azure.privatedns.Zone("example", { * name: `${name}.private`, * resourceGroupName: primary.name, * }); * const primaryVirtualNetwork = new azure.network.VirtualNetwork("primary", { * name: primaryName, * location: primary.location, * resourceGroupName: primary.name, * addressSpaces: ["10.0.0.0/16"], * }); * const primaryZoneVirtualNetworkLink = new azure.privatedns.ZoneVirtualNetworkLink("primary", { * name: "primary-link", * resourceGroupName: primary.name, * privateDnsZoneName: exampleZone.name, * virtualNetworkId: primaryVirtualNetwork.id, * }); * const primarySubnet = new azure.network.Subnet("primary", { * name: primaryName, * resourceGroupName: primary.name, * virtualNetworkName: primaryVirtualNetwork.name, * addressPrefixes: ["10.0.1.0/24"], * delegations: [{ * name: "delegation", * serviceDelegation: { * actions: [ * "Microsoft.Network/virtualNetworks/subnets/join/action", * "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", * "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action", * ], * name: "Microsoft.Sql/managedInstances", * }, * }], * }); * const primaryNetworkSecurityGroup = new azure.network.NetworkSecurityGroup("primary", { * name: primaryName, * location: primary.location, * resourceGroupName: primary.name, * }); * const primarySubnetNetworkSecurityGroupAssociation = new azure.network.SubnetNetworkSecurityGroupAssociation("primary", { * subnetId: primarySubnet.id, * networkSecurityGroupId: primaryNetworkSecurityGroup.id, * }); * const primaryRouteTable = new azure.network.RouteTable("primary", { * name: primaryName, * location: primary.location, * resourceGroupName: primary.name, * }); * const primarySubnetRouteTableAssociation = new azure.network.SubnetRouteTableAssociation("primary", { * subnetId: primarySubnet.id, * routeTableId: primaryRouteTable.id, * }); * const primaryManagedInstance = new azure.mssql.ManagedInstance("primary", { * name: primaryName, * resourceGroupName: primary.name, * location: primary.location, * administratorLogin: "mradministrator", * administratorLoginPassword: "thisIsDog11", * licenseType: "BasePrice", * subnetId: primarySubnet.id, * skuName: "GP_Gen5", * vcores: 4, * storageSizeInGb: 32, * }, { * dependsOn: [ * primarySubnetNetworkSecurityGroupAssociation, * primarySubnetRouteTableAssociation, * ], * }); * //# Secondary (Fail-over) SQL Managed Instance * const failover = new azure.core.ResourceGroup("failover", { * name: failoverName, * location: failoverLocation, * }); * const failoverVirtualNetwork = new azure.network.VirtualNetwork("failover", { * name: failoverName, * location: failover.location, * resourceGroupName: failover.name, * addressSpaces: ["10.1.0.0/16"], * }); * const failoverZoneVirtualNetworkLink = new azure.privatedns.ZoneVirtualNetworkLink("failover", { * name: "failover-link", * resourceGroupName: exampleZone.resourceGroupName, * privateDnsZoneName: exampleZone.name, * virtualNetworkId: failoverVirtualNetwork.id, * }); * const failoverSubnet = new azure.network.Subnet("failover", { * name: "ManagedInstance", * resourceGroupName: failover.name, * virtualNetworkName: failoverVirtualNetwork.name, * addressPrefixes: ["10.1.1.0/24"], * delegations: [{ * name: "delegation", * serviceDelegation: { * actions: [ * "Microsoft.Network/virtualNetworks/subnets/join/action", * "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", * "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action", * ], * name: "Microsoft.Sql/managedInstances", * }, * }], * }); * const failoverNetworkSecurityGroup = new azure.network.NetworkSecurityGroup("failover", { * name: failoverName, * location: failover.location, * resourceGroupName: failover.name, * }); * const failoverSubnetNetworkSecurityGroupAssociation = new azure.network.SubnetNetworkSecurityGroupAssociation("failover", { * subnetId: failoverSubnet.id, * networkSecurityGroupId: failoverNetworkSecurityGroup.id, * }); * const failoverRouteTable = new azure.network.RouteTable("failover", { * name: failoverName, * location: failover.location, * resourceGroupName: failover.name, * }); * const failoverSubnetRouteTableAssociation = new azure.network.SubnetRouteTableAssociation("failover", { * subnetId: failoverSubnet.id, * routeTableId: failoverRouteTable.id, * }); * const failoverManagedInstance = new azure.mssql.ManagedInstance("failover", { * name: failoverName, * resourceGroupName: failover.name, * location: failover.location, * administratorLogin: "mradministrator", * administratorLoginPassword: "thisIsDog11", * licenseType: "BasePrice", * subnetId: failoverSubnet.id, * skuName: "GP_Gen5", * vcores: 4, * storageSizeInGb: 32, * dnsZonePartnerId: primaryManagedInstance.id, * }, { * dependsOn: [ * failoverSubnetNetworkSecurityGroupAssociation, * failoverSubnetRouteTableAssociation, * ], * }); * const example = new azure.mssql.ManagedInstanceFailoverGroup("example", { * name: "example-failover-group", * location: primaryManagedInstance.location, * managedInstanceId: primaryManagedInstance.id, * partnerManagedInstanceId: failoverManagedInstance.id, * secondaryType: "Geo", * readWriteEndpointFailoverPolicy: { * mode: "Automatic", * graceMinutes: 60, * }, * }, { * dependsOn: [ * primaryZoneVirtualNetworkLink, * failoverZoneVirtualNetworkLink, * ], * }); * const primaryToFailover = new azure.network.VirtualNetworkPeering("primary_to_failover", { * name: "primary-to-failover", * remoteVirtualNetworkId: failoverVirtualNetwork.id, * resourceGroupName: primary.name, * virtualNetworkName: primaryVirtualNetwork.name, * }); * const _default = new azure.network.Subnet("default", { * name: "default", * resourceGroupName: failover.name, * virtualNetworkName: failoverVirtualNetwork.name, * addressPrefixes: ["10.1.0.0/24"], * }); * const failoverToPrimary = new azure.network.VirtualNetworkPeering("failover_to_primary", { * name: "failover-to-primary", * remoteVirtualNetworkId: primaryVirtualNetwork.id, * resourceGroupName: failover.name, * virtualNetworkName: failoverVirtualNetwork.name, * }); * ``` * * > **Note:** There are many prerequisites that must be in place before creating the failover group. To see them all, refer to [Configure a failover group for Azure SQL Managed Instance](https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/failover-group-configure-sql-mi). * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.Sql` - 2023-08-01-preview * * ## Import * * SQL Instance Failover Groups can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:mssql/managedInstanceFailoverGroup:ManagedInstanceFailoverGroup example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Sql/locations/Location/instanceFailoverGroups/failoverGroup1 * ``` */ export declare class ManagedInstanceFailoverGroup extends pulumi.CustomResource { /** * Get an existing ManagedInstanceFailoverGroup 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?: ManagedInstanceFailoverGroupState, opts?: pulumi.CustomResourceOptions): ManagedInstanceFailoverGroup; /** * Returns true if the given object is an instance of ManagedInstanceFailoverGroup. 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 ManagedInstanceFailoverGroup; /** * The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created. */ readonly location: pulumi.Output; /** * The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created. */ readonly managedInstanceId: pulumi.Output; /** * The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created. */ readonly name: pulumi.Output; /** * The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created. */ readonly partnerManagedInstanceId: pulumi.Output; /** * A `partnerRegion` block as defined below. */ readonly partnerRegions: pulumi.Output; /** * A `readWriteEndpointFailoverPolicy` block as defined below. */ readonly readWriteEndpointFailoverPolicy: pulumi.Output; /** * Failover policy for the read-only endpoint. Defaults to `true`. */ readonly readonlyEndpointFailoverPolicyEnabled: pulumi.Output; /** * The partner replication role of the Managed Instance Failover Group. */ readonly role: pulumi.Output; /** * The type of the secondary Managed Instance. Possible values are `Geo`, `Standby`. Defaults to `Geo`. */ readonly secondaryType: pulumi.Output; /** * Create a ManagedInstanceFailoverGroup 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: ManagedInstanceFailoverGroupArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering ManagedInstanceFailoverGroup resources. */ export interface ManagedInstanceFailoverGroupState { /** * The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created. */ managedInstanceId?: pulumi.Input; /** * The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created. */ partnerManagedInstanceId?: pulumi.Input; /** * A `partnerRegion` block as defined below. */ partnerRegions?: pulumi.Input[]>; /** * A `readWriteEndpointFailoverPolicy` block as defined below. */ readWriteEndpointFailoverPolicy?: pulumi.Input; /** * Failover policy for the read-only endpoint. Defaults to `true`. */ readonlyEndpointFailoverPolicyEnabled?: pulumi.Input; /** * The partner replication role of the Managed Instance Failover Group. */ role?: pulumi.Input; /** * The type of the secondary Managed Instance. Possible values are `Geo`, `Standby`. Defaults to `Geo`. */ secondaryType?: pulumi.Input; } /** * The set of arguments for constructing a ManagedInstanceFailoverGroup resource. */ export interface ManagedInstanceFailoverGroupArgs { /** * The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created. */ managedInstanceId: pulumi.Input; /** * The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created. */ partnerManagedInstanceId: pulumi.Input; /** * A `readWriteEndpointFailoverPolicy` block as defined below. */ readWriteEndpointFailoverPolicy: pulumi.Input; /** * Failover policy for the read-only endpoint. Defaults to `true`. */ readonlyEndpointFailoverPolicyEnabled?: pulumi.Input; /** * The type of the secondary Managed Instance. Possible values are `Geo`, `Standby`. Defaults to `Geo`. */ secondaryType?: pulumi.Input; }