Skip to content

8BallDuVal/ACR-Terraform-Scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Deploy an Azure Container Registry Instance using Terraform

This repository contains Terraform script(s) that will deploy a private azure container registry (ACR) instance for you. The ACR instance is private, and will only be accessible via a private endpoint (public network access is disabled).

Prerequisites

Software Required:

Create the following resources in Azure to store the terraform state file in an azure storage account:

  • resource group
  • storage account
  • storage container
  • private endpoint for storage account

For more info about storing the terraform state file remotely, see this page.

On the command line before running this terraform script:

az login
az account show                                     # verify you are in correct subscription
az account set --subscription <subscription-name>   # to set az cli to correct subscription if necessary
terraform init
terraform plan
terraform apply

Following tutorial to login and push/pull docker images from ACR:

https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-docker-cli?tabs=azure-cli

Commands used to test ACR functionality:

#### Set variables. ####
# If using Linux/Bash, use this syntax.
ACR_NAME="testACRduval"     # If using Linux/Bash, use this syntax.
SUBSCRIPTION_NAME="test-subscription-duval"

# If using Powershell, use this syntax.
#$ACR_NAME="testACRduval"    
#$SUBSCRIPTION_NAME="test-subscription-duval"

# Log in to az cli in the correct subscription
az login
az account set --subscription $SUBSCRIPTION_NAME   # to set az cli to correct subscription if necessary

# log in to ACR
az acr login --name $ACR_NAME

# Example of pushing an image to your ACR instance
docker pull mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine
docker tag mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine $ACR_NAME.azurecr.io/samples/nginx 
docker push $ACR_NAME.azurecr.io/samples/nginx

# Example of pulling an image from your ACR instance
docker pull $ACR_NAME.azurecr.io/samples/nginx

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages