All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.mssql.kotlin.ManagedInstanceFailoverGroup.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.mssql.kotlin

import com.pulumi.azure.mssql.kotlin.outputs.ManagedInstanceFailoverGroupPartnerRegion
import com.pulumi.azure.mssql.kotlin.outputs.ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.azure.mssql.kotlin.outputs.ManagedInstanceFailoverGroupPartnerRegion.Companion.toKotlin as managedInstanceFailoverGroupPartnerRegionToKotlin
import com.pulumi.azure.mssql.kotlin.outputs.ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy.Companion.toKotlin as managedInstanceFailoverGroupReadWriteEndpointFailoverPolicyToKotlin

/**
 * Builder for [ManagedInstanceFailoverGroup].
 */
@PulumiTagMarker
public class ManagedInstanceFailoverGroupResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ManagedInstanceFailoverGroupArgs = ManagedInstanceFailoverGroupArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend ManagedInstanceFailoverGroupArgsBuilder.() -> Unit) {
        val builder = ManagedInstanceFailoverGroupArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): ManagedInstanceFailoverGroup {
        val builtJavaResource =
            com.pulumi.azure.mssql.ManagedInstanceFailoverGroup(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return ManagedInstanceFailoverGroup(builtJavaResource)
    }
}

/**
 * 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 example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "example",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     addressSpaces: ["10.0.0.0/16"],
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.2.0/24"],
 * });
 * const exampleNetworkSecurityGroup = new azure.network.NetworkSecurityGroup("example", {
 *     name: "example",
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleSubnetNetworkSecurityGroupAssociation = new azure.network.SubnetNetworkSecurityGroupAssociation("example", {
 *     subnetId: exampleSubnet.id,
 *     networkSecurityGroupId: exampleNetworkSecurityGroup.id,
 * });
 * const exampleRouteTable = new azure.network.RouteTable("example", {
 *     name: "example",
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleSubnetRouteTableAssociation = new azure.network.SubnetRouteTableAssociation("example", {
 *     subnetId: exampleSubnet.id,
 *     routeTableId: exampleRouteTable.id,
 * });
 * const primary = new azure.mssql.ManagedInstance("primary", {
 *     name: "example-primary",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     administratorLogin: "mradministrator",
 *     administratorLoginPassword: "thisIsDog11",
 *     licenseType: "BasePrice",
 *     subnetId: exampleSubnet.id,
 *     skuName: "GP_Gen5",
 *     vcores: 4,
 *     storageSizeInGb: 32,
 *     tags: {
 *         environment: "prod",
 *     },
 * }, {
 *     dependsOn: [
 *         exampleSubnetNetworkSecurityGroupAssociation,
 *         exampleSubnetRouteTableAssociation,
 *     ],
 * });
 * const secondary = new azure.mssql.ManagedInstance("secondary", {
 *     name: "example-secondary",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     administratorLogin: "mradministrator",
 *     administratorLoginPassword: "thisIsDog11",
 *     licenseType: "BasePrice",
 *     subnetId: exampleSubnet.id,
 *     skuName: "GP_Gen5",
 *     vcores: 4,
 *     storageSizeInGb: 32,
 *     tags: {
 *         environment: "prod",
 *     },
 * }, {
 *     dependsOn: [
 *         exampleSubnetNetworkSecurityGroupAssociation,
 *         exampleSubnetRouteTableAssociation,
 *     ],
 * });
 * const exampleManagedInstanceFailoverGroup = new azure.mssql.ManagedInstanceFailoverGroup("example", {
 *     name: "example-failover-group",
 *     location: primary.location,
 *     managedInstanceId: primary.id,
 *     partnerManagedInstanceId: secondary.id,
 *     readWriteEndpointFailoverPolicy: {
 *         mode: "Automatic",
 *         graceMinutes: 60,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_virtual_network = azure.network.VirtualNetwork("example",
 *     name="example",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     address_spaces=["10.0.0.0/16"])
 * example_subnet = azure.network.Subnet("example",
 *     name="example",
 *     resource_group_name=example.name,
 *     virtual_network_name=example_virtual_network.name,
 *     address_prefixes=["10.0.2.0/24"])
 * example_network_security_group = azure.network.NetworkSecurityGroup("example",
 *     name="example",
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_subnet_network_security_group_association = azure.network.SubnetNetworkSecurityGroupAssociation("example",
 *     subnet_id=example_subnet.id,
 *     network_security_group_id=example_network_security_group.id)
 * example_route_table = azure.network.RouteTable("example",
 *     name="example",
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_subnet_route_table_association = azure.network.SubnetRouteTableAssociation("example",
 *     subnet_id=example_subnet.id,
 *     route_table_id=example_route_table.id)
 * primary = azure.mssql.ManagedInstance("primary",
 *     name="example-primary",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     administrator_login="mradministrator",
 *     administrator_login_password="thisIsDog11",
 *     license_type="BasePrice",
 *     subnet_id=example_subnet.id,
 *     sku_name="GP_Gen5",
 *     vcores=4,
 *     storage_size_in_gb=32,
 *     tags={
 *         "environment": "prod",
 *     },
 *     opts = pulumi.ResourceOptions(depends_on=[
 *             example_subnet_network_security_group_association,
 *             example_subnet_route_table_association,
 *         ]))
 * secondary = azure.mssql.ManagedInstance("secondary",
 *     name="example-secondary",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     administrator_login="mradministrator",
 *     administrator_login_password="thisIsDog11",
 *     license_type="BasePrice",
 *     subnet_id=example_subnet.id,
 *     sku_name="GP_Gen5",
 *     vcores=4,
 *     storage_size_in_gb=32,
 *     tags={
 *         "environment": "prod",
 *     },
 *     opts = pulumi.ResourceOptions(depends_on=[
 *             example_subnet_network_security_group_association,
 *             example_subnet_route_table_association,
 *         ]))
 * example_managed_instance_failover_group = azure.mssql.ManagedInstanceFailoverGroup("example",
 *     name="example-failover-group",
 *     location=primary.location,
 *     managed_instance_id=primary.id,
 *     partner_managed_instance_id=secondary.id,
 *     read_write_endpoint_failover_policy={
 *         "mode": "Automatic",
 *         "grace_minutes": 60,
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
 *     {
 *         Name = "example",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AddressSpaces = new[]
 *         {
 *             "10.0.0.0/16",
 *         },
 *     });
 *     var exampleSubnet = new Azure.Network.Subnet("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = example.Name,
 *         VirtualNetworkName = exampleVirtualNetwork.Name,
 *         AddressPrefixes = new[]
 *         {
 *             "10.0.2.0/24",
 *         },
 *     });
 *     var exampleNetworkSecurityGroup = new Azure.Network.NetworkSecurityGroup("example", new()
 *     {
 *         Name = "example",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleSubnetNetworkSecurityGroupAssociation = new Azure.Network.SubnetNetworkSecurityGroupAssociation("example", new()
 *     {
 *         SubnetId = exampleSubnet.Id,
 *         NetworkSecurityGroupId = exampleNetworkSecurityGroup.Id,
 *     });
 *     var exampleRouteTable = new Azure.Network.RouteTable("example", new()
 *     {
 *         Name = "example",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleSubnetRouteTableAssociation = new Azure.Network.SubnetRouteTableAssociation("example", new()
 *     {
 *         SubnetId = exampleSubnet.Id,
 *         RouteTableId = exampleRouteTable.Id,
 *     });
 *     var primary = new Azure.MSSql.ManagedInstance("primary", new()
 *     {
 *         Name = "example-primary",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AdministratorLogin = "mradministrator",
 *         AdministratorLoginPassword = "thisIsDog11",
 *         LicenseType = "BasePrice",
 *         SubnetId = exampleSubnet.Id,
 *         SkuName = "GP_Gen5",
 *         Vcores = 4,
 *         StorageSizeInGb = 32,
 *         Tags =
 *         {
 *             { "environment", "prod" },
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             exampleSubnetNetworkSecurityGroupAssociation,
 *             exampleSubnetRouteTableAssociation,
 *         },
 *     });
 *     var secondary = new Azure.MSSql.ManagedInstance("secondary", new()
 *     {
 *         Name = "example-secondary",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AdministratorLogin = "mradministrator",
 *         AdministratorLoginPassword = "thisIsDog11",
 *         LicenseType = "BasePrice",
 *         SubnetId = exampleSubnet.Id,
 *         SkuName = "GP_Gen5",
 *         Vcores = 4,
 *         StorageSizeInGb = 32,
 *         Tags =
 *         {
 *             { "environment", "prod" },
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             exampleSubnetNetworkSecurityGroupAssociation,
 *             exampleSubnetRouteTableAssociation,
 *         },
 *     });
 *     var exampleManagedInstanceFailoverGroup = new Azure.MSSql.ManagedInstanceFailoverGroup("example", new()
 *     {
 *         Name = "example-failover-group",
 *         Location = primary.Location,
 *         ManagedInstanceId = primary.Id,
 *         PartnerManagedInstanceId = secondary.Id,
 *         ReadWriteEndpointFailoverPolicy = new Azure.MSSql.Inputs.ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs
 *         {
 *             Mode = "Automatic",
 *             GraceMinutes = 60,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mssql"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
 * 			Name:              pulumi.String("example"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.0.0/16"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
 * 			Name:               pulumi.String("example"),
 * 			ResourceGroupName:  example.Name,
 * 			VirtualNetworkName: exampleVirtualNetwork.Name,
 * 			AddressPrefixes: pulumi.StringArray{
 * 				pulumi.String("10.0.2.0/24"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleNetworkSecurityGroup, err := network.NewNetworkSecurityGroup(ctx, "example", &network.NetworkSecurityGroupArgs{
 * 			Name:              pulumi.String("example"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSubnetNetworkSecurityGroupAssociation, err := network.NewSubnetNetworkSecurityGroupAssociation(ctx, "example", &network.SubnetNetworkSecurityGroupAssociationArgs{
 * 			SubnetId:               exampleSubnet.ID(),
 * 			NetworkSecurityGroupId: exampleNetworkSecurityGroup.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleRouteTable, err := network.NewRouteTable(ctx, "example", &network.RouteTableArgs{
 * 			Name:              pulumi.String("example"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSubnetRouteTableAssociation, err := network.NewSubnetRouteTableAssociation(ctx, "example", &network.SubnetRouteTableAssociationArgs{
 * 			SubnetId:     exampleSubnet.ID(),
 * 			RouteTableId: exampleRouteTable.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		primary, err := mssql.NewManagedInstance(ctx, "primary", &mssql.ManagedInstanceArgs{
 * 			Name:                       pulumi.String("example-primary"),
 * 			ResourceGroupName:          example.Name,
 * 			Location:                   example.Location,
 * 			AdministratorLogin:         pulumi.String("mradministrator"),
 * 			AdministratorLoginPassword: pulumi.String("thisIsDog11"),
 * 			LicenseType:                pulumi.String("BasePrice"),
 * 			SubnetId:                   exampleSubnet.ID(),
 * 			SkuName:                    pulumi.String("GP_Gen5"),
 * 			Vcores:                     pulumi.Int(4),
 * 			StorageSizeInGb:            pulumi.Int(32),
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("prod"),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			exampleSubnetNetworkSecurityGroupAssociation,
 * 			exampleSubnetRouteTableAssociation,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		secondary, err := mssql.NewManagedInstance(ctx, "secondary", &mssql.ManagedInstanceArgs{
 * 			Name:                       pulumi.String("example-secondary"),
 * 			ResourceGroupName:          example.Name,
 * 			Location:                   example.Location,
 * 			AdministratorLogin:         pulumi.String("mradministrator"),
 * 			AdministratorLoginPassword: pulumi.String("thisIsDog11"),
 * 			LicenseType:                pulumi.String("BasePrice"),
 * 			SubnetId:                   exampleSubnet.ID(),
 * 			SkuName:                    pulumi.String("GP_Gen5"),
 * 			Vcores:                     pulumi.Int(4),
 * 			StorageSizeInGb:            pulumi.Int(32),
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("prod"),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			exampleSubnetNetworkSecurityGroupAssociation,
 * 			exampleSubnetRouteTableAssociation,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = mssql.NewManagedInstanceFailoverGroup(ctx, "example", &mssql.ManagedInstanceFailoverGroupArgs{
 * 			Name:                     pulumi.String("example-failover-group"),
 * 			Location:                 primary.Location,
 * 			ManagedInstanceId:        primary.ID(),
 * 			PartnerManagedInstanceId: secondary.ID(),
 * 			ReadWriteEndpointFailoverPolicy: &mssql.ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs{
 * 				Mode:         pulumi.String("Automatic"),
 * 				GraceMinutes: pulumi.Int(60),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.network.VirtualNetwork;
 * import com.pulumi.azure.network.VirtualNetworkArgs;
 * import com.pulumi.azure.network.Subnet;
 * import com.pulumi.azure.network.SubnetArgs;
 * import com.pulumi.azure.network.NetworkSecurityGroup;
 * import com.pulumi.azure.network.NetworkSecurityGroupArgs;
 * import com.pulumi.azure.network.SubnetNetworkSecurityGroupAssociation;
 * import com.pulumi.azure.network.SubnetNetworkSecurityGroupAssociationArgs;
 * import com.pulumi.azure.network.RouteTable;
 * import com.pulumi.azure.network.RouteTableArgs;
 * import com.pulumi.azure.network.SubnetRouteTableAssociation;
 * import com.pulumi.azure.network.SubnetRouteTableAssociationArgs;
 * import com.pulumi.azure.mssql.ManagedInstance;
 * import com.pulumi.azure.mssql.ManagedInstanceArgs;
 * import com.pulumi.azure.mssql.ManagedInstanceFailoverGroup;
 * import com.pulumi.azure.mssql.ManagedInstanceFailoverGroupArgs;
 * import com.pulumi.azure.mssql.inputs.ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .addressSpaces("10.0.0.0/16")
 *             .build());
 *         var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .virtualNetworkName(exampleVirtualNetwork.name())
 *             .addressPrefixes("10.0.2.0/24")
 *             .build());
 *         var exampleNetworkSecurityGroup = new NetworkSecurityGroup("exampleNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleSubnetNetworkSecurityGroupAssociation = new SubnetNetworkSecurityGroupAssociation("exampleSubnetNetworkSecurityGroupAssociation", SubnetNetworkSecurityGroupAssociationArgs.builder()
 *             .subnetId(exampleSubnet.id())
 *             .networkSecurityGroupId(exampleNetworkSecurityGroup.id())
 *             .build());
 *         var exampleRouteTable = new RouteTable("exampleRouteTable", RouteTableArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleSubnetRouteTableAssociation = new SubnetRouteTableAssociation("exampleSubnetRouteTableAssociation", SubnetRouteTableAssociationArgs.builder()
 *             .subnetId(exampleSubnet.id())
 *             .routeTableId(exampleRouteTable.id())
 *             .build());
 *         var primary = new ManagedInstance("primary", ManagedInstanceArgs.builder()
 *             .name("example-primary")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .administratorLogin("mradministrator")
 *             .administratorLoginPassword("thisIsDog11")
 *             .licenseType("BasePrice")
 *             .subnetId(exampleSubnet.id())
 *             .skuName("GP_Gen5")
 *             .vcores(4)
 *             .storageSizeInGb(32)
 *             .tags(Map.of("environment", "prod"))
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(
 *                     exampleSubnetNetworkSecurityGroupAssociation,
 *                     exampleSubnetRouteTableAssociation)
 *                 .build());
 *         var secondary = new ManagedInstance("secondary", ManagedInstanceArgs.builder()
 *             .name("example-secondary")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .administratorLogin("mradministrator")
 *             .administratorLoginPassword("thisIsDog11")
 *             .licenseType("BasePrice")
 *             .subnetId(exampleSubnet.id())
 *             .skuName("GP_Gen5")
 *             .vcores(4)
 *             .storageSizeInGb(32)
 *             .tags(Map.of("environment", "prod"))
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(
 *                     exampleSubnetNetworkSecurityGroupAssociation,
 *                     exampleSubnetRouteTableAssociation)
 *                 .build());
 *         var exampleManagedInstanceFailoverGroup = new ManagedInstanceFailoverGroup("exampleManagedInstanceFailoverGroup", ManagedInstanceFailoverGroupArgs.builder()
 *             .name("example-failover-group")
 *             .location(primary.location())
 *             .managedInstanceId(primary.id())
 *             .partnerManagedInstanceId(secondary.id())
 *             .readWriteEndpointFailoverPolicy(ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs.builder()
 *                 .mode("Automatic")
 *                 .graceMinutes(60)
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleVirtualNetwork:
 *     type: azure:network:VirtualNetwork
 *     name: example
 *     properties:
 *       name: example
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       addressSpaces:
 *         - 10.0.0.0/16
 *   exampleSubnet:
 *     type: azure:network:Subnet
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: ${example.name}
 *       virtualNetworkName: ${exampleVirtualNetwork.name}
 *       addressPrefixes:
 *         - 10.0.2.0/24
 *   exampleNetworkSecurityGroup:
 *     type: azure:network:NetworkSecurityGroup
 *     name: example
 *     properties:
 *       name: example
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   exampleSubnetNetworkSecurityGroupAssociation:
 *     type: azure:network:SubnetNetworkSecurityGroupAssociation
 *     name: example
 *     properties:
 *       subnetId: ${exampleSubnet.id}
 *       networkSecurityGroupId: ${exampleNetworkSecurityGroup.id}
 *   exampleRouteTable:
 *     type: azure:network:RouteTable
 *     name: example
 *     properties:
 *       name: example
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   exampleSubnetRouteTableAssociation:
 *     type: azure:network:SubnetRouteTableAssociation
 *     name: example
 *     properties:
 *       subnetId: ${exampleSubnet.id}
 *       routeTableId: ${exampleRouteTable.id}
 *   primary:
 *     type: azure:mssql:ManagedInstance
 *     properties:
 *       name: example-primary
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       administratorLogin: mradministrator
 *       administratorLoginPassword: thisIsDog11
 *       licenseType: BasePrice
 *       subnetId: ${exampleSubnet.id}
 *       skuName: GP_Gen5
 *       vcores: 4
 *       storageSizeInGb: 32
 *       tags:
 *         environment: prod
 *     options:
 *       dependson:
 *         - ${exampleSubnetNetworkSecurityGroupAssociation}
 *         - ${exampleSubnetRouteTableAssociation}
 *   secondary:
 *     type: azure:mssql:ManagedInstance
 *     properties:
 *       name: example-secondary
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       administratorLogin: mradministrator
 *       administratorLoginPassword: thisIsDog11
 *       licenseType: BasePrice
 *       subnetId: ${exampleSubnet.id}
 *       skuName: GP_Gen5
 *       vcores: 4
 *       storageSizeInGb: 32
 *       tags:
 *         environment: prod
 *     options:
 *       dependson:
 *         - ${exampleSubnetNetworkSecurityGroupAssociation}
 *         - ${exampleSubnetRouteTableAssociation}
 *   exampleManagedInstanceFailoverGroup:
 *     type: azure:mssql:ManagedInstanceFailoverGroup
 *     name: example
 *     properties:
 *       name: example-failover-group
 *       location: ${primary.location}
 *       managedInstanceId: ${primary.id}
 *       partnerManagedInstanceId: ${secondary.id}
 *       readWriteEndpointFailoverPolicy:
 *         mode: Automatic
 *         graceMinutes: 60
 * ```
 * 
 * ## 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
 * ```
 */
public class ManagedInstanceFailoverGroup internal constructor(
    override val javaResource: com.pulumi.azure.mssql.ManagedInstanceFailoverGroup,
) : KotlinCustomResource(javaResource, ManagedInstanceFailoverGroupMapper) {
    /**
     * The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * 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.
     */
    public val managedInstanceId: Output
        get() = javaResource.managedInstanceId().applyValue({ args0 -> args0 })

    /**
     * The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
     */
    public val partnerManagedInstanceId: Output
        get() = javaResource.partnerManagedInstanceId().applyValue({ args0 -> args0 })

    /**
     * A `partner_region` block as defined below.
     */
    public val partnerRegions: Output>
        get() = javaResource.partnerRegions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> managedInstanceFailoverGroupPartnerRegionToKotlin(args0) })
            })
        })

    /**
     * A `read_write_endpoint_failover_policy` block as defined below.
     */
    public val readWriteEndpointFailoverPolicy:
        Output
        get() = javaResource.readWriteEndpointFailoverPolicy().applyValue({ args0 ->
            args0.let({ args0 ->
                managedInstanceFailoverGroupReadWriteEndpointFailoverPolicyToKotlin(args0)
            })
        })

    /**
     * Failover policy for the read-only endpoint. Defaults to `true`.
     */
    public val readonlyEndpointFailoverPolicyEnabled: Output?
        get() = javaResource.readonlyEndpointFailoverPolicyEnabled().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * The partner replication role of the Managed Instance Failover Group.
     */
    public val role: Output
        get() = javaResource.role().applyValue({ args0 -> args0 })
}

public object ManagedInstanceFailoverGroupMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.mssql.ManagedInstanceFailoverGroup::class == javaResource::class

    override fun map(javaResource: Resource): ManagedInstanceFailoverGroup =
        ManagedInstanceFailoverGroup(
            javaResource as
                com.pulumi.azure.mssql.ManagedInstanceFailoverGroup,
        )
}

/**
 * @see [ManagedInstanceFailoverGroup].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [ManagedInstanceFailoverGroup].
 */
public suspend fun managedInstanceFailoverGroup(
    name: String,
    block: suspend ManagedInstanceFailoverGroupResourceBuilder.() -> Unit,
): ManagedInstanceFailoverGroup {
    val builder = ManagedInstanceFailoverGroupResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [ManagedInstanceFailoverGroup].
 * @param name The _unique_ name of the resulting resource.
 */
public fun managedInstanceFailoverGroup(name: String): ManagedInstanceFailoverGroup {
    val builder = ManagedInstanceFailoverGroupResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy