1. Packages
  2. Buildkite
  3. API Docs
  4. Cluster
  5. ClusterAgentToken
Buildkite v3.1.6 published on Wednesday, Apr 3, 2024 by Pulumiverse

buildkite.Cluster.ClusterAgentToken

Explore with Pulumi AI

buildkite logo
Buildkite v3.1.6 published on Wednesday, Apr 3, 2024 by Pulumiverse

    A Cluster Agent Token is a token used to connect an agent to a cluster in Buildkite.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as buildkite from "@pulumiverse/buildkite";
    
    // create a cluster
    const primary = new buildkite.cluster.Cluster("primary", {
        description: "Runs the monolith build and deploy",
        emoji: "πŸš€",
        color: "#bada55",
    });
    // create an agent token for the cluster
    const defaultClusterAgentToken = new buildkite.cluster.ClusterAgentToken("defaultClusterAgentToken", {
        description: "Default cluster token",
        clusterId: primary.id,
    });
    const ipLimitedToken = new buildkite.cluster.ClusterAgentToken("ipLimitedToken", {
        description: "Token with allowed IP range",
        clusterId: primary.id,
        allowedIpAddresses: ["10.100.1.0/28"],
    });
    const monolith = new buildkite.pipeline.Pipeline("monolith", {
        repository: "https://github.com/...",
        clusterId: primary.id,
    });
    const defaultClusterQueue = new buildkite.cluster.ClusterQueue("defaultClusterQueue", {
        clusterId: primary.id,
        key: "default",
    });
    
    import pulumi
    import pulumiverse_buildkite as buildkite
    
    # create a cluster
    primary = buildkite.cluster.Cluster("primary",
        description="Runs the monolith build and deploy",
        emoji="πŸš€",
        color="#bada55")
    # create an agent token for the cluster
    default_cluster_agent_token = buildkite.cluster.ClusterAgentToken("defaultClusterAgentToken",
        description="Default cluster token",
        cluster_id=primary.id)
    ip_limited_token = buildkite.cluster.ClusterAgentToken("ipLimitedToken",
        description="Token with allowed IP range",
        cluster_id=primary.id,
        allowed_ip_addresses=["10.100.1.0/28"])
    monolith = buildkite.pipeline.Pipeline("monolith",
        repository="https://github.com/...",
        cluster_id=primary.id)
    default_cluster_queue = buildkite.cluster.ClusterQueue("defaultClusterQueue",
        cluster_id=primary.id,
        key="default")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-buildkite/sdk/v3/go/buildkite/Cluster"
    	"github.com/pulumiverse/pulumi-buildkite/sdk/v3/go/buildkite/Pipeline"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// create a cluster
    		primary, err := Cluster.NewCluster(ctx, "primary", &Cluster.ClusterArgs{
    			Description: pulumi.String("Runs the monolith build and deploy"),
    			Emoji:       pulumi.String("πŸš€"),
    			Color:       pulumi.String("#bada55"),
    		})
    		if err != nil {
    			return err
    		}
    		// create an agent token for the cluster
    		_, err = Cluster.NewClusterAgentToken(ctx, "defaultClusterAgentToken", &Cluster.ClusterAgentTokenArgs{
    			Description: pulumi.String("Default cluster token"),
    			ClusterId:   primary.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = Cluster.NewClusterAgentToken(ctx, "ipLimitedToken", &Cluster.ClusterAgentTokenArgs{
    			Description: pulumi.String("Token with allowed IP range"),
    			ClusterId:   primary.ID(),
    			AllowedIpAddresses: pulumi.StringArray{
    				pulumi.String("10.100.1.0/28"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = Pipeline.NewPipeline(ctx, "monolith", &Pipeline.PipelineArgs{
    			Repository: pulumi.String("https://github.com/..."),
    			ClusterId:  primary.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = Cluster.NewClusterQueue(ctx, "defaultClusterQueue", &Cluster.ClusterQueueArgs{
    			ClusterId: primary.ID(),
    			Key:       pulumi.String("default"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Buildkite = Pulumiverse.Buildkite;
    
    return await Deployment.RunAsync(() => 
    {
        // create a cluster
        var primary = new Buildkite.Cluster.Cluster("primary", new()
        {
            Description = "Runs the monolith build and deploy",
            Emoji = "πŸš€",
            Color = "#bada55",
        });
    
        // create an agent token for the cluster
        var defaultClusterAgentToken = new Buildkite.Cluster.ClusterAgentToken("defaultClusterAgentToken", new()
        {
            Description = "Default cluster token",
            ClusterId = primary.Id,
        });
    
        var ipLimitedToken = new Buildkite.Cluster.ClusterAgentToken("ipLimitedToken", new()
        {
            Description = "Token with allowed IP range",
            ClusterId = primary.Id,
            AllowedIpAddresses = new[]
            {
                "10.100.1.0/28",
            },
        });
    
        var monolith = new Buildkite.Pipeline.Pipeline("monolith", new()
        {
            Repository = "https://github.com/...",
            ClusterId = primary.Id,
        });
    
        var defaultClusterQueue = new Buildkite.Cluster.ClusterQueue("defaultClusterQueue", new()
        {
            ClusterId = primary.Id,
            Key = "default",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.buildkite.Cluster.Cluster;
    import com.pulumi.buildkite.Cluster.ClusterArgs;
    import com.pulumi.buildkite.Cluster.ClusterAgentToken;
    import com.pulumi.buildkite.Cluster.ClusterAgentTokenArgs;
    import com.pulumi.buildkite.Pipeline.Pipeline;
    import com.pulumi.buildkite.Pipeline.PipelineArgs;
    import com.pulumi.buildkite.Cluster.ClusterQueue;
    import com.pulumi.buildkite.Cluster.ClusterQueueArgs;
    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 primary = new Cluster("primary", ClusterArgs.builder()        
                .description("Runs the monolith build and deploy")
                .emoji("πŸš€")
                .color("#bada55")
                .build());
    
            var defaultClusterAgentToken = new ClusterAgentToken("defaultClusterAgentToken", ClusterAgentTokenArgs.builder()        
                .description("Default cluster token")
                .clusterId(primary.id())
                .build());
    
            var ipLimitedToken = new ClusterAgentToken("ipLimitedToken", ClusterAgentTokenArgs.builder()        
                .description("Token with allowed IP range")
                .clusterId(primary.id())
                .allowedIpAddresses("10.100.1.0/28")
                .build());
    
            var monolith = new Pipeline("monolith", PipelineArgs.builder()        
                .repository("https://github.com/...")
                .clusterId(primary.id())
                .build());
    
            var defaultClusterQueue = new ClusterQueue("defaultClusterQueue", ClusterQueueArgs.builder()        
                .clusterId(primary.id())
                .key("default")
                .build());
    
        }
    }
    
    resources:
      # create a cluster
      primary:
        type: buildkite:Cluster:Cluster
        properties:
          description: Runs the monolith build and deploy
          emoji: "\U0001F680"
          color: '#bada55'
      # create an agent token for the cluster
      defaultClusterAgentToken:
        type: buildkite:Cluster:ClusterAgentToken
        properties:
          description: Default cluster token
          clusterId: ${primary.id}
      ipLimitedToken:
        type: buildkite:Cluster:ClusterAgentToken
        properties:
          description: Token with allowed IP range
          clusterId: ${primary.id}
          allowedIpAddresses:
            - 10.100.1.0/28
      monolith:
        type: buildkite:Pipeline:Pipeline
        properties:
          repository: https://github.com/...
          clusterId: ${primary.id}
      defaultClusterQueue:
        type: buildkite:Cluster:ClusterQueue
        properties:
          clusterId: ${primary.id}
          key: default
    

    Create ClusterAgentToken Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ClusterAgentToken(name: string, args: ClusterAgentTokenArgs, opts?: CustomResourceOptions);
    @overload
    def ClusterAgentToken(resource_name: str,
                          args: ClusterAgentTokenArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def ClusterAgentToken(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          cluster_id: Optional[str] = None,
                          description: Optional[str] = None,
                          allowed_ip_addresses: Optional[Sequence[str]] = None)
    func NewClusterAgentToken(ctx *Context, name string, args ClusterAgentTokenArgs, opts ...ResourceOption) (*ClusterAgentToken, error)
    public ClusterAgentToken(string name, ClusterAgentTokenArgs args, CustomResourceOptions? opts = null)
    public ClusterAgentToken(String name, ClusterAgentTokenArgs args)
    public ClusterAgentToken(String name, ClusterAgentTokenArgs args, CustomResourceOptions options)
    
    type: buildkite:Cluster:ClusterAgentToken
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ClusterAgentTokenArgs
    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 ClusterAgentTokenArgs
    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 ClusterAgentTokenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ClusterAgentTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ClusterAgentTokenArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var clusterAgentTokenResource = new Buildkite.Cluster.ClusterAgentToken("clusterAgentTokenResource", new()
    {
        ClusterId = "string",
        Description = "string",
        AllowedIpAddresses = new[]
        {
            "string",
        },
    });
    
    example, err := Cluster.NewClusterAgentToken(ctx, "clusterAgentTokenResource", &Cluster.ClusterAgentTokenArgs{
    	ClusterId:   pulumi.String("string"),
    	Description: pulumi.String("string"),
    	AllowedIpAddresses: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var clusterAgentTokenResource = new ClusterAgentToken("clusterAgentTokenResource", ClusterAgentTokenArgs.builder()
        .clusterId("string")
        .description("string")
        .allowedIpAddresses("string")
        .build());
    
    cluster_agent_token_resource = buildkite.cluster.ClusterAgentToken("clusterAgentTokenResource",
        cluster_id="string",
        description="string",
        allowed_ip_addresses=["string"])
    
    const clusterAgentTokenResource = new buildkite.cluster.ClusterAgentToken("clusterAgentTokenResource", {
        clusterId: "string",
        description: "string",
        allowedIpAddresses: ["string"],
    });
    
    type: buildkite:Cluster:ClusterAgentToken
    properties:
        allowedIpAddresses:
            - string
        clusterId: string
        description: string
    

    ClusterAgentToken Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ClusterAgentToken resource accepts the following input properties:

    ClusterId string
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    Description string
    A description about what this cluster agent token is used for.
    AllowedIpAddresses List<string>
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).
    ClusterId string
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    Description string
    A description about what this cluster agent token is used for.
    AllowedIpAddresses []string
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).
    clusterId String
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    description String
    A description about what this cluster agent token is used for.
    allowedIpAddresses List<String>
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).
    clusterId string
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    description string
    A description about what this cluster agent token is used for.
    allowedIpAddresses string[]
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).
    cluster_id str
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    description str
    A description about what this cluster agent token is used for.
    allowed_ip_addresses Sequence[str]
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).
    clusterId String
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    description String
    A description about what this cluster agent token is used for.
    allowedIpAddresses List<String>
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).

    Outputs

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

    ClusterUuid string
    The UUID of the Cluster that this token belongs to.
    Id string
    The provider-assigned unique ID for this managed resource.
    Token string
    The token value used by an agent to register with the API.
    Uuid string
    The UUID of the token.
    ClusterUuid string
    The UUID of the Cluster that this token belongs to.
    Id string
    The provider-assigned unique ID for this managed resource.
    Token string
    The token value used by an agent to register with the API.
    Uuid string
    The UUID of the token.
    clusterUuid String
    The UUID of the Cluster that this token belongs to.
    id String
    The provider-assigned unique ID for this managed resource.
    token String
    The token value used by an agent to register with the API.
    uuid String
    The UUID of the token.
    clusterUuid string
    The UUID of the Cluster that this token belongs to.
    id string
    The provider-assigned unique ID for this managed resource.
    token string
    The token value used by an agent to register with the API.
    uuid string
    The UUID of the token.
    cluster_uuid str
    The UUID of the Cluster that this token belongs to.
    id str
    The provider-assigned unique ID for this managed resource.
    token str
    The token value used by an agent to register with the API.
    uuid str
    The UUID of the token.
    clusterUuid String
    The UUID of the Cluster that this token belongs to.
    id String
    The provider-assigned unique ID for this managed resource.
    token String
    The token value used by an agent to register with the API.
    uuid String
    The UUID of the token.

    Look up Existing ClusterAgentToken Resource

    Get an existing ClusterAgentToken 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?: ClusterAgentTokenState, opts?: CustomResourceOptions): ClusterAgentToken
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            allowed_ip_addresses: Optional[Sequence[str]] = None,
            cluster_id: Optional[str] = None,
            cluster_uuid: Optional[str] = None,
            description: Optional[str] = None,
            token: Optional[str] = None,
            uuid: Optional[str] = None) -> ClusterAgentToken
    func GetClusterAgentToken(ctx *Context, name string, id IDInput, state *ClusterAgentTokenState, opts ...ResourceOption) (*ClusterAgentToken, error)
    public static ClusterAgentToken Get(string name, Input<string> id, ClusterAgentTokenState? state, CustomResourceOptions? opts = null)
    public static ClusterAgentToken get(String name, Output<String> id, ClusterAgentTokenState 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:
    AllowedIpAddresses List<string>
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).
    ClusterId string
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    ClusterUuid string
    The UUID of the Cluster that this token belongs to.
    Description string
    A description about what this cluster agent token is used for.
    Token string
    The token value used by an agent to register with the API.
    Uuid string
    The UUID of the token.
    AllowedIpAddresses []string
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).
    ClusterId string
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    ClusterUuid string
    The UUID of the Cluster that this token belongs to.
    Description string
    A description about what this cluster agent token is used for.
    Token string
    The token value used by an agent to register with the API.
    Uuid string
    The UUID of the token.
    allowedIpAddresses List<String>
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).
    clusterId String
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    clusterUuid String
    The UUID of the Cluster that this token belongs to.
    description String
    A description about what this cluster agent token is used for.
    token String
    The token value used by an agent to register with the API.
    uuid String
    The UUID of the token.
    allowedIpAddresses string[]
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).
    clusterId string
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    clusterUuid string
    The UUID of the Cluster that this token belongs to.
    description string
    A description about what this cluster agent token is used for.
    token string
    The token value used by an agent to register with the API.
    uuid string
    The UUID of the token.
    allowed_ip_addresses Sequence[str]
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).
    cluster_id str
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    cluster_uuid str
    The UUID of the Cluster that this token belongs to.
    description str
    A description about what this cluster agent token is used for.
    token str
    The token value used by an agent to register with the API.
    uuid str
    The UUID of the token.
    allowedIpAddresses List<String>
    A list of CIDR-notation IPv4 addresses from which agents can use this Cluster Agent Token.If not set, all IP addresses are allowed (the same as setting 0.0.0.0/0).
    clusterId String
    The GraphQL ID of the Cluster that this Cluster Agent Token belongs to.
    clusterUuid String
    The UUID of the Cluster that this token belongs to.
    description String
    A description about what this cluster agent token is used for.
    token String
    The token value used by an agent to register with the API.
    uuid String
    The UUID of the token.

    Package Details

    Repository
    buildkite pulumiverse/pulumi-buildkite
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the buildkite Terraform Provider.
    buildkite logo
    Buildkite v3.1.6 published on Wednesday, Apr 3, 2024 by Pulumiverse