Data Source: azurermMssqlDatabase
Use this data source to access information about an existing SQL database.
Example Usage
import * as cdktf from "cdktf";
/*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 azurermMssqlServerExample = new azurerm.mssqlServer.MssqlServer(
this,
"example_1",
{
administrator_login: "4dm1n157r470r",
administrator_login_password: "4-v3ry-53cr37-p455w0rd",
location: azurermResourceGroupExample.location,
name: "example",
resource_group_name: azurermResourceGroupExample.name,
version: "12.0",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMssqlServerExample.overrideLogicalId("example");
const dataAzurermMssqlDatabaseExample =
new azurerm.dataAzurermMssqlDatabase.DataAzurermMssqlDatabase(
this,
"example_2",
{
name: "example-mssql-db",
server_id: azurermMssqlServerExample.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.*/
dataAzurermMssqlDatabaseExample.overrideLogicalId("example");
new cdktf.TerraformOutput(this, "database_id", {
value: dataAzurermMssqlDatabaseExample.id,
});
Argument Reference
-
name
- The name of the MS SQL Database. -
serverId
- The id of the MS SQL Server on which to create the database.
Attributes Reference
-
collation
- The collation of the database. -
elasticPoolId
- The id of the elastic pool containing this database. -
licenseType
- The license type to apply for this database. -
maxSizeGb
- The max size of the database in gigabytes. -
readReplicaCount
- The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. -
readScale
- If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. -
skuName
- The name of the SKU of the database. -
storageAccountType
- The storage account type used to store backups for this database. -
zoneRedundant
- Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. -
tags
- A mapping of tags to assign to the resource.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
read
- (Defaults to 5 minutes) Used when retrieving the SQL database.