hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.59k stars 4.63k forks source link

Support for Container Configuration on Azure Batch Pool StartTask #7001

Open seniorpaul opened 4 years ago

seniorpaul commented 4 years ago

Community Note

Description

Azure Batch Pools can be Docker compatible if they have a container configuration supplied to them; Batch Pools also support a "StartTask" that can also be container based. Unfortunately, the current Terraform API version does not support this fully. It would be good if the the start task container_configuratin supported the same container settings as that supported for standard tasks. I've linked to the Azure API for TaskContainerSettings as well.

New or Affected Resource(s)

Potential Terraform Configuration

resource "azurerm_batch_pool" "test" {
  name                = "testaccpool"
  resource_group_name = "${azurerm_resource_group.test.name}"
  account_name        = "${azurerm_batch_account.test.name}"
  display_name        = "Test Acc Pool Auto"
  vm_size             = "Standard_A1"
  node_agent_sku_id   = "batch.node.ubuntu 16.04"

  storage_image_reference {
    publisher = "microsoft-azure-batch"
    offer     = "ubuntu-server-container"
    sku       = "16-04-lts"
    version   = "latest"
  }
  start_task {
    command_line         = "/bin/sh -c ''"
    max_task_retry_count = 5
    wait_for_success     = true

    container_configuration {
      containerRunOptions = "--workdir /app"
      imageName = "containerregisty.azurecr.io/imagename:latest",
      workingDirectory = "taskWorkingDirectory"
    }
  }
  container_configuration {
    container_image_names = ["ubuntu", "hello-world"]
    container_registries = [
      {
        registry_server = "registry-server-url"
        user_name = "registry-username"
        password = "registry-password"
      }
    ]
  }
}

References

https://docs.microsoft.com/en-gb/azure/batch/batch-docker-container-workloads https://docs.microsoft.com/en-us/rest/api/batchmanagement/pool/create#starttask https://docs.microsoft.com/en-us/rest/api/batchmanagement/pool/create#taskcontainersettings

tonytilbo commented 3 years ago

Is there any update on this open issue?

ironf1st commented 2 years ago

This is still an outstanding missing feature for Batch Pools. Currently there is no way to do container configurations or container tasks via azurerm.