Skip to content

libre-devops/terraform-azurerm-azure-container-registry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

module "rg" {
  source = "registry.terraform.io/libre-devops/rg/azurerm"

  rg_name  = "rg-${var.short}-${var.loc}-${terraform.workspace}-build" // rg-ldo-euw-dev-build
  location = local.location                                            // compares var.loc with the var.regions var to match a long-hand name, in this case, "euw", so "westeurope"
  tags     = local.tags

  #  lock_level = "CanNotDelete" // Do not set this value to skip lock
}

module "network" {
  source = "registry.terraform.io/libre-devops/network/azurerm"

  rg_name  = module.rg.rg_name // rg-ldo-euw-dev-build
  location = module.rg.rg_location
  tags     = local.tags

  vnet_name     = "vnet-${var.short}-${var.loc}-${terraform.workspace}-01" // vnet-ldo-euw-dev-01
  vnet_location = module.network.vnet_location

  address_space   = ["10.0.0.0/16"]
  subnet_prefixes = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
  subnet_names    = ["sn1-${module.network.vnet_name}", "sn2-${module.network.vnet_name}", "sn3-${module.network.vnet_name}"] //sn1-vnet-ldo-euw-dev-01
  subnet_service_endpoints = {
    "sn1-${module.network.vnet_name}" = ["Microsoft.Storage"]                   // Adds extra subnet endpoints to sn1-vnet-ldo-euw-dev-01
    "sn2-${module.network.vnet_name}" = ["Microsoft.Storage", "Microsoft.Sql"], // Adds extra subnet endpoints to sn2-vnet-ldo-euw-dev-01
    "sn3-${module.network.vnet_name}" = ["Microsoft.AzureActiveDirectory"]      // Adds extra subnet endpoints to sn3-vnet-ldo-euw-dev-01
  }
}

module "acr" {
  source = "registry.terraform.io/libre-devops/azure-container-registry/azurerm"

  rg_name  = module.rg.rg_name
  location = module.rg.rg_location
  tags     = module.rg.rg_tags

  acr_name      = "acr${var.short}${var.loc}${terraform.workspace}01"
  sku           = "Premium"
  identity_type = "SystemAssigned"
  admin_enabled = true

  settings = {
    network_rule_set = {
      virtual_network = {
        action    = "Allow"
        subnet_id = element(values(module.network.subnets_ids), 0)
      }
    }
  }
}

Requirements

No requirements.

Providers

Name Version
azurerm n/a

Modules

No modules.

Resources

Name Type
azurerm_container_registry.acr resource

Inputs

Name Description Type Default Required
acr_name The name of the acr string n/a yes
admin_enabled If an admin account is enabled for the ACR, defaults to true bool true no
anonymous_pull_enabled If anonymous pulling from your container registry is enabled, defaults to false bool false no
data_endpoint_enabled Whether the data endpoint for the registry is enabled, default true bool true no
export_policy_enabled If a export policy is enabled, note, only works on premium sku bool null no
identity_ids Specifies a list of user managed identity ids to be assigned to the VM. list(string) [] no
identity_type The Managed Service Identity Type of this Virtual Machine. string "" no
location The location for this resource to be put in string n/a yes
network_rule_bypass_option Whether bypass is enabled, defaults to AzureServices string "AzureServices" no
public_network_access_enabled If public access to your ACR should be enabled, defaults to false bool false no
quarantine_policy_enabled If a quarantine policy is enabled, note, only works on premium sku bool null no
rg_name The name of the resource group, this module does not create a resource group, it is expecting the value of a resource group already exists string n/a yes
settings Specifies the Authentication enabled or not any false no
sku The SKU of the ACR string n/a yes
tags A map of the tags to use on the resources that are deployed with this module. map(string)
{
"source": "terraform"
}
no
zone_redundancy_enabled If a zone redundancy is enabled, note, only works on premium sku bool null no

Outputs

Name Description
acr_admin_password The Username associated with the Container Registry Admin account - if the admin account is enabled.
acr_admin_username The Username associated with the Container Registry Admin account - if the admin account is enabled.
acr_id The ID of the Container Registry
acr_login_server The URL that can be used to log into the container registry