azurermMssqlManagedDatabase
Manages an Azure SQL Azure Managed Database for a SQL Managed Instance.
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",
}
);
const azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
this,
"example_1",
{
address_space: ["10.0.0.0/16"],
location: azurermResourceGroupExample.location,
name: "example",
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 azurermSubnetExample = new azurerm.subnet.Subnet(this, "example_2", {
address_prefixes: ["10.0.2.0/24"],
name: "example",
resource_group_name: azurermResourceGroupExample.name,
virtual_network_name: azurermVirtualNetworkExample.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.*/
azurermSubnetExample.overrideLogicalId("example");
const azurermMssqlManagedInstanceExample =
new azurerm.mssqlManagedInstance.MssqlManagedInstance(this, "example_3", {
administrator_login: "msadministrator",
administrator_login_password: "thisIsDog11",
license_type: "BasePrice",
location: azurermResourceGroupExample.location,
name: "managedsqlinstance",
resource_group_name: azurermResourceGroupExample.name,
sku_name: "GP_Gen5",
storage_size_in_gb: 32,
subnet_id: azurermSubnetExample.id,
vcores: 4,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMssqlManagedInstanceExample.overrideLogicalId("example");
const azurermMssqlManagedDatabaseExample =
new azurerm.mssqlManagedDatabase.MssqlManagedDatabase(this, "example_4", {
managed_instance_id: azurermMssqlManagedInstanceExample.id,
name: "example",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMssqlManagedDatabaseExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
name
- (Required) The name of the Managed Database to create. Changing this forces a new resource to be created. -
managedInstanceId
- (Required) The ID of the Azure SQL Managed Instance on which to create this Managed Database. Changing this forces a new resource to be created. -
longTermRetentionPolicy
- (Optional) AlongTermRetentionPolicy
block as defined below. -
shortTermRetentionDays
- (Optional) The backup retention period in days. This is how many days Point-in-Time Restore will be supported.
A longTermRetentionPolicy
block supports the following:
weeklyRetention
- (Optional) The weekly retention policy for an LTR backup in an ISO 8601 format. Valid value is between 1 to 520 weeks. e.g.p1Y
,p1M
,p1W
orp7D
.monthlyRetention
- (Optional) The monthly retention policy for an LTR backup in an ISO 8601 format. Valid value is between 1 to 120 months. e.g.p1Y
,p1M
,p4W
orp30D
.yearlyRetention
- (Optional) The yearly retention policy for an LTR backup in an ISO 8601 format. Valid value is between 1 to 10 years. e.g.p1Y
,p12M
,p52W
orp365D
.weekOfYear
- (Optional) The week of year to take the yearly backup. Value has to be between1
and52
.
Attributes Reference
The following attributes are exported:
id
- The Azure SQL Managed Database ID.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
read
- (Defaults to 5 minutes) Used when retrieving the Mssql Managed Database.create
- (Defaults to 30 minutes) Used when creating the Mssql Managed Database.update
- (Defaults to 30 minutes) Used when updating the Mssql Managed Database.delete
- (Defaults to 30 minutes) Used when deleting the Mssql Managed Database.
Import
SQL Managed Databases can be imported using the resourceId
, e.g.