Skip to content

azurermMariadbVirtualNetworkRule

Manages a MariaDB Virtual Network Rule.

-> NOTE: MariaDB Virtual Network Rules can only be used with SKU Tiers of generalPurpose or memoryOptimized

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
  this,
  "example_1",
  {
    address_space: ["10.7.29.0/29"],
    location: azurermResourceGroupExample.location,
    name: "example-vnet",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualNetworkExample.overrideLogicalId("example");
const azurermMariadbServerExample = new azurerm.mariadbServer.MariadbServer(
  this,
  "example_2",
  {
    administrator_login: "mariadbadminun",
    administrator_login_password: "H@Sh1CoR3!",
    location: azurermResourceGroupExample.location,
    name: "mariadb-server-1",
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "GP_Gen5_2",
    ssl_enforcement_enabled: true,
    version: "10.2",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMariadbServerExample.overrideLogicalId("example");
const azurermSubnetInternal = new azurerm.subnet.Subnet(this, "internal", {
  address_prefixes: ["10.7.29.0/29"],
  name: "internal",
  resource_group_name: azurermResourceGroupExample.name,
  service_endpoints: ["Microsoft.Sql"],
  virtual_network_name: azurermVirtualNetworkExample.name,
});
const azurermMariadbVirtualNetworkRuleExample =
  new azurerm.mariadbVirtualNetworkRule.MariadbVirtualNetworkRule(
    this,
    "example_4",
    {
      name: "mariadb-vnet-rule",
      resource_group_name: azurermResourceGroupExample.name,
      server_name: azurermMariadbServerExample.name,
      subnet_id: azurermSubnetInternal.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMariadbVirtualNetworkRuleExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) 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

  4. resourceGroupName - (Required) The name of the resource group where the MariaDB server resides. Changing this forces a new resource to be created.

  5. serverName - (Required) 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.

  6. subnetId - (Required) The ID of the subnet that the MariaDB server will be connected to.

\~> NOTE: Due to a bug in the Azure API this resource currently doesn't expose the ignoreMissingVnetServiceEndpoint field and defaults this to false. Terraform 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.

Attributes Reference

The following attributes are exported:

  • id - The ID of the MariaDB Virtual Network Rule.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the MariaDB Virtual Network Rule.
  • update - (Defaults to 30 minutes) Used when updating the MariaDB Virtual Network Rule.
  • read - (Defaults to 5 minutes) Used when retrieving the MariaDB Virtual Network Rule.
  • delete - (Defaults to 30 minutes) Used when deleting the MariaDB Virtual Network Rule.

Import

MariaDB Virtual Network Rules can be imported using the resourceId, e.g.

terraform import azurerm_mariadb_virtual_network_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.DBforMariaDB/servers/myserver/virtualNetworkRules/vnetrulename