W3cubDocs

/Terraform

azurerm_container_registry

Manages an Azure Container Registry.

Example Usage

resource "azurerm_resource_group" "test" {
  name     = "resourceGroup1"
  location = "West US"
}

resource "azurerm_storage_account" "test" {
  name                     = "storageaccount1"
  resource_group_name      = "${azurerm_resource_group.test.name}"
  location                 = "${azurerm_resource_group.test.location}"
  account_tier             = "Standard"
  account_replication_type = "GRS"
}

resource "azurerm_container_registry" "test" {
  name                = "containerRegistry1"
  resource_group_name = "${azurerm_resource_group.test.name}"
  location            = "${azurerm_resource_group.test.location}"
  admin_enabled       = true
  sku                 = "Classic"
  storage_account_id  = "${azurerm_storage_account.test.id}"
}

Argument Reference

The following arguments are supported:

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

  • resource_group_name - (Required) The name of the resource group in which to create the Container Registry. 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.

  • admin_enabled - (Optional) Specifies whether the admin user is enabled. Defaults to false.

  • storage_account_id - (Required for Classic Sku - Optional otherwise) The ID of a Storage Account which must be located in the same Azure Region as the Container Registry.

  • sku - (Optional) The SKU name of the the container registry. Possible values are Classic (which was previously Basic), Basic, Standard and Premium.

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

Attributes Reference

The following attributes are exported:

  • id - The Container Registry ID.

  • login_server - The URL that can be used to log into the container registry.

  • admin_username - The Username associated with the Container Registry Admin account - if the admin account is enabled.

  • admin_password - The Password associated with the Container Registry Admin account - if the admin account is enabled.

Import

Container Registries can be imported using the resource id, e.g.

terraform import azurerm_container_registry.test /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/mygroup1/providers/Microsoft.ContainerRegistry/registries/myregistry1

© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/azurerm/r/container_registry.html