Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pulling container images from ACR using managed identity #39

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Pull the base image with given version.
ARG BUILD_TERRAFORM_VERSION="0.14.4"
ARG BUILD_TERRAFORM_VERSION="1.3"
FROM mcr.microsoft.com/terraform-test:${BUILD_TERRAFORM_VERSION}

ARG MODULE_NAME="terraform-azure-devops-agent-aci"
Expand Down
14 changes: 8 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ resource "azurerm_container_group" "linux-container-group" {
dynamic "image_registry_credential" {
for_each = var.image_registry_credential.server == "" ? [] : [1]
content {
username = var.image_registry_credential.username
password = var.image_registry_credential.password
server = var.image_registry_credential.server
user_assigned_identity_id = var.image_registry_credential.user_assigned_identity_id
username = var.image_registry_credential.username
password = var.image_registry_credential.password
server = var.image_registry_credential.server
}
}

Expand Down Expand Up @@ -144,9 +145,10 @@ resource "azurerm_container_group" "windows-container-group" {
dynamic "image_registry_credential" {
for_each = var.image_registry_credential.server == "" ? [] : [1]
content {
username = var.image_registry_credential.username
password = var.image_registry_credential.password
server = var.image_registry_credential.server
user_assigned_identity_id = var.image_registry_credential.user_assigned_identity_id
username = var.image_registry_credential.username
password = var.image_registry_credential.password
server = var.image_registry_credential.server
}
}
}
4 changes: 2 additions & 2 deletions test/fixture/linux-agents-import-rg/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.16.0"
version = ">= 3.29.0"
}
}
}

provider "azurerm" {
features {}
}
}
4 changes: 2 additions & 2 deletions test/fixture/linux-agents-managed-identities/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.16.0"
version = ">= 3.29.0"
}
}
}

provider "azurerm" {
features {}
}
}
4 changes: 2 additions & 2 deletions test/fixture/linux-agents-private-registry/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.16.0"
version = ">= 3.29.0"
}
}
}

provider "azurerm" {
features {}
}
}
4 changes: 2 additions & 2 deletions test/fixture/linux-agents-vnet/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.16.0"
version = ">= 3.29.0"
}
}
}

provider "azurerm" {
features {}
}
}
4 changes: 2 additions & 2 deletions test/fixture/linux-agents/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.16.0"
version = ">= 3.29.0"
}
}
}

provider "azurerm" {
features {}
}
}
4 changes: 2 additions & 2 deletions test/fixture/linux-and-windows-agents/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.16.0"
version = ">= 3.29.0"
}
}
}

provider "azurerm" {
features {}
}
}
11 changes: 5 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,14 @@ variable "windows_agents_configuration" {

variable "image_registry_credential" {
type = object({
username = string,
password = string,
server = string
user_assigned_identity_id = optional(string),
username = optional(string),
password = optional(string),
server = string
})
description = "(Optional) The credentials to use to connect to the Docker private registry where agent images are stored."
default = {
username = "",
password = "",
server = ""
server = ""
}
}

Expand Down