Create an Azure Container Instance (ACI) With Terraform

In this blog post, we will learn how to create an Azure Container Instance (ACI) group using Terraform and deploy a Docker image from Azure ACR.

Deployment

In the following Terraform configuration code, I will deploy an ACI container group with a single container and use a Docker image stored in Azure Container Registry (ACR).

To access ACR, I’m using the following code which is located in line 29. If you use ACR, you will fill in the registry details as shown below. If you use a public image, remove the image code and add the path in line 37.

image_registry_credential {
    server   = "servername.azurecr.io"
    username = "acrusername"
    password = "acrpassword"
  }

Code

To access the code, please check the configuration file below or our GitHub repository.

https://github.com/ntweeklycom/code/blob/main/terraform/1.Create_ACI/deploy.tf


Posted

in

,

by