Giter VIP home page Giter VIP logo

terraform-azurerm-aci-devops-agent's Introduction

terraform-azurerm-aci-devops-agent

This repository contains a Terraform module that helps you to deploy Azure DevOps self-hosted agents running on Azure Container Instance.

You can choose to deploy Linux or Windows agents, provide custom Docker images for the agents to include the tools you really need. It also give you the option to deploy the agents into a private virtual network, if the agents needs to access internal resources.

How-to use this module to deploy Azure DevOps agents

Build the Docker images

This module requires that you build your own Linux and/or Windows Docker images, to run the Azure DevOps agents. The docker contains Dockerfile and instructions for both.

Create an Azure DevOps agent pool and personal access token

Before running this module, you need to create an agent pool in your Azure DevOps organization and a personal access token that it authorized to manage this agent pool.

This module has 3 variables related to Azure DevOps:

  • azure_devops_org_name: the name of your Azure DevOps organization (if you are connecting to https://dev.azure.com/helloworld, then helloworld is your organization name)
  • azure_devops_personal_access_token: the personal access token that you have generated
  • agent_pool_name: both in the linux_agents_configuration and windows_agents_configuration, it is the name of the agent pool that you have created in which the Linux or Windows agents must be deployed

Terraform ACI DevOps Agents usage

Create or use an existing a resource group

This module offers to create a new resource group to deploy the Azure Container instances into it, or import an existing one. This behavior is controlled using the create_resource_group flag:

  • if create_resource_group is set to true, the module will create a resource group named resource_group_name in the location region
  • if create_resource_group is set to false, the module will import a resource group data source with the name resource_group_name

Terraform ACI DevOps Agents - Deploy Linux Agents

The configuration below can be used to deploy Linux DevOps agents using Azure Container Instances.

module "aci-devops-agent" {
  source                  = "Azure/aci-devops-agent/azurerm"
  version                 = "0.9.2"
  resource_group_name     = "rg-linux-devops-agents"
  location                = "westeurope"
  enable_vnet_integration = false
  create_resource_group   = true

  linux_agents_configuration = {
    agent_name_prefix = "linux-agent"
    agent_pool_name   = "DEVOPS_POOL_NAME"
    count             = 2,
    docker_image      = "jcorioland/aci-devops-agent"
    docker_tag        = "0.2-linux"
    cpu               = 1
    memory            = 4
    user_assigned_identity_ids   = []
    use_system_assigned_identity = false
  }
  azure_devops_org_name              = "DEVOPS_ORG_NAME"
  azure_devops_personal_access_token = "DEVOPS_PERSONAL_ACCESS_TOKEN"
}

Then, you can just Terraform it:

terraform init
terraform plan -out aci-linux-devops-agents.plan
terraform apply "aci-linux-devops-agents.plan"

You can destroy everything using terraform destroy:

terraform destroy

Terraform ACI DevOps Agents - Deploy Linux agents in an existing virtual network

Note: Virtual Network integration is only supported for Linux Containers in ACI. This part does not apply to Windows Containers. The configuration below can be used to deploy Azure DevOps agents in Linux containers, in an existing virtual network.

resource "azurerm_resource_group" "vnet-rg" {
  name     = "rg-aci-devops-network"
  location = "westeurope"
}

resource "azurerm_virtual_network" "vnet" {
  name                = "vnet-aci-devops"
  address_space       = ["10.0.0.0/16"]
  location            = azurerm_resource_group.vnet-rg.location
  resource_group_name = azurerm_resource_group.vnet-rg.name
}

resource "azurerm_subnet" "aci-subnet" {
  name                 = "aci-subnet"
  resource_group_name  = azurerm_resource_group.vnet-rg.name
  virtual_network_name = azurerm_virtual_network.vnet.name
  address_prefixes     = ["10.0.1.0/24"]

  delegation {
    name = "acidelegation"

    service_delegation {
      name    = "Microsoft.ContainerInstance/containerGroups"
      actions = ["Microsoft.Network/virtualNetworks/subnets/join/action", "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action"]
    }
  }
}

module "aci-devops-agent" {
  source                   = "Azure/aci-devops-agent/azurerm"
  version                  = "0.9.2"
  resource_group_name      = "rg-linux-devops-agents"
  location                 = "westeurope"
  enable_vnet_integration  = true
  create_resource_group    = true
  vnet_resource_group_name = azurerm_resource_group.vnet-rg.name
  vnet_name                = azurerm_virtual_network.vnet.name
  subnet_name              = azurerm_subnet.aci-subnet.name

  linux_agents_configuration = {
    agent_name_prefix = "linux-agent"
    agent_pool_name   = "DEVOPS_POOL_NAME"
    count             = 2,
    docker_image      = "jcorioland/aci-devops-agent"
    docker_tag        = "0.2-linux"
    cpu               = 1
    memory            = 4
    user_assigned_identity_ids   = []
    use_system_assigned_identity = false
  }

  azure_devops_org_name              = "DEVOPS_ORG_NAME"
  azure_devops_personal_access_token = "DEVOPS_PERSONAL_ACCESS_TOKEN"
}

Then, you can just Terraform it:

terraform init
terraform plan -out aci-linux-devops-agents.plan
terraform apply "aci-linux-devops-agents.plan"

You can destroy everything using terraform destroy:

terraform destroy

Terraform ACI DevOps Agents - Deploy both Linux and Windows agents

The configuration below can be used to deploy Azure DevOps Linux and Windows agents in containers on ACI.

module "aci-devops-agent" {
  source                  = "Azure/aci-devops-agent/azurerm"
  version                 = "0.9.2"
  resource_group_name     = "rg-aci-devops-agents-we"
  location                = "westeurope"
  enable_vnet_integration = false
  create_resource_group   = true

  linux_agents_configuration = {
    agent_name_prefix = "linux-agent"
    agent_pool_name   = "DEVOPS_POOL_NAME"
    count             = 2,
    docker_image      = "jcorioland/aci-devops-agent"
    docker_tag        = "0.2-linux"
    cpu               = 1
    memory            = 4
    user_assigned_identity_ids   = []
    use_system_assigned_identity = false
  }

  windows_agents_configuration = {
    agent_name_prefix = "windows-agent"
    agent_pool_name   = "DEVOPS_POOL_NAME"
    count             = 2,
    docker_image      = "jcorioland/aci-devops-agent"
    docker_tag        = "0.2-win"
    cpu               = 1
    memory            = 4
  }

  azure_devops_org_name              = "DEVOPS_ORG_NAME"
  azure_devops_personal_access_token = "DEVOPS_PERSONAL_ACCESS_TOKEN"
}

Then, you can just Terraform it:

terraform init
terraform plan -out aci-devops-agents.plan
terraform apply "aci-devops-agents.plan"

You can destroy everything using terraform destroy:

terraform destroy

Terraform ACI DevOps Agents - Use a private Docker image registry

This module allows to download the Docker images to use for the agents from a private Docker images registry, like Azure Container Registry. It can be done like below:

module "aci-devops-agent" {
  source                  = "Azure/aci-devops-agent/azurerm"
  version                 = "0.9.2"
  resource_group_name     = "rg-linux-devops-agents"
  location                = "westeurope"
  enable_vnet_integration = false
  create_resource_group   = true

  linux_agents_configuration = {
    agent_name_prefix = "linux-agent"
    agent_pool_name   = "DEVOPS_POOL_NAME"
    count             = 2,
    docker_image      = "jcorioland.azurecr.io/azure-devops/aci-devops-agent"
    docker_tag        = "0.2-linux"
    cpu               = 1
    memory            = 4
    user_assigned_identity_ids   = []
    use_system_assigned_identity = false
  }
  azure_devops_org_name              = "DEVOPS_ORG_NAME"
  azure_devops_personal_access_token = "DEVOPS_PERSONAL_ACCESS_TOKEN"

  image_registry_credential = {
    username = "DOCKER_PRIVATE_REGISTRY_USERNAME"
    password = "DOCKER_PRIVATE_REGISTRY_PASSWORD"
    server   = "jcorioland.azurecr.io"
  }
}

Then, you can just Terraform it:

terraform init
terraform plan -out aci-linux-devops-agents.plan
terraform apply "aci-linux-devops-agents.plan"

You can destroy everything using terraform destroy:

terraform destroy

Terraform ACI DevOps Agents - Assign identities

This module allows to assign both system and user assigned managed identities to the containers:

NB: managed identities for container groups have limitations. Only Linux container groups that are not deployed to a virtual network can be assigned managed identities. See https://docs.microsoft.com/en-us/azure/container-instances/container-instances-virtual-network-concepts#other-limitations and https://docs.microsoft.com/en-us/azure/container-instances/container-instances-managed-identity for more details.

resource "azurerm_user_assigned_identity" "example1" {
  resource_group_name = "rg-terraform-azure-devops-agents-e2e-tests-${var.random_suffix}"
  location            = var.location

  name = "identity1"
}
resource "azurerm_user_assigned_identity" "example2" {
  resource_group_name = "rg-terraform-azure-devops-agents-e2e-tests-${var.random_suffix}"
  location            = var.location

  name = "identity2"
}
module "aci-devops-agent" {
  source                  = "Azure/aci-devops-agent/azurerm"
  version                 = "0.9.2"
  resource_group_name     = "rg-linux-devops-agents"
  location                = "westeurope"
  enable_vnet_integration = false
  create_resource_group   = true

  linux_agents_configuration = {
    agent_name_prefix = "linux-agent"
    agent_pool_name   = "DEVOPS_POOL_NAME"
    count             = 2,
    docker_image      = "jcorioland.azurecr.io/azure-devops/aci-devops-agent"
    docker_tag        = "0.2-linux"
    cpu               = 1
    memory            = 4
    user_assigned_identity_ids = [azurerm_user_assigned_identity.example1.id, data.azurerm_identity.example2.id]
    use_system_assigned_identity = true
  }
  azure_devops_org_name              = "DEVOPS_ORG_NAME"
  azure_devops_personal_access_token = "DEVOPS_PERSONAL_ACCESS_TOKEN"
}

Then, you can just Terraform it:

terraform init
terraform plan -out aci-linux-devops-agents.plan
terraform apply "aci-linux-devops-agents.plan"

You can destroy everything using terraform destroy:

terraform destroy

Test

Configurations

We provide 2 ways to build, run, and test the module on a local development machine. Native (Mac/Linux) or Docker.

Native (Mac/Linux)

Prerequisites

Environment setup

We provide simple script to quickly set up module development environment:

curl -sSL https://raw.githubusercontent.com/Azure/terramodtest/master/tool/env_setup.sh | sudo bash

Run test

Then simply run it in local shell:

bundle install
rake build
rake full

Docker

We provide a Dockerfile to build a new image based FROM the microsoft/terraform-test Docker hub image which adds additional tools / packages specific for this module (see Custom Image section). Alternatively use only the microsoft/terraform-test Docker hub image by using these instructions.

Prerequisites

Custom Image

This builds the custom image:

docker build \
    --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID \
    --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID \
    --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET \
    --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID \
    -t azure-devops-agent-aci-test .

NB: cf az ad sp create-for-rbac --help to get build-arg values

This runs the build and unit tests:

docker run --rm \
    -e TF_VAR_azure_devops_org_name=$AZDO_ORG_NAME \
    -e TF_VAR_azure_devops_personal_access_token=$AZDO_PAT \
    -e TF_VAR_azure_devops_pool_name=$AZDO_POOL_NAME \
    azure-devops-agent-aci-test /bin/bash -c "bundle install && rake build"

This runs the end to end tests:

docker run --rm \
    -e TF_VAR_azure_devops_org_name=$AZDO_ORG_NAME \
    -e TF_VAR_azure_devops_personal_access_token=$AZDO_PAT \
    -e TF_VAR_azure_devops_pool_name=$AZDO_POOL_NAME \
    azure-devops-agent-aci-test /bin/bash -c "bundle install && rake e2e"

This runs the full tests:

docker run --rm \
    -e TF_VAR_azure_devops_org_name=$AZDO_ORG_NAME \
    -e TF_VAR_azure_devops_personal_access_token=$AZDO_PAT \
    -e TF_VAR_azure_devops_pool_name=$AZDO_POOL_NAME \
    azure-devops-agent-aci-test /bin/bash -c "bundle install && rake full"

With:

  • AZDO_ORG_NAME being the name of the Azure DevOps organization
  • AZDO_PAT being the personal access token to connect to Azure DevOps
  • AZDO_POOL_NAME being the name of the Azure DevOps agent pool

Authors

Originally created by Julien Corioland

License

MIT

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

terraform-azurerm-aci-devops-agent's People

Contributors

benjguin avatar dependabot[bot] avatar james-flynn-ie avatar jcorioland avatar microsoftopensource avatar mozts2005 avatar vimal-vijayan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-azurerm-aci-devops-agent's Issues

Give control over resources names

Consumers of the module may want to control the name of the created resources, for example if they have a naming convention to follow.

Create a aci devops agent

I'm new in azure devops especially related to the aci devops agent.
May you have the video for how to run create the aci devops agent ? abit confusing from the article.

Docker in Docker

I'm trying to replace some build agents that another company was hosting for us. As they are no longer hosting said build agents for us I'm working on replacing them. I was able to get up to the point of building on the agent when I got this error message:

##[error]Unhandled: Unable to locate executable file: 'docker'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

In researching it appears to be that I need to run some form of docker.sock. But I'm not seeing how to do that with an ACI. Is there any way to do this? Either with this module or otherwise?

Improvement: Use for_each instead of count

Hi

Thanks for this module, even though I would not use it as it is currently, I do appreciate your article and the code provided here. It helped me get started with my own implementation (all though I would prefer to use a module).

Consider using for_each instead of count when creating resources. Reasoning for this is that if I configure 10 linux or windows images and at some point, decide to remove the first then all agents are destroyed and the remaining 9 are re-created.

Just an improvement note.

Kind Regards
Jakub

Docker Image fails to start

I am using the provided Dockerfile and am getting this error when I try and run the image both locally and in the container.

exec ./start.sh: no such file or directory

Any idea what's going on here? And how to fix it?

Readme fix

While passing external resources such as resource group and other services, the create resource flag should be set to false

"create_resource_group = false"

Support for tags

It'd be nice if the module supported tags

ERROR: Unsupported argument in module "aci-devops-agent"
tags = {

An argument named "tags" is not expected here

Add support for private registry

It should be possible to specify Docker images hosted in a private registry. For that, the module should accept credentials and connection information as input variables.

The container_group resource in Terraform has a image_registry_credential that allows to pass this information.

Terraform INIT failing with azure Devops self hosted agent on ACI

I have 2 terraform pipelines in azure devops:

1- provisions vnet and azure container instance and registers it as an agent pool node.
2- uses the self hosted agent pool which uses the aci from the first pipeline to provision other stuff.

The second pipeline fails when it reaches init with the following message:

##[error]Terraform command 'init' failed with exit code '1'.: Failed to get existing workspaces: containers.Client#ListBlobs: Failure sending request: StatusCode=0 -- Original Error: Get "https://xxx.blob.core.windows.net/terraform?comp=list&prefix=xxx-infra-dev.tfstateenv%253A&restype=container": dial tcp xx.xxx.xx.x:443: connect: connection timed out

this how I provision the ACI (I removed some parts from)

terraform {
  required_version = "~> 0.13"
  backend "azurerm" {}
}
provider "azurerm" {
  version                    = "~> 2.8.0"
  skip_provider_registration = true
  features {}
}


module "aci-devops-agent" {
  source                   = "Azure/aci-devops-agent/azurerm"
  resource_group_name      = var.resource_group_name
  location                 = var.location
  enable_vnet_integration  = true
  create_resource_group    = false
  vnet_resource_group_name = var.resource_group_name
  vnet_name                = local.virtual_network_name
  subnet_name              = data.azurerm_subnet.subnet["mgmt"].name

  linux_agents_configuration = {
    agent_name_prefix = "aci-${var.environment}-${var.app_name}"
    agent_pool_name   = var.agent_pool_name
    count             = 1,
    docker_image      = "jcorioland/aci-devops-agent"
    docker_tag        = "0.2-linux"
    cpu               = 1
    memory            = 4
  }

  azure_devops_org_name              = "xxx"
  azure_devops_personal_access_token = var.pat

}

and the agent is successfully detected in azure devops

image

Docker images size for running on ACI

Hello,

Thanks for your article which is very useful.

I saw that both, Linux or Windows docker images are more than 1,5 Go, is that an issue when running in term on top of ACI ?

Is there a way to reduce those images size ?

Add support for Azure Managed Identities (System Assigned and User Assigned)

Azure Container Instance (container group) supports managed identities (both system and user assigned) for Linux container groups. It would be great to support this in this module.

Proposed implementation:

resource "azurerm_user_assigned_identity" "example" {
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location

  name = "identity1"
}
resource "azurerm_user_assigned_identity" "example2" {
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location

  name = "identity2"
}
module "aci-devops-agent" {
  source                  = "../../../"
  enable_vnet_integration = false
  create_resource_group   = true
  linux_agents_configuration = {
    agent_name_prefix = "linuxagent-${var.random_suffix}"
    count             = var.agents_count
    docker_image      = var.agent_docker_image
    docker_tag        = var.agent_docker_tag
    agent_pool_name   = var.azure_devops_pool_name
    cpu               = 1
    memory            = 4
    # array to specify existing (or created by current template) user assigned identities
    user_assigned_identity_ids = [azurerm_user_assigned_identity.example.id, data.azurerm_identity.example2.id]

    # flag to enable system assigned identity (default = false for retrocompatibility)
    use_system_assigned_identity = true
  }
  image_registry_credential = {
    username = var.docker_registry_username
    password = var.docker_registry_password
    server   = var.docker_registry_url
  }
  resource_group_name                = "rg-terraform-azure-devops-agents-e2e-tests-${var.random_suffix}"
  location                           = var.location
  azure_devops_org_name              = var.azure_devops_org_name
  azure_devops_personal_access_token = var.azure_devops_personal_access_token
}

Remove provider.tf file as we do not pass the subscription as ENV variable

Since we do not pass the subscription ID as an environment variable, we are getting the below error.

Error building AzureRM Client: 1 error occurred:
	* A Subscription ID must be configured when authenticating as a Service Principal using a Client Secret.
  on .terraform/modules/agent.aci-devops-agent/provider.tf line 1, in provider "azurerm":
   1: provider "azurerm" {

Could you please make the subscription ID as an optional one?

provider "azurerm" {
  subscription_id= var.ARM_SUBSCRIPTION_ID ? var.ARM_SUBSCRIPTION_ID : <ENV variable for subscriptionid>
  features {}
}

Terraform breaks

Terraform breaks for os_type variable, expect "Linux and Windows" instead of "linux and windows".
Ip address type should "Private & Public" instead of "private & public"

  1. ip_address_type = var.enable_vnet_integration ? "private" : "public"
  2. os_type = "linux"
  3. ip_address_type = var.enable_vnet_integration ? "private" : "public"
  4. os_type = "windows"

Protect Personal Access Token env variables

AZP_TOKEN variable is not protected and can be accessed in clear in the portal for example.
An improvement on this can be to use secure_environment_variables to create the AZP_TOKEN environment variable.

This applies for windows and linux containers instances :

AZP_TOKEN = var.azure_devops_personal_access_token

AZP_TOKEN = var.azure_devops_personal_access_token

Issues with creating Azure Devops agent

When using your module I get this error

Error: Error building AzureRM Client: 1 error occurred:
* A Subscription ID must be configured when authenticating as a Service Principal using a Client Secret.
on .terraform/modules/aci-devops-agent/terraform-azurerm-aci-devops-agent-0.9/provider.tf line 1, in provider "azurerm":
1: provider "azurerm" {

Also my devops project is https://%projectname%.visualstudio.com/ wouldn't this cause an issue for your

So I tried to create the container based off your main.tf but I'm getting this error when trying to pull the image, I'm not sure if I'm configuring it wrong.

_t C:\azp\start.ps1:32 char:14

  • ... $package = Invoke-RestMethod -Headers @{Authorization=("Basic $base6 ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt
      pWebRequest) [Invoke-RestMethod], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
      ll.Commands.InvokeRestMethodCommand
      Cannot index into a null array.
      At C:\azp\start.ps1:33 char:3
  • $packageUrl = $package[0].Value.downloadUrl
  • + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray_
    
    
    
  1. Downloading and installing Azure Pipelines agent...
    Exception calling "DownloadFile" with "2" argument(s): "Value cannot be null.
    Parameter name: address"
    At C:\azp\start.ps1:40 char:36
  • $wc.DownloadFile($packageUrl, "$(Get-Location)\agent.zip")
  •                                ~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : ArgumentNullException

Expand-Archive : The path 'agent.zip' either does not exist or is not a valid
file system path.
At C:\azp\start.ps1:42 char:3

  • Expand-Archive -Path "agent.zip" -DestinationPath "\azp\agent"
  • + CategoryInfo          : InvalidArgument: (agent.zip:String) [Expand-Arch 
    

ive], InvalidOperationException
+ FullyQualifiedErrorId : ArchiveCmdletPathNotFound,Expand-Archive

  1. Configuring Azure Pipelines agent...
    Cleanup. Removing Azure Pipelines agent...
    .\config.cmd : The term '.\config.cmd' is not recognized as the name of a
    cmdlet, function, script file, or operable program. Check the spelling of the
    name, or if a path was included, verify that the path is correct and try again.
    At C:\azp\start.ps1:68 char:5
  • .\config.cmd remove --unattended `
    
  • ~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (.\config.cmd:String) [], Comman
      dNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

.\config.cmd : The term '.\config.cmd' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At C:\azp\start.ps1:48 char:5

  • .\config.cmd --unattended `
    
  • ~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (.\config.cmd:String) [], Comman
      dNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Hide azure_devops_personal_access_token output when running `terraform plan` โ“

Hi,
How can I hide confidential information from the Azure DevOps token that is displayed when executing the terraform plan?

  + resource "azurerm_container_group" "linux-container-group" {
      + fqdn                = (known after apply)
      + id                  = (known after apply)
      + ip_address          = (known after apply)
[...]

      + container {
          + commands              = (known after apply)
          + cpu                   = 1
          + environment_variables = {
              + "AZP_AGENT_NAME" = "..."
              + "AZP_POOL"       = "..."
              + "AZP_TOKEN"      = "TOKEN as plain text" # sensitive data

Clean up agents from pool when Terraform destroy is called

Currently, if you call the terraform destroy commands, all the containers instances are removed, but the agents are still present in the Azure DevOps agents pool. They are marked as offline, so no job can be scheduled on it, but still there and have to be removed manually.

image

We should find a way to clean up automatically when terraform destroy is called. Maybe using a local executer or something like that.

Windows Agents not appearing in DevOps agent pool

Hi there,

I have build Windows containers and pushed to ACR ok
The Terraform files build and the ACI's are running.
But the agents are not appearing in the Azure DevOps Agent pool

My Terraform Code:

module "aci-devops-agent" {
source = "Azure/aci-devops-agent/azurerm"
resource_group_name = "rg-aci-devops"
location = "uksouth"
create_resource_group = true

enable_vnet_integration = false

windows_agents_configuration = {
agent_name_prefix = "windows-agent"
agent_pool_name   = "Azure_Docker_Pool_TestLabs"
count             = 2,
docker_image      = "acrnewasm.azurecr.io/servercore"
docker_tag        = "v1"
cpu               = 1
memory            = 4

}

azure_devops_org_name = "ORGNAME"
azure_devops_personal_access_token = "PATTOKEN"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.