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.mariadb.kotlin.VirtualNetworkRule.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.mariadb.kotlin
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
/**
* Builder for [VirtualNetworkRule].
*/
@PulumiTagMarker
public class VirtualNetworkRuleResourceBuilder internal constructor() {
public var name: String? = null
public var args: VirtualNetworkRuleArgs = VirtualNetworkRuleArgs()
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 VirtualNetworkRuleArgsBuilder.() -> Unit) {
val builder = VirtualNetworkRuleArgsBuilder()
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(): VirtualNetworkRule {
val builtJavaResource = com.pulumi.azure.mariadb.VirtualNetworkRule(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return VirtualNetworkRule(builtJavaResource)
}
}
/**
* Manages a MariaDB Virtual Network Rule.
* > **NOTE:** MariaDB Virtual Network Rules [can only be used with SKU Tiers of `GeneralPurpose` or `MemoryOptimized`](https://docs.microsoft.com/azure/mariadb/concepts-data-access-security-vnet)
* ## 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 exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
* name: "example-vnet",
* addressSpaces: ["10.7.29.0/29"],
* location: example.location,
* resourceGroupName: example.name,
* });
* const internal = new azure.network.Subnet("internal", {
* name: "internal",
* resourceGroupName: example.name,
* virtualNetworkName: exampleVirtualNetwork.name,
* addressPrefixes: ["10.7.29.0/29"],
* serviceEndpoints: ["Microsoft.Sql"],
* });
* const exampleServer = new azure.mariadb.Server("example", {
* name: "mariadb-server-1",
* location: example.location,
* resourceGroupName: example.name,
* administratorLogin: "mariadbadminun",
* administratorLoginPassword: "H@Sh1CoR3!",
* version: "10.2",
* sslEnforcementEnabled: true,
* skuName: "GP_Gen5_2",
* });
* const exampleVirtualNetworkRule = new azure.mariadb.VirtualNetworkRule("example", {
* name: "mariadb-vnet-rule",
* resourceGroupName: example.name,
* serverName: exampleServer.name,
* subnetId: internal.id,
* });
* ```
* ```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-vnet",
* address_spaces=["10.7.29.0/29"],
* location=example.location,
* resource_group_name=example.name)
* internal = azure.network.Subnet("internal",
* name="internal",
* resource_group_name=example.name,
* virtual_network_name=example_virtual_network.name,
* address_prefixes=["10.7.29.0/29"],
* service_endpoints=["Microsoft.Sql"])
* example_server = azure.mariadb.Server("example",
* name="mariadb-server-1",
* location=example.location,
* resource_group_name=example.name,
* administrator_login="mariadbadminun",
* administrator_login_password="H@Sh1CoR3!",
* version="10.2",
* ssl_enforcement_enabled=True,
* sku_name="GP_Gen5_2")
* example_virtual_network_rule = azure.mariadb.VirtualNetworkRule("example",
* name="mariadb-vnet-rule",
* resource_group_name=example.name,
* server_name=example_server.name,
* subnet_id=internal.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-resources",
* Location = "West Europe",
* });
* var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
* {
* Name = "example-vnet",
* AddressSpaces = new[]
* {
* "10.7.29.0/29",
* },
* Location = example.Location,
* ResourceGroupName = example.Name,
* });
* var @internal = new Azure.Network.Subnet("internal", new()
* {
* Name = "internal",
* ResourceGroupName = example.Name,
* VirtualNetworkName = exampleVirtualNetwork.Name,
* AddressPrefixes = new[]
* {
* "10.7.29.0/29",
* },
* ServiceEndpoints = new[]
* {
* "Microsoft.Sql",
* },
* });
* var exampleServer = new Azure.MariaDB.Server("example", new()
* {
* Name = "mariadb-server-1",
* Location = example.Location,
* ResourceGroupName = example.Name,
* AdministratorLogin = "mariadbadminun",
* AdministratorLoginPassword = "H@Sh1CoR3!",
* Version = "10.2",
* SslEnforcementEnabled = true,
* SkuName = "GP_Gen5_2",
* });
* var exampleVirtualNetworkRule = new Azure.MariaDB.VirtualNetworkRule("example", new()
* {
* Name = "mariadb-vnet-rule",
* ResourceGroupName = example.Name,
* ServerName = exampleServer.Name,
* SubnetId = @internal.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mariadb"
* "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-vnet"),
* AddressSpaces: pulumi.StringArray{
* pulumi.String("10.7.29.0/29"),
* },
* Location: example.Location,
* ResourceGroupName: example.Name,
* })
* if err != nil {
* return err
* }
* internal, err := network.NewSubnet(ctx, "internal", &network.SubnetArgs{
* Name: pulumi.String("internal"),
* ResourceGroupName: example.Name,
* VirtualNetworkName: exampleVirtualNetwork.Name,
* AddressPrefixes: pulumi.StringArray{
* pulumi.String("10.7.29.0/29"),
* },
* ServiceEndpoints: pulumi.StringArray{
* pulumi.String("Microsoft.Sql"),
* },
* })
* if err != nil {
* return err
* }
* exampleServer, err := mariadb.NewServer(ctx, "example", &mariadb.ServerArgs{
* Name: pulumi.String("mariadb-server-1"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* AdministratorLogin: pulumi.String("mariadbadminun"),
* AdministratorLoginPassword: pulumi.String("H@Sh1CoR3!"),
* Version: pulumi.String("10.2"),
* SslEnforcementEnabled: pulumi.Bool(true),
* SkuName: pulumi.String("GP_Gen5_2"),
* })
* if err != nil {
* return err
* }
* _, err = mariadb.NewVirtualNetworkRule(ctx, "example", &mariadb.VirtualNetworkRuleArgs{
* Name: pulumi.String("mariadb-vnet-rule"),
* ResourceGroupName: example.Name,
* ServerName: exampleServer.Name,
* SubnetId: internal.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.mariadb.Server;
* import com.pulumi.azure.mariadb.ServerArgs;
* import com.pulumi.azure.mariadb.VirtualNetworkRule;
* import com.pulumi.azure.mariadb.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-resources")
* .location("West Europe")
* .build());
* var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
* .name("example-vnet")
* .addressSpaces("10.7.29.0/29")
* .location(example.location())
* .resourceGroupName(example.name())
* .build());
* var internal = new Subnet("internal", SubnetArgs.builder()
* .name("internal")
* .resourceGroupName(example.name())
* .virtualNetworkName(exampleVirtualNetwork.name())
* .addressPrefixes("10.7.29.0/29")
* .serviceEndpoints("Microsoft.Sql")
* .build());
* var exampleServer = new Server("exampleServer", ServerArgs.builder()
* .name("mariadb-server-1")
* .location(example.location())
* .resourceGroupName(example.name())
* .administratorLogin("mariadbadminun")
* .administratorLoginPassword("H@Sh1CoR3!")
* .version("10.2")
* .sslEnforcementEnabled(true)
* .skuName("GP_Gen5_2")
* .build());
* var exampleVirtualNetworkRule = new VirtualNetworkRule("exampleVirtualNetworkRule", VirtualNetworkRuleArgs.builder()
* .name("mariadb-vnet-rule")
* .resourceGroupName(example.name())
* .serverName(exampleServer.name())
* .subnetId(internal.id())
* .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-vnet
* addressSpaces:
* - 10.7.29.0/29
* location: ${example.location}
* resourceGroupName: ${example.name}
* internal:
* type: azure:network:Subnet
* properties:
* name: internal
* resourceGroupName: ${example.name}
* virtualNetworkName: ${exampleVirtualNetwork.name}
* addressPrefixes:
* - 10.7.29.0/29
* serviceEndpoints:
* - Microsoft.Sql
* exampleServer:
* type: azure:mariadb:Server
* name: example
* properties:
* name: mariadb-server-1
* location: ${example.location}
* resourceGroupName: ${example.name}
* administratorLogin: mariadbadminun
* administratorLoginPassword: H@Sh1CoR3!
* version: '10.2'
* sslEnforcementEnabled: true
* skuName: GP_Gen5_2
* exampleVirtualNetworkRule:
* type: azure:mariadb:VirtualNetworkRule
* name: example
* properties:
* name: mariadb-vnet-rule
* resourceGroupName: ${example.name}
* serverName: ${exampleServer.name}
* subnetId: ${internal.id}
* ```
*
* ## Import
* MariaDB Virtual Network Rules can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:mariadb/virtualNetworkRule:VirtualNetworkRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.DBforMariaDB/servers/myserver/virtualNetworkRules/vnetrulename
* ```
*/
public class VirtualNetworkRule internal constructor(
override val javaResource: com.pulumi.azure.mariadb.VirtualNetworkRule,
) : KotlinCustomResource(javaResource, VirtualNetworkRuleMapper) {
/**
* The name of the MariaDB Virtual Network Rule. Cannot be empty and must only contain alphanumeric characters and hyphens. Cannot start with a number, and cannot start or end with a hyphen. Changing this forces a new resource to be created.
* > **NOTE:** `name` must be between 1-128 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
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The name of the resource group where the MariaDB server resides. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The name of the SQL Server to which this MariaDB virtual network rule will be applied to. Changing this forces a new resource to be created.
*/
public val serverName: Output
get() = javaResource.serverName().applyValue({ args0 -> args0 })
/**
* The ID of the subnet that the MariaDB server will be connected to.
* > **NOTE:** Due to [a bug in the Azure API](https://github.com/Azure/azure-rest-api-specs/issues/3719) this resource currently doesn't expose the `ignore_missing_vnet_service_endpoint` field and defaults this to `false`. This provider will check during the provisioning of the Virtual Network Rule that the Subnet contains the Service Rule to verify that the Virtual Network Rule can be created.
*/
public val subnetId: Output
get() = javaResource.subnetId().applyValue({ args0 -> args0 })
}
public object VirtualNetworkRuleMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.mariadb.VirtualNetworkRule::class == javaResource::class
override fun map(javaResource: Resource): VirtualNetworkRule = VirtualNetworkRule(
javaResource as
com.pulumi.azure.mariadb.VirtualNetworkRule,
)
}
/**
* @see [VirtualNetworkRule].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [VirtualNetworkRule].
*/
public suspend fun virtualNetworkRule(
name: String,
block: suspend VirtualNetworkRuleResourceBuilder.() -> Unit,
): VirtualNetworkRule {
val builder = VirtualNetworkRuleResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [VirtualNetworkRule].
* @param name The _unique_ name of the resulting resource.
*/
public fun virtualNetworkRule(name: String): VirtualNetworkRule {
val builder = VirtualNetworkRuleResourceBuilder()
builder.name(name)
return builder.build()
}