azuredevops logo
Azure DevOps v2.7.0, Mar 27 23

azuredevops.Queue

Explore with Pulumi AI

Manages an agent queue within Azure DevOps. In the UI, this is equivalent to adding an Organization defined pool to a project.

The created queue is not authorized for use by all pipelines in the project. However, the azuredevops.ResourceAuthorization resource can be used to grant authorization.

Example Usage

using System.Collections.Generic;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;

return await Deployment.RunAsync(() => 
{
    var exampleProject = new AzureDevOps.Project("exampleProject");

    var examplePool = AzureDevOps.GetPool.Invoke(new()
    {
        Name = "example-pool",
    });

    var exampleQueue = new AzureDevOps.Queue("exampleQueue", new()
    {
        ProjectId = exampleProject.Id,
        AgentPoolId = examplePool.Apply(getPoolResult => getPoolResult.Id),
    });

    // Grant access to queue to all pipelines in the project
    var exampleResourceAuthorization = new AzureDevOps.ResourceAuthorization("exampleResourceAuthorization", new()
    {
        ProjectId = exampleProject.Id,
        ResourceId = exampleQueue.Id,
        Type = "queue",
        Authorized = true,
    });

});
package main

import (
	"github.com/pulumi/pulumi-azuredevops/sdk/v2/go/azuredevops"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleProject, err := azuredevops.NewProject(ctx, "exampleProject", nil)
		if err != nil {
			return err
		}
		examplePool, err := azuredevops.LookupPool(ctx, &azuredevops.LookupPoolArgs{
			Name: "example-pool",
		}, nil)
		if err != nil {
			return err
		}
		exampleQueue, err := azuredevops.NewQueue(ctx, "exampleQueue", &azuredevops.QueueArgs{
			ProjectId:   exampleProject.ID(),
			AgentPoolId: *pulumi.String(examplePool.Id),
		})
		if err != nil {
			return err
		}
		_, err = azuredevops.NewResourceAuthorization(ctx, "exampleResourceAuthorization", &azuredevops.ResourceAuthorizationArgs{
			ProjectId:  exampleProject.ID(),
			ResourceId: exampleQueue.ID(),
			Type:       pulumi.String("queue"),
			Authorized: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.Project;
import com.pulumi.azuredevops.AzuredevopsFunctions;
import com.pulumi.azuredevops.inputs.GetPoolArgs;
import com.pulumi.azuredevops.Queue;
import com.pulumi.azuredevops.QueueArgs;
import com.pulumi.azuredevops.ResourceAuthorization;
import com.pulumi.azuredevops.ResourceAuthorizationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var exampleProject = new Project("exampleProject");

        final var examplePool = AzuredevopsFunctions.getPool(GetPoolArgs.builder()
            .name("example-pool")
            .build());

        var exampleQueue = new Queue("exampleQueue", QueueArgs.builder()        
            .projectId(exampleProject.id())
            .agentPoolId(examplePool.applyValue(getPoolResult -> getPoolResult.id()))
            .build());

        var exampleResourceAuthorization = new ResourceAuthorization("exampleResourceAuthorization", ResourceAuthorizationArgs.builder()        
            .projectId(exampleProject.id())
            .resourceId(exampleQueue.id())
            .type("queue")
            .authorized(true)
            .build());

    }
}
import pulumi
import pulumi_azuredevops as azuredevops

example_project = azuredevops.Project("exampleProject")
example_pool = azuredevops.get_pool(name="example-pool")
example_queue = azuredevops.Queue("exampleQueue",
    project_id=example_project.id,
    agent_pool_id=example_pool.id)
# Grant access to queue to all pipelines in the project
example_resource_authorization = azuredevops.ResourceAuthorization("exampleResourceAuthorization",
    project_id=example_project.id,
    resource_id=example_queue.id,
    type="queue",
    authorized=True)
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";

const exampleProject = new azuredevops.Project("exampleProject", {});
const examplePool = azuredevops.getPool({
    name: "example-pool",
});
const exampleQueue = new azuredevops.Queue("exampleQueue", {
    projectId: exampleProject.id,
    agentPoolId: examplePool.then(examplePool => examplePool.id),
});
// Grant access to queue to all pipelines in the project
const exampleResourceAuthorization = new azuredevops.ResourceAuthorization("exampleResourceAuthorization", {
    projectId: exampleProject.id,
    resourceId: exampleQueue.id,
    type: "queue",
    authorized: true,
});
resources:
  exampleProject:
    type: azuredevops:Project
  exampleQueue:
    type: azuredevops:Queue
    properties:
      projectId: ${exampleProject.id}
      agentPoolId: ${examplePool.id}
  # Grant access to queue to all pipelines in the project
  exampleResourceAuthorization:
    type: azuredevops:ResourceAuthorization
    properties:
      projectId: ${exampleProject.id}
      resourceId: ${exampleQueue.id}
      type: queue
      authorized: true
variables:
  examplePool:
    fn::invoke:
      Function: azuredevops:getPool
      Arguments:
        name: example-pool

Create Queue Resource

new Queue(name: string, args: QueueArgs, opts?: CustomResourceOptions);
@overload
def Queue(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          agent_pool_id: Optional[int] = None,
          project_id: Optional[str] = None)
@overload
def Queue(resource_name: str,
          args: QueueArgs,
          opts: Optional[ResourceOptions] = None)
func NewQueue(ctx *Context, name string, args QueueArgs, opts ...ResourceOption) (*Queue, error)
public Queue(string name, QueueArgs args, CustomResourceOptions? opts = null)
public Queue(String name, QueueArgs args)
public Queue(String name, QueueArgs args, CustomResourceOptions options)
type: azuredevops:Queue
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args QueueArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args QueueArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args QueueArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args QueueArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args QueueArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Queue Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Queue resource accepts the following input properties:

AgentPoolId int

The ID of the organization agent pool.

ProjectId string

The ID of the project in which to create the resource.

AgentPoolId int

The ID of the organization agent pool.

ProjectId string

The ID of the project in which to create the resource.

agentPoolId Integer

The ID of the organization agent pool.

projectId String

The ID of the project in which to create the resource.

agentPoolId number

The ID of the organization agent pool.

projectId string

The ID of the project in which to create the resource.

agent_pool_id int

The ID of the organization agent pool.

project_id str

The ID of the project in which to create the resource.

agentPoolId Number

The ID of the organization agent pool.

projectId String

The ID of the project in which to create the resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the Queue resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing Queue Resource

Get an existing Queue resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: QueueState, opts?: CustomResourceOptions): Queue
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        agent_pool_id: Optional[int] = None,
        project_id: Optional[str] = None) -> Queue
func GetQueue(ctx *Context, name string, id IDInput, state *QueueState, opts ...ResourceOption) (*Queue, error)
public static Queue Get(string name, Input<string> id, QueueState? state, CustomResourceOptions? opts = null)
public static Queue get(String name, Output<String> id, QueueState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AgentPoolId int

The ID of the organization agent pool.

ProjectId string

The ID of the project in which to create the resource.

AgentPoolId int

The ID of the organization agent pool.

ProjectId string

The ID of the project in which to create the resource.

agentPoolId Integer

The ID of the organization agent pool.

projectId String

The ID of the project in which to create the resource.

agentPoolId number

The ID of the organization agent pool.

projectId string

The ID of the project in which to create the resource.

agent_pool_id int

The ID of the organization agent pool.

project_id str

The ID of the project in which to create the resource.

agentPoolId Number

The ID of the organization agent pool.

projectId String

The ID of the project in which to create the resource.

Import

Azure DevOps Agent Pools can be imported using the project ID and agent queue ID, e.g.

 $ pulumi import azuredevops:index/queue:Queue example 00000000-0000-0000-0000-000000000000/0

Package Details

Repository
Azure DevOps pulumi/pulumi-azuredevops
License
Apache-2.0
Notes

This Pulumi package is based on the azuredevops Terraform Provider.