Skip to content

azurermContainerConnectedRegistry

Manages a Container Connected Registry.

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.*/
new azurerm.provider.AzurermProvider(this, "azurerm", {
  features: [{}],
});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-rg",
  }
);
const azurermContainerRegistryExample =
  new azurerm.containerRegistry.ContainerRegistry(this, "example_2", {
    data_endpoint_enabled: true,
    location: azurermResourceGroupExample.location,
    name: "exampleacr",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Premium",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermContainerRegistryExample.overrideLogicalId("example");
const azurermContainerRegistryScopeMapExample =
  new azurerm.containerRegistryScopeMap.ContainerRegistryScopeMap(
    this,
    "example_3",
    {
      actions: [
        "repositories/hello-world/content/delete",
        "repositories/hello-world/content/read",
        "repositories/hello-world/content/write",
        "repositories/hello-world/metadata/read",
        "repositories/hello-world/metadata/write",
        "gateway/examplecr/config/read",
        "gateway/examplecr/config/write",
        "gateway/examplecr/message/read",
        "gateway/examplecr/message/write",
      ],
      container_registry_name: azurermContainerRegistryExample.name,
      name: "examplescopemap",
      resource_group_name: azurermContainerRegistryExample.resourceGroupName,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermContainerRegistryScopeMapExample.overrideLogicalId("example");
const azurermContainerRegistryTokenExample =
  new azurerm.containerRegistryToken.ContainerRegistryToken(this, "example_4", {
    container_registry_name: azurermContainerRegistryExample.name,
    name: "exampletoken",
    resource_group_name: azurermContainerRegistryExample.resourceGroupName,
    scope_map_id: azurermContainerRegistryScopeMapExample.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.*/
azurermContainerRegistryTokenExample.overrideLogicalId("example");
const azurermContainerConnectedRegistryExample =
  new azurerm.containerConnectedRegistry.ContainerConnectedRegistry(
    this,
    "example_5",
    {
      container_registry_id: azurermContainerRegistryExample.id,
      name: "examplecr",
      sync_token_id: azurermContainerRegistryTokenExample.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.*/
azurermContainerConnectedRegistryExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • containerRegistryId - (Required) The ID of the Container Registry that this Connected Registry will reside in. Changing this forces a new Container Connected Registry to be created.

-> If parentRegistryId is not specified, the Connected Registry will be connected to the Container Registry identified by containerRegistryId.

  • name - (Required) The name which should be used for this Container Connected Registry. Changing this forces a new Container Connected Registry to be created.

  • syncTokenId - (Required) The ID of the Container Registry Token which is used for synchronizing the Connected Registry. Changing this forces a new Container Connected Registry to be created.


  • auditLogEnabled - (Optional) Should the log auditing be enabled?

  • clientTokenIds - (Optional) Specifies a list of IDs of Container Registry Tokens, which are meant to be used by the clients to connect to the Connected Registry.

  • logLevel - (Optional) The verbosity of the logs. Possible values are none, debug, information, warning and error.

  • mode - (Optional) The mode of the Connected Registry. Possible values are mirror, readOnly, readWrite and registry. Changing this forces a new Container Connected Registry to be created.

  • notification - (Optional) One or more notification blocks as defined below.

  • parentRegistryId - (Optional) The ID of the parent registry. This can be either a Container Registry ID or a Connected Registry ID. Changing this forces a new Container Connected Registry to be created.

  • syncMessageTtl - (Optional) The period of time (in form of ISO8601) for which a message is available to sync before it is expired. Allowed range is from p1D to p90D.

  • syncSchedule - (Optional) The cron expression indicating the schedule that the Connected Registry will sync with its parent. Defaults to * * * * *.

  • syncWindow - (Optional) The time window (in form of ISO8601) during which sync is enabled for each schedule occurrence. Allowed range is from pt3H to p7D.


A notification block supports the following:

  • name - (Required) The name of the artifact that wants to be subscribed for the Connected Registry.

  • action - (Required) The action of the artifact that wants to be subscribed for the Connected Registry. Possible values are push, delete and * (i.e. any).

  • tag - (Optional) The tag of the artifact that wants to be subscribed for the Connected Registry.

  • digest - (Optional) The digest of the artifact that wants to be subscribed for the Connected Registry.

\~> NOTE: One of either tag or digest can be specified.

Attributes Reference

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

  • id - The ID of the Container Connected Registry.

Timeouts

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

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

Import

Container Connected Registries can be imported using the resourceId, e.g.

terraform import azurerm_container_connected_registry.example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.ContainerRegistry/registries/registry1/connectedRegistries/registry1