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.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.sql.kotlin
import com.pulumi.azure.sql.VirtualNetworkRuleArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName
/**
* Allows you to add, update, or remove an Azure SQL server to a subnet of a virtual network.
* > **Note:** The `azure.sql.VirtualNetworkRule` resource is deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use the `azure.mssql.VirtualNetworkRule` 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-sql-server-vnet-rule",
* location: "West Europe",
* });
* const vnet = new azure.network.VirtualNetwork("vnet", {
* name: "example-vnet",
* addressSpaces: ["10.7.29.0/29"],
* location: example.location,
* resourceGroupName: example.name,
* });
* const subnet = new azure.network.Subnet("subnet", {
* name: "example-subnet",
* resourceGroupName: example.name,
* virtualNetworkName: vnet.name,
* addressPrefixes: ["10.7.29.0/29"],
* serviceEndpoints: ["Microsoft.Sql"],
* });
* const sqlserver = new azure.sql.SqlServer("sqlserver", {
* name: "uniqueazuresqlserver",
* resourceGroupName: example.name,
* location: example.location,
* version: "12.0",
* administratorLogin: "4dm1n157r470r",
* administratorLoginPassword: "4-v3ry-53cr37-p455w0rd",
* });
* const sqlvnetrule = new azure.sql.VirtualNetworkRule("sqlvnetrule", {
* name: "sql-vnet-rule",
* resourceGroupName: example.name,
* serverName: sqlserver.name,
* subnetId: subnet.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-sql-server-vnet-rule",
* location="West Europe")
* vnet = azure.network.VirtualNetwork("vnet",
* name="example-vnet",
* address_spaces=["10.7.29.0/29"],
* location=example.location,
* resource_group_name=example.name)
* subnet = azure.network.Subnet("subnet",
* name="example-subnet",
* resource_group_name=example.name,
* virtual_network_name=vnet.name,
* address_prefixes=["10.7.29.0/29"],
* service_endpoints=["Microsoft.Sql"])
* sqlserver = azure.sql.SqlServer("sqlserver",
* name="uniqueazuresqlserver",
* resource_group_name=example.name,
* location=example.location,
* version="12.0",
* administrator_login="4dm1n157r470r",
* administrator_login_password="4-v3ry-53cr37-p455w0rd")
* sqlvnetrule = azure.sql.VirtualNetworkRule("sqlvnetrule",
* name="sql-vnet-rule",
* resource_group_name=example.name,
* server_name=sqlserver.name,
* subnet_id=subnet.id)
* ```
* ```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-sql-server-vnet-rule",
* Location = "West Europe",
* });
* var vnet = new Azure.Network.VirtualNetwork("vnet", new()
* {
* Name = "example-vnet",
* AddressSpaces = new[]
* {
* "10.7.29.0/29",
* },
* Location = example.Location,
* ResourceGroupName = example.Name,
* });
* var subnet = new Azure.Network.Subnet("subnet", new()
* {
* Name = "example-subnet",
* ResourceGroupName = example.Name,
* VirtualNetworkName = vnet.Name,
* AddressPrefixes = new[]
* {
* "10.7.29.0/29",
* },
* ServiceEndpoints = new[]
* {
* "Microsoft.Sql",
* },
* });
* var sqlserver = new Azure.Sql.SqlServer("sqlserver", new()
* {
* Name = "uniqueazuresqlserver",
* ResourceGroupName = example.Name,
* Location = example.Location,
* Version = "12.0",
* AdministratorLogin = "4dm1n157r470r",
* AdministratorLoginPassword = "4-v3ry-53cr37-p455w0rd",
* });
* var sqlvnetrule = new Azure.Sql.VirtualNetworkRule("sqlvnetrule", new()
* {
* Name = "sql-vnet-rule",
* ResourceGroupName = example.Name,
* ServerName = sqlserver.Name,
* SubnetId = subnet.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
* "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-sql-server-vnet-rule"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* vnet, err := network.NewVirtualNetwork(ctx, "vnet", &network.VirtualNetworkArgs{
* Name: pulumi.String("example-vnet"),
* AddressSpaces: pulumi.StringArray{
* pulumi.String("10.7.29.0/29"),
* },
* Location: example.Location,
* ResourceGroupName: example.Name,
* })
* if err != nil {
* return err
* }
* subnet, err := network.NewSubnet(ctx, "subnet", &network.SubnetArgs{
* Name: pulumi.String("example-subnet"),
* ResourceGroupName: example.Name,
* VirtualNetworkName: vnet.Name,
* AddressPrefixes: pulumi.StringArray{
* pulumi.String("10.7.29.0/29"),
* },
* ServiceEndpoints: pulumi.StringArray{
* pulumi.String("Microsoft.Sql"),
* },
* })
* if err != nil {
* return err
* }
* sqlserver, err := sql.NewSqlServer(ctx, "sqlserver", &sql.SqlServerArgs{
* Name: pulumi.String("uniqueazuresqlserver"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* Version: pulumi.String("12.0"),
* AdministratorLogin: pulumi.String("4dm1n157r470r"),
* AdministratorLoginPassword: pulumi.String("4-v3ry-53cr37-p455w0rd"),
* })
* if err != nil {
* return err
* }
* _, err = sql.NewVirtualNetworkRule(ctx, "sqlvnetrule", &sql.VirtualNetworkRuleArgs{
* Name: pulumi.String("sql-vnet-rule"),
* ResourceGroupName: example.Name,
* ServerName: sqlserver.Name,
* SubnetId: subnet.ID(),
* })
* 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.sql.SqlServer;
* import com.pulumi.azure.sql.SqlServerArgs;
* import com.pulumi.azure.sql.VirtualNetworkRule;
* import com.pulumi.azure.sql.VirtualNetworkRuleArgs;
* 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-sql-server-vnet-rule")
* .location("West Europe")
* .build());
* var vnet = new VirtualNetwork("vnet", VirtualNetworkArgs.builder()
* .name("example-vnet")
* .addressSpaces("10.7.29.0/29")
* .location(example.location())
* .resourceGroupName(example.name())
* .build());
* var subnet = new Subnet("subnet", SubnetArgs.builder()
* .name("example-subnet")
* .resourceGroupName(example.name())
* .virtualNetworkName(vnet.name())
* .addressPrefixes("10.7.29.0/29")
* .serviceEndpoints("Microsoft.Sql")
* .build());
* var sqlserver = new SqlServer("sqlserver", SqlServerArgs.builder()
* .name("uniqueazuresqlserver")
* .resourceGroupName(example.name())
* .location(example.location())
* .version("12.0")
* .administratorLogin("4dm1n157r470r")
* .administratorLoginPassword("4-v3ry-53cr37-p455w0rd")
* .build());
* var sqlvnetrule = new VirtualNetworkRule("sqlvnetrule", VirtualNetworkRuleArgs.builder()
* .name("sql-vnet-rule")
* .resourceGroupName(example.name())
* .serverName(sqlserver.name())
* .subnetId(subnet.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-sql-server-vnet-rule
* location: West Europe
* vnet:
* type: azure:network:VirtualNetwork
* properties:
* name: example-vnet
* addressSpaces:
* - 10.7.29.0/29
* location: ${example.location}
* resourceGroupName: ${example.name}
* subnet:
* type: azure:network:Subnet
* properties:
* name: example-subnet
* resourceGroupName: ${example.name}
* virtualNetworkName: ${vnet.name}
* addressPrefixes:
* - 10.7.29.0/29
* serviceEndpoints:
* - Microsoft.Sql
* sqlserver:
* type: azure:sql:SqlServer
* properties:
* name: uniqueazuresqlserver
* resourceGroupName: ${example.name}
* location: ${example.location}
* version: '12.0'
* administratorLogin: 4dm1n157r470r
* administratorLoginPassword: 4-v3ry-53cr37-p455w0rd
* sqlvnetrule:
* type: azure:sql:VirtualNetworkRule
* properties:
* name: sql-vnet-rule
* resourceGroupName: ${example.name}
* serverName: ${sqlserver.name}
* subnetId: ${subnet.id}
* ```
*
* ## Import
* SQL Virtual Network Rules can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:sql/virtualNetworkRule:VirtualNetworkRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/virtualNetworkRules/vnetrulename
* ```
* @property ignoreMissingVnetServiceEndpoint Create the virtual network rule before the subnet has the virtual network service endpoint enabled. The default value is false.
* > **NOTE:** If `ignore_missing_vnet_service_endpoint` is false, and the target subnet does not contain the `Microsoft.SQL` endpoint in the `service_endpoints` array, the deployment will fail when it tries to create the SQL virtual network rule.
* @property name The name of the SQL virtual network rule. Changing this forces a new resource to be created. Cannot be empty and must only contain alphanumeric characters and hyphens. Cannot start with a number, and cannot start or end with a hyphen.
* > **NOTE:** `name` must be between 1-64 characters long and must satisfy all of the requirements below:
* 1. Contains only alphanumeric and hyphen characters
* 2. Cannot start with a number or hyphen
* 3. Cannot end with a hyphen
* @property resourceGroupName The name of the resource group where the SQL server resides. Changing this forces a new resource to be created.
* @property serverName The name of the SQL Server to which this SQL virtual network rule will be applied to. Changing this forces a new resource to be created.
* @property subnetId The ID of the subnet that the SQL server will be connected to.
*/
public data class VirtualNetworkRuleArgs(
public val ignoreMissingVnetServiceEndpoint: Output? = null,
public val name: Output? = null,
public val resourceGroupName: Output? = null,
public val serverName: Output? = null,
public val subnetId: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.azure.sql.VirtualNetworkRuleArgs =
com.pulumi.azure.sql.VirtualNetworkRuleArgs.builder()
.ignoreMissingVnetServiceEndpoint(ignoreMissingVnetServiceEndpoint?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
.serverName(serverName?.applyValue({ args0 -> args0 }))
.subnetId(subnetId?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [VirtualNetworkRuleArgs].
*/
@PulumiTagMarker
public class VirtualNetworkRuleArgsBuilder internal constructor() {
private var ignoreMissingVnetServiceEndpoint: Output? = null
private var name: Output? = null
private var resourceGroupName: Output? = null
private var serverName: Output? = null
private var subnetId: Output? = null
/**
* @param value Create the virtual network rule before the subnet has the virtual network service endpoint enabled. The default value is false.
* > **NOTE:** If `ignore_missing_vnet_service_endpoint` is false, and the target subnet does not contain the `Microsoft.SQL` endpoint in the `service_endpoints` array, the deployment will fail when it tries to create the SQL virtual network rule.
*/
@JvmName("ixclthmqxbwquxau")
public suspend fun ignoreMissingVnetServiceEndpoint(`value`: Output) {
this.ignoreMissingVnetServiceEndpoint = value
}
/**
* @param value The name of the SQL virtual network rule. Changing this forces a new resource to be created. Cannot be empty and must only contain alphanumeric characters and hyphens. Cannot start with a number, and cannot start or end with a hyphen.
* > **NOTE:** `name` must be between 1-64 characters long and must satisfy all of the requirements below:
* 1. Contains only alphanumeric and hyphen characters
* 2. Cannot start with a number or hyphen
* 3. Cannot end with a hyphen
*/
@JvmName("kvskvqrgwskbrdvs")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value The name of the resource group where the SQL server resides. Changing this forces a new resource to be created.
*/
@JvmName("grhfprmkbwkqalkh")
public suspend fun resourceGroupName(`value`: Output) {
this.resourceGroupName = value
}
/**
* @param value The name of the SQL Server to which this SQL virtual network rule will be applied to. Changing this forces a new resource to be created.
*/
@JvmName("gdrlibymdjamtdmp")
public suspend fun serverName(`value`: Output) {
this.serverName = value
}
/**
* @param value The ID of the subnet that the SQL server will be connected to.
*/
@JvmName("jjbekrxsnehwrdmc")
public suspend fun subnetId(`value`: Output) {
this.subnetId = value
}
/**
* @param value Create the virtual network rule before the subnet has the virtual network service endpoint enabled. The default value is false.
* > **NOTE:** If `ignore_missing_vnet_service_endpoint` is false, and the target subnet does not contain the `Microsoft.SQL` endpoint in the `service_endpoints` array, the deployment will fail when it tries to create the SQL virtual network rule.
*/
@JvmName("xdeujnxgjgsytphh")
public suspend fun ignoreMissingVnetServiceEndpoint(`value`: Boolean?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.ignoreMissingVnetServiceEndpoint = mapped
}
/**
* @param value The name of the SQL virtual network rule. Changing this forces a new resource to be created. Cannot be empty and must only contain alphanumeric characters and hyphens. Cannot start with a number, and cannot start or end with a hyphen.
* > **NOTE:** `name` must be between 1-64 characters long and must satisfy all of the requirements below:
* 1. Contains only alphanumeric and hyphen characters
* 2. Cannot start with a number or hyphen
* 3. Cannot end with a hyphen
*/
@JvmName("kpdxexhxkxcwhndr")
public suspend fun name(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.name = mapped
}
/**
* @param value The name of the resource group where the SQL server resides. Changing this forces a new resource to be created.
*/
@JvmName("ntumijafgruelfgt")
public suspend fun resourceGroupName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.resourceGroupName = mapped
}
/**
* @param value The name of the SQL Server to which this SQL virtual network rule will be applied to. Changing this forces a new resource to be created.
*/
@JvmName("mrggoihgafahbyfg")
public suspend fun serverName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.serverName = mapped
}
/**
* @param value The ID of the subnet that the SQL server will be connected to.
*/
@JvmName("rjqpifbgkistniij")
public suspend fun subnetId(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.subnetId = mapped
}
internal fun build(): VirtualNetworkRuleArgs = VirtualNetworkRuleArgs(
ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint,
name = name,
resourceGroupName = resourceGroupName,
serverName = serverName,
subnetId = subnetId,
)
}