azurermPostgresqlFlexibleServerActiveDirectoryAdministrator
Allows you to set a user or group as the AD administrator for a PostgreSQL Flexible Server.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azuread from "./.gen/providers/azuread";
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azuread, azurerm.
For a more precise conversion please use the --provider flag in convert.*/
new azuread.provider.AzureadProvider(this, "azuread", {});
new azurerm.provider.AzurermProvider(this, "azurerm", {
features: [{}],
});
const azureadServicePrincipalPostgresql =
new azuread.servicePrincipal.ServicePrincipal(this, "postgresql", {
application_id: "5657e26c-cc92-45d9-bc47-9da6cfdb4ed9",
use_existing: true,
});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "example-resources",
}
);
const dataAzurermClientConfigCurrent =
new azurerm.dataAzurermClientConfig.DataAzurermClientConfig(
this,
"current",
{}
);
const azurermPostgresqlFlexibleServerExample =
new azurerm.postgresqlFlexibleServer.PostgresqlFlexibleServer(
this,
"example_5",
{
administrator_login: "4dm1n157r470r",
administrator_login_password: "4-v3ry-53cr37-p455w0rd",
authentication: [
{
active_directory_auth_enabled: true,
tenant_id: dataAzurermClientConfigCurrent.tenantId,
},
],
depends_on: [`\${${azureadServicePrincipalPostgresql.fqn}}`],
location: azurermResourceGroupExample.location,
name: "example-psqlserver",
resource_group_name: azurermResourceGroupExample.name,
sku_name: "GP_Standard_D2s_v3",
version: "12",
zone: "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.*/
azurermPostgresqlFlexibleServerExample.overrideLogicalId("example");
const azurermPostgresqlFlexibleServerActiveDirectoryAdministratorExample =
new azurerm.postgresqlFlexibleServerActiveDirectoryAdministrator.PostgresqlFlexibleServerActiveDirectoryAdministrator(
this,
"example_6",
{
object_id: dataAzurermClientConfigCurrent.objectId,
principal_name: "example-sp",
principal_type: "ServicePrincipal",
resource_group_name: azurermResourceGroupExample.name,
server_name: "${azurerm_postgresql_server.example.name}",
tenant_id: dataAzurermClientConfigCurrent.tenantId,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPostgresqlFlexibleServerActiveDirectoryAdministratorExample.overrideLogicalId(
"example"
);
Argument Reference
The following arguments are supported:
-
serverName
- (Required) The name of the PostgreSQL Flexible Server on which to set the administrator. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) The name of the resource group for the PostgreSQL Server. Changing this forces a new resource to be created. -
objectId
- (Required) The object ID of a user, service principal or security group in the Azure Active Directory tenant set as the Flexible Server Admin. Changing this forces a new resource to be created. -
tenantId
- (Required) The Azure Tenant ID. Changing this forces a new resource to be created. -
principalName
- (Required) The name of Azure Active Directory principal. Changing this forces a new resource to be created. -
principalType
- (Required) The type of Azure Active Directory principal. Possible values aregroup
,servicePrincipal
anduser
. Changing this forces a new resource to be created.
Attributes Reference
The following attributes are exported:
id
- The ID of the PostgreSQL Flexible Server Active Directory Administrator.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the PostgreSQL Flexible Server Active Directory Administrator.update
- (Defaults to 30 minutes) Used when updating the PostgreSQL Flexible Server Active Directory Administrator.read
- (Defaults to 5 minutes) Used when retrieving the PostgreSQL Flexible Server Active Directory Administrator.delete
- (Defaults to 30 minutes) Used when deleting the PostgreSQL Flexible Server Active Directory Administrator.
Import
A PostgreSQL Flexible Server Active Directory Administrator can be imported using the resourceId
, e.g.