Skip to content

azurermContainerRegistryWebhook

Manages an Azure Container Registry Webhook.

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 azurermContainerRegistryAcr =
  new azurerm.containerRegistry.ContainerRegistry(this, "acr", {
    admin_enabled: false,
    location: azurermResourceGroupExample.location,
    name: "containerRegistry1",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Standard",
  });
new azurerm.containerRegistryWebhook.ContainerRegistryWebhook(this, "webhook", {
  actions: ["push"],
  custom_headers: [
    {
      "Content-Type": "application/json",
    },
  ],
  location: azurermResourceGroupExample.location,
  name: "mywebhook",
  registry_name: azurermContainerRegistryAcr.name,
  resource_group_name: azurermResourceGroupExample.name,
  scope: "mytag:*",
  service_uri: "https://mywebhookreceiver.example/mytag",
  status: "enabled",
});

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Container Registry Webhook. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which to create the Container Registry Webhook. Changing this forces a new resource to be created.

  • registryName - (Required) The Name of Container registry this Webhook belongs to. Changing this forces a new resource to be created.

  • location - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

  • serviceUri - (Required) Specifies the service URI for the Webhook to post notifications.

  • actions - (Required) A list of actions that trigger the Webhook to post notifications. At least one action needs to be specified. Valid values are: push, delete, quarantine, chartPush, chartDelete

  • status - (Optional) Specifies if this Webhook triggers notifications or not. Valid values: enabled and disabled. Default is enabled.

  • scope - (Optional) Specifies the scope of repositories that can trigger an event. For example, foo:* means events for all tags under repository foo. foo:bar means events for 'foo:bar' only. foo is equivalent to foo:latest. Empty means all events. Defaults to "".

  • customHeaders - (Optional) Custom headers that will be added to the webhook notifications request.

  • tags - (Optional) A mapping of tags to assign to the resource.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Container Registry Webhook.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Container Registry Webhook.
  • update - (Defaults to 30 minutes) Used when updating the Container Registry Webhook.
  • read - (Defaults to 5 minutes) Used when retrieving the Container Registry Webhook.
  • delete - (Defaults to 30 minutes) Used when deleting the Container Registry Webhook.

Import

Container Registry Webhooks can be imported using the resourceId, e.g.

terraform import azurerm_container_registry_webhook.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ContainerRegistry/registries/myregistry1/webHooks/mywebhook1