azurermKustoClusterCustomerManagedKey
Manages a Customer Managed Key for a Kusto Cluster.
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 dataAzurermClientConfigCurrent =
new azurerm.dataAzurermClientConfig.DataAzurermClientConfig(
this,
"current",
{}
);
const azurermKeyVaultExample = new azurerm.keyVault.KeyVault(
this,
"example_2",
{
location: azurermResourceGroupExample.location,
name: "examplekv",
purge_protection_enabled: true,
resource_group_name: azurermResourceGroupExample.name,
sku_name: "standard",
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.*/
azurermKeyVaultExample.overrideLogicalId("example");
const azurermKeyVaultAccessPolicyClient =
new azurerm.keyVaultAccessPolicy.KeyVaultAccessPolicy(this, "client", {
key_permissions: [
"Get",
"List",
"Create",
"Delete",
"Recover",
"GetRotationPolicy",
],
key_vault_id: azurermKeyVaultExample.id,
object_id: dataAzurermClientConfigCurrent.objectId,
tenant_id: dataAzurermClientConfigCurrent.tenantId,
});
const azurermKustoClusterExample = new azurerm.kustoCluster.KustoCluster(
this,
"example_4",
{
identity: [
{
type: "SystemAssigned",
},
],
location: azurermResourceGroupExample.location,
name: "kustocluster",
resource_group_name: azurermResourceGroupExample.name,
sku: [
{
capacity: 2,
name: "Standard_D13_v2",
},
],
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermKustoClusterExample.overrideLogicalId("example");
const azurermKeyVaultAccessPolicyCluster =
new azurerm.keyVaultAccessPolicy.KeyVaultAccessPolicy(this, "cluster", {
key_permissions: ["Get", "UnwrapKey", "WrapKey"],
key_vault_id: azurermKeyVaultExample.id,
object_id: `\${${azurermKustoClusterExample.identity}.0.principal_id}`,
tenant_id: dataAzurermClientConfigCurrent.tenantId,
});
const azurermKeyVaultKeyExample = new azurerm.keyVaultKey.KeyVaultKey(
this,
"example_6",
{
depends_on: [
`\${${azurermKeyVaultAccessPolicyClient.fqn}}`,
`\${${azurermKeyVaultAccessPolicyCluster.fqn}}`,
],
key_opts: ["decrypt", "encrypt", "sign", "unwrapKey", "verify", "wrapKey"],
key_size: 2048,
key_type: "RSA",
key_vault_id: azurermKeyVaultExample.id,
name: "tfex-key",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermKeyVaultKeyExample.overrideLogicalId("example");
const azurermKustoClusterCustomerManagedKeyExample =
new azurerm.kustoClusterCustomerManagedKey.KustoClusterCustomerManagedKey(
this,
"example_7",
{
cluster_id: azurermKustoClusterExample.id,
key_name: azurermKeyVaultKeyExample.name,
key_vault_id: azurermKeyVaultExample.id,
key_version: azurermKeyVaultKeyExample.version,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermKustoClusterCustomerManagedKeyExample.overrideLogicalId("example");
Arguments Reference
The following arguments are supported:
-
clusterId
- (Required) The ID of the Kusto Cluster. Changing this forces a new resource to be created. -
keyVaultId
- (Required) The ID of the Key Vault. -
keyName
- (Required) The name of Key Vault Key. -
keyVersion
- (Optional) The version of Key Vault Key. -
userIdentity
- (Optional) The user assigned identity that has access to the Key Vault Key. If not specified, system assigned identity will be used.
Attributes Reference
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the Kusto Cluster.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Kusto Cluster Customer Managed Key.read
- (Defaults to 5 minutes) Used when retrieving the Kusto Cluster Customer Managed Key.update
- (Defaults to 30 minutes) Used when updating the Kusto Cluster Customer Managed Key.delete
- (Defaults to 30 minutes) Used when deleting the Kusto Cluster Customer Managed Key.
Import
Customer Managed Keys for a Kusto Cluster can be imported using the resourceId
, e.g.