com.pulumi.azure.sql.kotlin.FailoverGroupArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.sql.kotlin
import com.pulumi.azure.sql.FailoverGroupArgs.builder
import com.pulumi.azure.sql.kotlin.inputs.FailoverGroupPartnerServerArgs
import com.pulumi.azure.sql.kotlin.inputs.FailoverGroupPartnerServerArgsBuilder
import com.pulumi.azure.sql.kotlin.inputs.FailoverGroupReadWriteEndpointFailoverPolicyArgs
import com.pulumi.azure.sql.kotlin.inputs.FailoverGroupReadWriteEndpointFailoverPolicyArgsBuilder
import com.pulumi.azure.sql.kotlin.inputs.FailoverGroupReadonlyEndpointFailoverPolicyArgs
import com.pulumi.azure.sql.kotlin.inputs.FailoverGroupReadonlyEndpointFailoverPolicyArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName
/**
* Create a failover group of databases on a collection of Azure SQL servers.
* > **Note:** The `azure.sql.FailoverGroup` resource is deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use the `azure.mssql.FailoverGroup` resource instead.
* ## Example Usage
*
* ```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 primary = new azure.sql.SqlServer("primary", {
* name: "sql-primary",
* resourceGroupName: example.name,
* location: example.location,
* version: "12.0",
* administratorLogin: "sqladmin",
* administratorLoginPassword: "pa$$w0rd",
* });
* const secondary = new azure.sql.SqlServer("secondary", {
* name: "sql-secondary",
* resourceGroupName: example.name,
* location: example.location,
* version: "12.0",
* administratorLogin: "sqladmin",
* administratorLoginPassword: "pa$$w0rd",
* });
* const db1 = new azure.sql.Database("db1", {
* name: "db1",
* resourceGroupName: primary.resourceGroupName,
* location: primary.location,
* serverName: primary.name,
* });
* const exampleFailoverGroup = new azure.sql.FailoverGroup("example", {
* name: "example-failover-group",
* resourceGroupName: primary.resourceGroupName,
* serverName: primary.name,
* databases: [db1.id],
* partnerServers: [{
* id: 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")
* primary = azure.sql.SqlServer("primary",
* name="sql-primary",
* resource_group_name=example.name,
* location=example.location,
* version="12.0",
* administrator_login="sqladmin",
* administrator_login_password="pa$$w0rd")
* secondary = azure.sql.SqlServer("secondary",
* name="sql-secondary",
* resource_group_name=example.name,
* location=example.location,
* version="12.0",
* administrator_login="sqladmin",
* administrator_login_password="pa$$w0rd")
* db1 = azure.sql.Database("db1",
* name="db1",
* resource_group_name=primary.resource_group_name,
* location=primary.location,
* server_name=primary.name)
* example_failover_group = azure.sql.FailoverGroup("example",
* name="example-failover-group",
* resource_group_name=primary.resource_group_name,
* server_name=primary.name,
* databases=[db1.id],
* partner_servers=[azure.sql.FailoverGroupPartnerServerArgs(
* id=secondary.id,
* )],
* read_write_endpoint_failover_policy=azure.sql.FailoverGroupReadWriteEndpointFailoverPolicyArgs(
* 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 primary = new Azure.Sql.SqlServer("primary", new()
* {
* Name = "sql-primary",
* ResourceGroupName = example.Name,
* Location = example.Location,
* Version = "12.0",
* AdministratorLogin = "sqladmin",
* AdministratorLoginPassword = "pa$$w0rd",
* });
* var secondary = new Azure.Sql.SqlServer("secondary", new()
* {
* Name = "sql-secondary",
* ResourceGroupName = example.Name,
* Location = example.Location,
* Version = "12.0",
* AdministratorLogin = "sqladmin",
* AdministratorLoginPassword = "pa$$w0rd",
* });
* var db1 = new Azure.Sql.Database("db1", new()
* {
* Name = "db1",
* ResourceGroupName = primary.ResourceGroupName,
* Location = primary.Location,
* ServerName = primary.Name,
* });
* var exampleFailoverGroup = new Azure.Sql.FailoverGroup("example", new()
* {
* Name = "example-failover-group",
* ResourceGroupName = primary.ResourceGroupName,
* ServerName = primary.Name,
* Databases = new[]
* {
* db1.Id,
* },
* PartnerServers = new[]
* {
* new Azure.Sql.Inputs.FailoverGroupPartnerServerArgs
* {
* Id = secondary.Id,
* },
* },
* ReadWriteEndpointFailoverPolicy = new Azure.Sql.Inputs.FailoverGroupReadWriteEndpointFailoverPolicyArgs
* {
* 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 {
* example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("example-resources"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* primary, err := sql.NewSqlServer(ctx, "primary", &sql.SqlServerArgs{
* Name: pulumi.String("sql-primary"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* Version: pulumi.String("12.0"),
* AdministratorLogin: pulumi.String("sqladmin"),
* AdministratorLoginPassword: pulumi.String("pa$$w0rd"),
* })
* if err != nil {
* return err
* }
* secondary, err := sql.NewSqlServer(ctx, "secondary", &sql.SqlServerArgs{
* Name: pulumi.String("sql-secondary"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* Version: pulumi.String("12.0"),
* AdministratorLogin: pulumi.String("sqladmin"),
* AdministratorLoginPassword: pulumi.String("pa$$w0rd"),
* })
* if err != nil {
* return err
* }
* db1, err := sql.NewDatabase(ctx, "db1", &sql.DatabaseArgs{
* Name: pulumi.String("db1"),
* ResourceGroupName: primary.ResourceGroupName,
* Location: primary.Location,
* ServerName: primary.Name,
* })
* if err != nil {
* return err
* }
* _, err = sql.NewFailoverGroup(ctx, "example", &sql.FailoverGroupArgs{
* Name: pulumi.String("example-failover-group"),
* ResourceGroupName: primary.ResourceGroupName,
* ServerName: primary.Name,
* Databases: pulumi.StringArray{
* db1.ID(),
* },
* PartnerServers: sql.FailoverGroupPartnerServerArray{
* &sql.FailoverGroupPartnerServerArgs{
* Id: secondary.ID(),
* },
* },
* ReadWriteEndpointFailoverPolicy: &sql.FailoverGroupReadWriteEndpointFailoverPolicyArgs{
* 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.SqlServer;
* import com.pulumi.azure.sql.SqlServerArgs;
* import com.pulumi.azure.sql.Database;
* import com.pulumi.azure.sql.DatabaseArgs;
* import com.pulumi.azure.sql.FailoverGroup;
* import com.pulumi.azure.sql.FailoverGroupArgs;
* import com.pulumi.azure.sql.inputs.FailoverGroupPartnerServerArgs;
* import com.pulumi.azure.sql.inputs.FailoverGroupReadWriteEndpointFailoverPolicyArgs;
* 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 primary = new SqlServer("primary", SqlServerArgs.builder()
* .name("sql-primary")
* .resourceGroupName(example.name())
* .location(example.location())
* .version("12.0")
* .administratorLogin("sqladmin")
* .administratorLoginPassword("pa$$w0rd")
* .build());
* var secondary = new SqlServer("secondary", SqlServerArgs.builder()
* .name("sql-secondary")
* .resourceGroupName(example.name())
* .location(example.location())
* .version("12.0")
* .administratorLogin("sqladmin")
* .administratorLoginPassword("pa$$w0rd")
* .build());
* var db1 = new Database("db1", DatabaseArgs.builder()
* .name("db1")
* .resourceGroupName(primary.resourceGroupName())
* .location(primary.location())
* .serverName(primary.name())
* .build());
* var exampleFailoverGroup = new FailoverGroup("exampleFailoverGroup", FailoverGroupArgs.builder()
* .name("example-failover-group")
* .resourceGroupName(primary.resourceGroupName())
* .serverName(primary.name())
* .databases(db1.id())
* .partnerServers(FailoverGroupPartnerServerArgs.builder()
* .id(secondary.id())
* .build())
* .readWriteEndpointFailoverPolicy(FailoverGroupReadWriteEndpointFailoverPolicyArgs.builder()
* .mode("Automatic")
* .graceMinutes(60)
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* primary:
* type: azure:sql:SqlServer
* properties:
* name: sql-primary
* resourceGroupName: ${example.name}
* location: ${example.location}
* version: '12.0'
* administratorLogin: sqladmin
* administratorLoginPassword: pa$$w0rd
* secondary:
* type: azure:sql:SqlServer
* properties:
* name: sql-secondary
* resourceGroupName: ${example.name}
* location: ${example.location}
* version: '12.0'
* administratorLogin: sqladmin
* administratorLoginPassword: pa$$w0rd
* db1:
* type: azure:sql:Database
* properties:
* name: db1
* resourceGroupName: ${primary.resourceGroupName}
* location: ${primary.location}
* serverName: ${primary.name}
* exampleFailoverGroup:
* type: azure:sql:FailoverGroup
* name: example
* properties:
* name: example-failover-group
* resourceGroupName: ${primary.resourceGroupName}
* serverName: ${primary.name}
* databases:
* - ${db1.id}
* partnerServers:
* - id: ${secondary.id}
* readWriteEndpointFailoverPolicy:
* mode: Automatic
* graceMinutes: 60
* ```
*
* ## Import
* SQL Failover Groups can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:sql/failoverGroup:FailoverGroup example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/failoverGroups/group1
* ```
* @property databases A list of database ids to add to the failover group
* > **NOTE:** The failover group will create a secondary database for each database listed in `databases`. If the secondary databases need to be managed through this provider, they should be defined as resources and a dependency added to the failover group to ensure the secondary databases are created first.
* @property name The name of the failover group. Changing this forces a new resource to be created.
* @property partnerServers A list of `partner_servers` blocks as documented below.
* @property readWriteEndpointFailoverPolicy A `read_write_endpoint_failover_policy` block as documented below.
* @property readonlyEndpointFailoverPolicy A `readonly_endpoint_failover_policy` block as documented below.
* @property resourceGroupName The name of the resource group containing the SQL server Changing this forces a new resource to be created.
* @property serverName The name of the primary SQL server. Changing this forces a new resource to be created.
* @property tags A mapping of tags to assign to the resource.
*/
public data class FailoverGroupArgs(
public val databases: Output>? = null,
public val name: Output? = null,
public val partnerServers: Output>? = null,
public val readWriteEndpointFailoverPolicy:
Output? = null,
public val readonlyEndpointFailoverPolicy:
Output? = null,
public val resourceGroupName: Output? = null,
public val serverName: Output? = null,
public val tags: Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy