azurerm_container_group

Manages as an Azure Container Group instance.

Example Usage

This example provisions a Basic Container. Other examples of the azurerm_container_group resource can be found in the ./examples/container-instance directory within the GitHub Repository.

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_container_group" "example" {
  name                = "example-continst"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  ip_address_type     = "Public"
  dns_name_label      = "aci-label"
  os_type             = "Linux"

  container {
    name   = "hello-world"
    image  = "mcr.microsoft.com/azuredocs/aci-helloworld:latest"
    cpu    = "0.5"
    memory = "1.5"

    ports {
      port     = 443
      protocol = "TCP"
    }
  }

  container {
    name   = "sidecar"
    image  = "mcr.microsoft.com/azuredocs/aci-tutorial-sidecar"
    cpu    = "0.5"
    memory = "1.5"
  }

  tags = {
    environment = "testing"
  }
}

Argument Reference

The following arguments are supported:



An identity block supports the following:


An init_container block supports:


A container block supports:


An exposed_port block supports:


A diagnostics block supports:


An image_registry_credential block supports:


A log_analytics block supports:


A ports block supports:


A volume block supports:


The git_repo block supports:


The readiness_probe block supports:


The liveness_probe block supports:


The http_get block supports:


The dns_config block supports:


The security block supports:

Attributes Reference

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


An identity block exports the following:

Timeouts

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

Import

Container Group's can be imported using the resource id, e.g.

terraform import azurerm_container_group.containerGroup1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ContainerInstance/containerGroups/myContainerGroup1