VirtualNetworkRule
Manages a MySQL Virtual Network Rule.
NOTE: MySQL Virtual Network Rules can only be used with SKU Tiers of
GeneralPurposeorMemoryOptimized
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("exampleVirtualNetwork", new Azure.Network.VirtualNetworkArgs
{
AddressSpaces =
{
"10.7.29.0/29",
},
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
});
var @internal = new Azure.Network.Subnet("internal", new Azure.Network.SubnetArgs
{
ResourceGroupName = exampleResourceGroup.Name,
VirtualNetworkName = exampleVirtualNetwork.Name,
AddressPrefixes =
{
"10.7.29.0/29",
},
ServiceEndpoints =
{
"Microsoft.Sql",
},
});
var exampleServer = new Azure.MySql.Server("exampleServer", new Azure.MySql.ServerArgs
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
AdministratorLogin = "mysqladminun",
AdministratorLoginPassword = "H@Sh1CoR3!",
SkuName = "B_Gen5_2",
StorageMb = 5120,
Version = "5.7",
BackupRetentionDays = 7,
GeoRedundantBackupEnabled = false,
SslEnforcementEnabled = true,
});
var exampleVirtualNetworkRule = new Azure.MySql.VirtualNetworkRule("exampleVirtualNetworkRule", new Azure.MySql.VirtualNetworkRuleArgs
{
ResourceGroupName = exampleResourceGroup.Name,
ServerName = exampleServer.Name,
SubnetId = @internal.Id,
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/mysql"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/network"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "exampleVirtualNetwork", &network.VirtualNetworkArgs{
AddressSpaces: pulumi.StringArray{
pulumi.String("10.7.29.0/29"),
},
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
})
if err != nil {
return err
}
internal, err := network.NewSubnet(ctx, "internal", &network.SubnetArgs{
ResourceGroupName: exampleResourceGroup.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 := mysql.NewServer(ctx, "exampleServer", &mysql.ServerArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
AdministratorLogin: pulumi.String("mysqladminun"),
AdministratorLoginPassword: pulumi.String("H@Sh1CoR3!"),
SkuName: pulumi.String("B_Gen5_2"),
StorageMb: pulumi.Int(5120),
Version: pulumi.String("5.7"),
BackupRetentionDays: pulumi.Int(7),
GeoRedundantBackupEnabled: pulumi.Bool(false),
SslEnforcementEnabled: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = mysql.NewVirtualNetworkRule(ctx, "exampleVirtualNetworkRule", &mysql.VirtualNetworkRuleArgs{
ResourceGroupName: exampleResourceGroup.Name,
ServerName: exampleServer.Name,
SubnetId: internal.ID(),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_virtual_network = azure.network.VirtualNetwork("exampleVirtualNetwork",
address_spaces=["10.7.29.0/29"],
location=example_resource_group.location,
resource_group_name=example_resource_group.name)
internal = azure.network.Subnet("internal",
resource_group_name=example_resource_group.name,
virtual_network_name=example_virtual_network.name,
address_prefixes=["10.7.29.0/29"],
service_endpoints=["Microsoft.Sql"])
example_server = azure.mysql.Server("exampleServer",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
administrator_login="mysqladminun",
administrator_login_password="H@Sh1CoR3!",
sku_name="B_Gen5_2",
storage_mb=5120,
version="5.7",
backup_retention_days=7,
geo_redundant_backup_enabled=False,
ssl_enforcement_enabled=True)
example_virtual_network_rule = azure.mysql.VirtualNetworkRule("exampleVirtualNetworkRule",
resource_group_name=example_resource_group.name,
server_name=example_server.name,
subnet_id=internal.id)import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleVirtualNetwork = new azure.network.VirtualNetwork("exampleVirtualNetwork", {
addressSpaces: ["10.7.29.0/29"],
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
});
const internal = new azure.network.Subnet("internal", {
resourceGroupName: exampleResourceGroup.name,
virtualNetworkName: exampleVirtualNetwork.name,
addressPrefixes: ["10.7.29.0/29"],
serviceEndpoints: ["Microsoft.Sql"],
});
const exampleServer = new azure.mysql.Server("exampleServer", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
administratorLogin: "mysqladminun",
administratorLoginPassword: "H@Sh1CoR3!",
skuName: "B_Gen5_2",
storageMb: 5120,
version: "5.7",
backupRetentionDays: 7,
geoRedundantBackupEnabled: false,
sslEnforcementEnabled: true,
});
const exampleVirtualNetworkRule = new azure.mysql.VirtualNetworkRule("exampleVirtualNetworkRule", {
resourceGroupName: exampleResourceGroup.name,
serverName: exampleServer.name,
subnetId: internal.id,
});Create a VirtualNetworkRule Resource
new VirtualNetworkRule(name: string, args: VirtualNetworkRuleArgs, opts?: CustomResourceOptions);def VirtualNetworkRule(resource_name, opts=None, name=None, resource_group_name=None, server_name=None, subnet_id=None, __props__=None);func NewVirtualNetworkRule(ctx *Context, name string, args VirtualNetworkRuleArgs, opts ...ResourceOption) (*VirtualNetworkRule, error)public VirtualNetworkRule(string name, VirtualNetworkRuleArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args VirtualNetworkRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args VirtualNetworkRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VirtualNetworkRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
VirtualNetworkRule Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The VirtualNetworkRule resource accepts the following input properties:
- Resource
Group stringName The name of the resource group where the MySQL server resides. Changing this forces a new resource to be created.
- Server
Name string The name of the SQL Server to which this MySQL virtual network rule will be applied to. Changing this forces a new resource to be created.
- Subnet
Id string The ID of the subnet that the MySQL server will be connected to.
- Name string
The name of the MySQL 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.
- Resource
Group stringName The name of the resource group where the MySQL server resides. Changing this forces a new resource to be created.
- Server
Name string The name of the SQL Server to which this MySQL virtual network rule will be applied to. Changing this forces a new resource to be created.
- Subnet
Id string The ID of the subnet that the MySQL server will be connected to.
- Name string
The name of the MySQL 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.
- resource
Group stringName The name of the resource group where the MySQL server resides. Changing this forces a new resource to be created.
- server
Name string The name of the SQL Server to which this MySQL virtual network rule will be applied to. Changing this forces a new resource to be created.
- subnet
Id string The ID of the subnet that the MySQL server will be connected to.
- name string
The name of the MySQL 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.
- resource_
group_ strname The name of the resource group where the MySQL server resides. Changing this forces a new resource to be created.
- server_
name str The name of the SQL Server to which this MySQL virtual network rule will be applied to. Changing this forces a new resource to be created.
- subnet_
id str The ID of the subnet that the MySQL server will be connected to.
- name str
The name of the MySQL 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.
Outputs
All input properties are implicitly available as output properties. Additionally, the VirtualNetworkRule resource produces the following output properties:
Look up an Existing VirtualNetworkRule Resource
Get an existing VirtualNetworkRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: VirtualNetworkRuleState, opts?: CustomResourceOptions): VirtualNetworkRulestatic get(resource_name, id, opts=None, name=None, resource_group_name=None, server_name=None, subnet_id=None, __props__=None);func GetVirtualNetworkRule(ctx *Context, name string, id IDInput, state *VirtualNetworkRuleState, opts ...ResourceOption) (*VirtualNetworkRule, error)public static VirtualNetworkRule Get(string name, Input<string> id, VirtualNetworkRuleState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Name string
The name of the MySQL 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.
- Resource
Group stringName The name of the resource group where the MySQL server resides. Changing this forces a new resource to be created.
- Server
Name string The name of the SQL Server to which this MySQL virtual network rule will be applied to. Changing this forces a new resource to be created.
- Subnet
Id string The ID of the subnet that the MySQL server will be connected to.
- Name string
The name of the MySQL 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.
- Resource
Group stringName The name of the resource group where the MySQL server resides. Changing this forces a new resource to be created.
- Server
Name string The name of the SQL Server to which this MySQL virtual network rule will be applied to. Changing this forces a new resource to be created.
- Subnet
Id string The ID of the subnet that the MySQL server will be connected to.
- name string
The name of the MySQL 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.
- resource
Group stringName The name of the resource group where the MySQL server resides. Changing this forces a new resource to be created.
- server
Name string The name of the SQL Server to which this MySQL virtual network rule will be applied to. Changing this forces a new resource to be created.
- subnet
Id string The ID of the subnet that the MySQL server will be connected to.
- name str
The name of the MySQL 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.
- resource_
group_ strname The name of the resource group where the MySQL server resides. Changing this forces a new resource to be created.
- server_
name str The name of the SQL Server to which this MySQL virtual network rule will be applied to. Changing this forces a new resource to be created.
- subnet_
id str The ID of the subnet that the MySQL server will be connected to.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.