Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.sql.kotlin.ManagedInstanceFailoverGroup.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.sql.kotlin
import com.pulumi.azure.sql.kotlin.outputs.ManagedInstanceFailoverGroupPartnerRegion
import com.pulumi.azure.sql.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.sql.kotlin.outputs.ManagedInstanceFailoverGroupPartnerRegion.Companion.toKotlin as managedInstanceFailoverGroupPartnerRegionToKotlin
import com.pulumi.azure.sql.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.sql.ManagedInstanceFailoverGroup(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ManagedInstanceFailoverGroup(builtJavaResource)
}
}
/**
* Manages a SQL Instance Failover Group.
* ## Example Usage
* > **Note:** The `azure.sql.ManagedInstanceFailoverGroup` resource is deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use the `azure.mssql.ManagedInstanceFailoverGroup` resource instead.
* > **Note:** For a more complete example, see the 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: "rg-example",
* location: "West Europe",
* });
* const primary = new azure.sql.ManagedInstance("primary", {
* name: "example-primary",
* resourceGroupName: primaryAzurermResourceGroup.name,
* location: primaryAzurermResourceGroup.location,
* administratorLogin: "mradministrator",
* administratorLoginPassword: "thisIsDog11",
* licenseType: "BasePrice",
* subnetId: primaryAzurermSubnet.id,
* skuName: "GP_Gen5",
* vcores: 4,
* storageSizeInGb: 32,
* tags: {
* environment: "prod",
* },
* }, {
* dependsOn: [
* primaryAzurermSubnetNetworkSecurityGroupAssociation,
* primaryAzurermSubnetRouteTableAssociation,
* ],
* });
* const secondary = new azure.sql.ManagedInstance("secondary", {
* name: "example-secondary",
* resourceGroupName: secondaryAzurermResourceGroup.name,
* location: secondaryAzurermResourceGroup.location,
* administratorLogin: "mradministrator",
* administratorLoginPassword: "thisIsDog11",
* licenseType: "BasePrice",
* subnetId: secondaryAzurermSubnet.id,
* skuName: "GP_Gen5",
* vcores: 4,
* storageSizeInGb: 32,
* tags: {
* environment: "prod",
* },
* }, {
* dependsOn: [
* secondaryAzurermSubnetNetworkSecurityGroupAssociation,
* secondaryAzurermSubnetRouteTableAssociation,
* ],
* });
* const exampleManagedInstanceFailoverGroup = new azure.sql.ManagedInstanceFailoverGroup("example", {
* name: "example-failover-group",
* resourceGroupName: primaryAzurermResourceGroup.name,
* location: primary.location,
* managedInstanceName: primary.name,
* partnerManagedInstanceId: secondary.id,
* readWriteEndpointFailoverPolicy: {
* mode: "Automatic",
* graceMinutes: 60,
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="rg-example",
* location="West Europe")
* primary = azure.sql.ManagedInstance("primary",
* name="example-primary",
* resource_group_name=primary_azurerm_resource_group["name"],
* location=primary_azurerm_resource_group["location"],
* administrator_login="mradministrator",
* administrator_login_password="thisIsDog11",
* license_type="BasePrice",
* subnet_id=primary_azurerm_subnet["id"],
* sku_name="GP_Gen5",
* vcores=4,
* storage_size_in_gb=32,
* tags={
* "environment": "prod",
* },
* opts = pulumi.ResourceOptions(depends_on=[
* primary_azurerm_subnet_network_security_group_association,
* primary_azurerm_subnet_route_table_association,
* ]))
* secondary = azure.sql.ManagedInstance("secondary",
* name="example-secondary",
* resource_group_name=secondary_azurerm_resource_group["name"],
* location=secondary_azurerm_resource_group["location"],
* administrator_login="mradministrator",
* administrator_login_password="thisIsDog11",
* license_type="BasePrice",
* subnet_id=secondary_azurerm_subnet["id"],
* sku_name="GP_Gen5",
* vcores=4,
* storage_size_in_gb=32,
* tags={
* "environment": "prod",
* },
* opts = pulumi.ResourceOptions(depends_on=[
* secondary_azurerm_subnet_network_security_group_association,
* secondary_azurerm_subnet_route_table_association,
* ]))
* example_managed_instance_failover_group = azure.sql.ManagedInstanceFailoverGroup("example",
* name="example-failover-group",
* resource_group_name=primary_azurerm_resource_group["name"],
* location=primary.location,
* managed_instance_name=primary.name,
* 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 = "rg-example",
* Location = "West Europe",
* });
* var primary = new Azure.Sql.ManagedInstance("primary", new()
* {
* Name = "example-primary",
* ResourceGroupName = primaryAzurermResourceGroup.Name,
* Location = primaryAzurermResourceGroup.Location,
* AdministratorLogin = "mradministrator",
* AdministratorLoginPassword = "thisIsDog11",
* LicenseType = "BasePrice",
* SubnetId = primaryAzurermSubnet.Id,
* SkuName = "GP_Gen5",
* Vcores = 4,
* StorageSizeInGb = 32,
* Tags =
* {
* { "environment", "prod" },
* },
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* primaryAzurermSubnetNetworkSecurityGroupAssociation,
* primaryAzurermSubnetRouteTableAssociation,
* },
* });
* var secondary = new Azure.Sql.ManagedInstance("secondary", new()
* {
* Name = "example-secondary",
* ResourceGroupName = secondaryAzurermResourceGroup.Name,
* Location = secondaryAzurermResourceGroup.Location,
* AdministratorLogin = "mradministrator",
* AdministratorLoginPassword = "thisIsDog11",
* LicenseType = "BasePrice",
* SubnetId = secondaryAzurermSubnet.Id,
* SkuName = "GP_Gen5",
* Vcores = 4,
* StorageSizeInGb = 32,
* Tags =
* {
* { "environment", "prod" },
* },
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* secondaryAzurermSubnetNetworkSecurityGroupAssociation,
* secondaryAzurermSubnetRouteTableAssociation,
* },
* });
* var exampleManagedInstanceFailoverGroup = new Azure.Sql.ManagedInstanceFailoverGroup("example", new()
* {
* Name = "example-failover-group",
* ResourceGroupName = primaryAzurermResourceGroup.Name,
* Location = primary.Location,
* ManagedInstanceName = primary.Name,
* PartnerManagedInstanceId = secondary.Id,
* ReadWriteEndpointFailoverPolicy = new Azure.Sql.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/sql"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("rg-example"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* primary, err := sql.NewManagedInstance(ctx, "primary", &sql.ManagedInstanceArgs{
* Name: pulumi.String("example-primary"),
* ResourceGroupName: pulumi.Any(primaryAzurermResourceGroup.Name),
* Location: pulumi.Any(primaryAzurermResourceGroup.Location),
* AdministratorLogin: pulumi.String("mradministrator"),
* AdministratorLoginPassword: pulumi.String("thisIsDog11"),
* LicenseType: pulumi.String("BasePrice"),
* SubnetId: pulumi.Any(primaryAzurermSubnet.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{
* primaryAzurermSubnetNetworkSecurityGroupAssociation,
* primaryAzurermSubnetRouteTableAssociation,
* }))
* if err != nil {
* return err
* }
* secondary, err := sql.NewManagedInstance(ctx, "secondary", &sql.ManagedInstanceArgs{
* Name: pulumi.String("example-secondary"),
* ResourceGroupName: pulumi.Any(secondaryAzurermResourceGroup.Name),
* Location: pulumi.Any(secondaryAzurermResourceGroup.Location),
* AdministratorLogin: pulumi.String("mradministrator"),
* AdministratorLoginPassword: pulumi.String("thisIsDog11"),
* LicenseType: pulumi.String("BasePrice"),
* SubnetId: pulumi.Any(secondaryAzurermSubnet.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{
* secondaryAzurermSubnetNetworkSecurityGroupAssociation,
* secondaryAzurermSubnetRouteTableAssociation,
* }))
* if err != nil {
* return err
* }
* _, err = sql.NewManagedInstanceFailoverGroup(ctx, "example", &sql.ManagedInstanceFailoverGroupArgs{
* Name: pulumi.String("example-failover-group"),
* ResourceGroupName: pulumi.Any(primaryAzurermResourceGroup.Name),
* Location: primary.Location,
* ManagedInstanceName: primary.Name,
* PartnerManagedInstanceId: secondary.ID(),
* ReadWriteEndpointFailoverPolicy: &sql.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.sql.ManagedInstance;
* import com.pulumi.azure.sql.ManagedInstanceArgs;
* import com.pulumi.azure.sql.ManagedInstanceFailoverGroup;
* import com.pulumi.azure.sql.ManagedInstanceFailoverGroupArgs;
* import com.pulumi.azure.sql.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("rg-example")
* .location("West Europe")
* .build());
* var primary = new ManagedInstance("primary", ManagedInstanceArgs.builder()
* .name("example-primary")
* .resourceGroupName(primaryAzurermResourceGroup.name())
* .location(primaryAzurermResourceGroup.location())
* .administratorLogin("mradministrator")
* .administratorLoginPassword("thisIsDog11")
* .licenseType("BasePrice")
* .subnetId(primaryAzurermSubnet.id())
* .skuName("GP_Gen5")
* .vcores(4)
* .storageSizeInGb(32)
* .tags(Map.of("environment", "prod"))
* .build(), CustomResourceOptions.builder()
* .dependsOn(
* primaryAzurermSubnetNetworkSecurityGroupAssociation,
* primaryAzurermSubnetRouteTableAssociation)
* .build());
* var secondary = new ManagedInstance("secondary", ManagedInstanceArgs.builder()
* .name("example-secondary")
* .resourceGroupName(secondaryAzurermResourceGroup.name())
* .location(secondaryAzurermResourceGroup.location())
* .administratorLogin("mradministrator")
* .administratorLoginPassword("thisIsDog11")
* .licenseType("BasePrice")
* .subnetId(secondaryAzurermSubnet.id())
* .skuName("GP_Gen5")
* .vcores(4)
* .storageSizeInGb(32)
* .tags(Map.of("environment", "prod"))
* .build(), CustomResourceOptions.builder()
* .dependsOn(
* secondaryAzurermSubnetNetworkSecurityGroupAssociation,
* secondaryAzurermSubnetRouteTableAssociation)
* .build());
* var exampleManagedInstanceFailoverGroup = new ManagedInstanceFailoverGroup("exampleManagedInstanceFailoverGroup", ManagedInstanceFailoverGroupArgs.builder()
* .name("example-failover-group")
* .resourceGroupName(primaryAzurermResourceGroup.name())
* .location(primary.location())
* .managedInstanceName(primary.name())
* .partnerManagedInstanceId(secondary.id())
* .readWriteEndpointFailoverPolicy(ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs.builder()
* .mode("Automatic")
* .graceMinutes(60)
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: rg-example
* location: West Europe
* primary:
* type: azure:sql:ManagedInstance
* properties:
* name: example-primary
* resourceGroupName: ${primaryAzurermResourceGroup.name}
* location: ${primaryAzurermResourceGroup.location}
* administratorLogin: mradministrator
* administratorLoginPassword: thisIsDog11
* licenseType: BasePrice
* subnetId: ${primaryAzurermSubnet.id}
* skuName: GP_Gen5
* vcores: 4
* storageSizeInGb: 32
* tags:
* environment: prod
* options:
* dependson:
* - ${primaryAzurermSubnetNetworkSecurityGroupAssociation}
* - ${primaryAzurermSubnetRouteTableAssociation}
* secondary:
* type: azure:sql:ManagedInstance
* properties:
* name: example-secondary
* resourceGroupName: ${secondaryAzurermResourceGroup.name}
* location: ${secondaryAzurermResourceGroup.location}
* administratorLogin: mradministrator
* administratorLoginPassword: thisIsDog11
* licenseType: BasePrice
* subnetId: ${secondaryAzurermSubnet.id}
* skuName: GP_Gen5
* vcores: 4
* storageSizeInGb: 32
* tags:
* environment: prod
* options:
* dependson:
* - ${secondaryAzurermSubnetNetworkSecurityGroupAssociation}
* - ${secondaryAzurermSubnetRouteTableAssociation}
* exampleManagedInstanceFailoverGroup:
* type: azure:sql:ManagedInstanceFailoverGroup
* name: example
* properties:
* name: example-failover-group
* resourceGroupName: ${primaryAzurermResourceGroup.name}
* location: ${primary.location}
* managedInstanceName: ${primary.name}
* 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:sql/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.sql.ManagedInstanceFailoverGroup,
) : KotlinCustomResource(javaResource, ManagedInstanceFailoverGroupMapper) {
/**
* The Azure Region where the SQL Instance Failover Group exists. Changing this forces a new resource to be created.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* The name of the SQL Managed Instance which will be replicated using a SQL Instance Failover Group. Changing this forces a new SQL Instance Failover Group to be created.
*/
public val managedInstanceName: Output
get() = javaResource.managedInstanceName().applyValue({ args0 -> args0 })
/**
* The name which should be used for this SQL Instance Failover Group. Changing this forces a new SQL Instance Failover Group to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* ID of the 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 name of the Resource Group where the SQL Instance Failover Group should exist. Changing this forces a new SQL Instance Failover Group to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The partner replication role of the SQL 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.sql.ManagedInstanceFailoverGroup::class == javaResource::class
override fun map(javaResource: Resource): ManagedInstanceFailoverGroup =
ManagedInstanceFailoverGroup(
javaResource as
com.pulumi.azure.sql.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()
}