Skip to content

azurermPostgresqlFlexibleServerDatabase

Manages a PostgreSQL Flexible Server Database.

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 azurermPostgresqlFlexibleServerExample =
  new azurerm.postgresqlFlexibleServer.PostgresqlFlexibleServer(
    this,
    "example_1",
    {
      administrator_login: "psqladmin",
      administrator_password: "H@Sh1CoR3!",
      location: azurermResourceGroupExample.location,
      name: "example-psqlflexibleserver",
      resource_group_name: azurermResourceGroupExample.name,
      sku_name: "GP_Standard_D4s_v3",
      storage_mb: 32768,
      version: "12",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPostgresqlFlexibleServerExample.overrideLogicalId("example");
const azurermPostgresqlFlexibleServerDatabaseExample =
  new azurerm.postgresqlFlexibleServerDatabase.PostgresqlFlexibleServerDatabase(
    this,
    "example_2",
    {
      charset: "utf8",
      collation: "en_US.utf8",
      name: "example-db",
      server_id: azurermPostgresqlFlexibleServerExample.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.*/
azurermPostgresqlFlexibleServerDatabaseExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Azure PostgreSQL Flexible Server Database. Changing this forces a new Azure PostgreSQL Flexible Server Database to be created.

  • serverId - (Required) The ID of the Azure PostgreSQL Flexible Server from which to create this PostgreSQL Flexible Server Database. Changing this forces a new Azure PostgreSQL Flexible Server Database to be created.

  • charset - (Optional) Specifies the Charset for the Azure PostgreSQL Flexible Server Database, which needs to be a valid PostgreSQL Charset. Defaults to utf8. Changing this forces a new Azure PostgreSQL Flexible Server Database to be created.

  • collation - (Optional) Specifies the Collation for the Azure PostgreSQL Flexible Server Database, which needs to be a valid PostgreSQL Collation. Defaults to enUsUtf8. Changing this forces a new Azure PostgreSQL Flexible Server Database to be created.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Azure PostgreSQL Flexible Server Database.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Azure PostgreSQL Flexible Server Database.
  • read - (Defaults to 5 minutes) Used when retrieving the Azure PostgreSQL Flexible Server Database.
  • delete - (Defaults to 30 minutes) Used when deleting the Azure PostgreSQL Flexible Server Database.

Import

Azure PostgreSQL Flexible Server Database can be imported using the resourceId, e.g.

terraform import azurerm_postgresql_flexible_server_database.example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/databases/database1