azurermAppConfigurationKey
Manages an Azure App Configuration Key.
-> Note: App Configuration Keys are provisioned using a Data Plane API which requires the role appConfigurationDataOwner
on either the App Configuration or a parent scope (such as the Resource Group/Subscription). More information can be found in the Azure Documentation for App Configuration.
Example Usage of kv
type
/*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 azurermAppConfigurationAppconf =
new azurerm.appConfiguration.AppConfiguration(this, "appconf", {
location: azurermResourceGroupExample.location,
name: "appConf1",
resource_group_name: azurermResourceGroupExample.name,
});
const azurermRoleAssignmentAppconfDataowner =
new azurerm.roleAssignment.RoleAssignment(this, "appconf_dataowner", {
principal_id: dataAzurermClientConfigCurrent.objectId,
role_definition_name: "App Configuration Data Owner",
scope: azurermAppConfigurationAppconf.id,
});
new azurerm.appConfigurationKey.AppConfigurationKey(this, "test", {
configuration_store_id: azurermAppConfigurationAppconf.id,
depends_on: [`\${${azurermRoleAssignmentAppconfDataowner.fqn}}`],
key: "appConfKey1",
label: "somelabel",
value: "a test",
});
Example Usage of vault
type
/*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 azurermAppConfigurationAppconf =
new azurerm.appConfiguration.AppConfiguration(this, "appconf", {
location: azurermResourceGroupExample.location,
name: "appConf1",
resource_group_name: azurermResourceGroupExample.name,
});
const azurermKeyVaultKv = new azurerm.keyVault.KeyVault(this, "kv", {
access_policy: [
{
key_permissions: ["Create", "Get"],
object_id: dataAzurermClientConfigCurrent.objectId,
secret_permissions: ["Set", "Get", "Delete", "Purge", "Recover"],
tenant_id: dataAzurermClientConfigCurrent.tenantId,
},
],
location: "${azurerm_resource_group.test.location}",
name: "kv",
resource_group_name: "${azurerm_resource_group.test.name}",
sku_name: "premium",
soft_delete_retention_days: 7,
tenant_id: dataAzurermClientConfigCurrent.tenantId,
});
const azurermKeyVaultSecretKvs = new azurerm.keyVaultSecret.KeyVaultSecret(
this,
"kvs",
{
key_vault_id: azurermKeyVaultKv.id,
name: "kvs",
value: "szechuan",
}
);
const azurermRoleAssignmentAppconfDataowner =
new azurerm.roleAssignment.RoleAssignment(this, "appconf_dataowner", {
principal_id: dataAzurermClientConfigCurrent.objectId,
role_definition_name: "App Configuration Data Owner",
scope: azurermAppConfigurationAppconf.id,
});
new azurerm.appConfigurationKey.AppConfigurationKey(this, "test", {
configuration_store_id: "${azurerm_app_configuration.test.id}",
depends_on: [`\${${azurermRoleAssignmentAppconfDataowner.fqn}}`],
key: "key1",
label: "label1",
type: "vault",
vault_key_reference: azurermKeyVaultSecretKvs.versionlessId,
});
Argument Reference
The following arguments are supported:
-
configurationStoreId
- (Required) Specifies the id of the App Configuration. Changing this forces a new resource to be created. -
key
- (Required) The name of the App Configuration Key to create. Changing this forces a new resource to be created. -
contentType
- (Optional) The content type of the App Configuration Key. This should only be set when type is set tokv
. -
label
- (Optional) The label of the App Configuration Key. Changing this forces a new resource to be created. -
value
- (Optional) The value of the App Configuration Key. This should only be set when type is set tokv
. -
locked
- (Optional) Should this App Configuration Key be Locked to prevent changes? -
type
- (Optional) The type of the App Configuration Key. It can either bekv
(simple key/value) orvault
(where the value is a reference to a Key Vault Secret. -
vaultKeyReference
- (Optional) The ID of the vault secret this App Configuration Key refers to, whentype
is set tovault
.
\~> NOTE: When setting the vaultKeyReference
using the id
will pin the value to specific version of the secret, to reference latest secret value use versionlessId
tags
- (Optional) A mapping of tags to assign to the resource.
Attributes Reference
The following attributes are exported:
-
id
- The App Configuration Key ID. -
etag
- (Optional) The ETag of the key.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 45 minutes) Used when creating the App Configuration Key.update
- (Defaults to 30 minutes) Used when updating the App Configuration Key.read
- (Defaults to 5 minutes) Used when retrieving the App Configuration Key.delete
- (Defaults to 30 minutes) Used when deleting the App Configuration Key.
Import
App Configuration Keys can be imported using the resourceId
, e.g.
terraform import azurerm_app_configuration_key.test https://appconfname1.azconfig.io/kv/keyName?label=labelName
If you wish to import a key with an empty label then simply leave label's name blank: