Skip to content

azurermKeyVaultCertificateContacts

Manages Key Vault Certificate Contacts.

Disclaimers

\~> Note: It's possible to define Key Vault Certificate Contacts both within the azurermKeyVault resource via the contact block and by using the azurermKeyVaultCertificateContacts resource. However it's not possible to use both methods to manage Certificate Contacts within a KeyVault, since there'll be conflicts.

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: "examplekeyvault",
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "premium",
    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 azurermKeyVaultAccessPolicyExample =
  new azurerm.keyVaultAccessPolicy.KeyVaultAccessPolicy(this, "example_3", {
    certificate_permissions: ["ManageContacts"],
    key_permissions: ["Create"],
    key_vault_id: azurermKeyVaultExample.id,
    object_id: dataAzurermClientConfigCurrent.objectId,
    secret_permissions: ["Set"],
    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.*/
azurermKeyVaultAccessPolicyExample.overrideLogicalId("example");
const azurermKeyVaultCertificateContactsExample =
  new azurerm.keyVaultCertificateContacts.KeyVaultCertificateContacts(
    this,
    "example_4",
    {
      contact: [
        {
          email: "example@example.com",
          name: "example",
          phone: "01234567890",
        },
        {
          email: "example2@example.com",
        },
      ],
      depends_on: [`\${${azurermKeyVaultAccessPolicyExample.fqn}}`],
      key_vault_id: "${azurerm_key_vault.test.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.*/
azurermKeyVaultCertificateContactsExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • keyVaultId - (Required) The ID of the Key Vault. Changing this forces a new resource to be created.

  • contact - (Required) One or more contact blocks as defined below.


A contact block supports the following:

  • email - (Required) E-mail address of the contact.

  • name - (Optional) Name of the contact.

  • phone - (Optional) Phone number of the contact.

Attributes Reference

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

  • id - The ID of the Key Vault Certificate Contacts.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Key Vault Certificate Contacts.
  • read - (Defaults to 5 minutes) Used when retrieving the Key Vault Certificate Contacts.
  • update - (Defaults to 30 minutes) Used when updating the Key Vault Certificate Contacts.
  • delete - (Defaults to 30 minutes) Used when deleting the Key Vault Certificate Contacts.

Import

Key Vault Certificate Contacts can be imported using the resourceId, e.g.

terraform import azurerm_key_vault_certificate_contacts.example https://example-keyvault.vault.azure.net/certificates/contacts