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

buildkite.Pipeline.Template

Explore with Pulumi AI

This resource allows for standardized step configurations that can be used within various pipelines of an organization.

More information on pipeline templates can be found in the documentation.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as buildkite from "@pulumiverse/buildkite";

const templateRequired = new buildkite.pipeline.Template("templateRequired", {configuration: `steps:
  - label: ":pipeline:"
    command: "buildkite-agent pipeline upload .buildkite/pipeline-qa.yml"

`});
const templateFull = new buildkite.pipeline.Template("templateFull", {
    available: true,
    configuration: `steps:
  - label: ":pipeline:"
    command: "buildkite-agent pipeline upload .buildkite/pipeline-production.yml"

`,
    description: "Production upload template",
});
Copy
import pulumi
import pulumiverse_buildkite as buildkite

template_required = buildkite.pipeline.Template("templateRequired", configuration="""steps:
  - label: ":pipeline:"
    command: "buildkite-agent pipeline upload .buildkite/pipeline-qa.yml"

""")
template_full = buildkite.pipeline.Template("templateFull",
    available=True,
    configuration="""steps:
  - label: ":pipeline:"
    command: "buildkite-agent pipeline upload .buildkite/pipeline-production.yml"

""",
    description="Production upload template")
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-buildkite/sdk/v3/go/buildkite/Pipeline"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := Pipeline.NewTemplate(ctx, "templateRequired", &Pipeline.TemplateArgs{
			Configuration: pulumi.String("steps:\n  - label: \":pipeline:\"\n    command: \"buildkite-agent pipeline upload .buildkite/pipeline-qa.yml\"\n\n"),
		})
		if err != nil {
			return err
		}
		_, err = Pipeline.NewTemplate(ctx, "templateFull", &Pipeline.TemplateArgs{
			Available:     pulumi.Bool(true),
			Configuration: pulumi.String("steps:\n  - label: \":pipeline:\"\n    command: \"buildkite-agent pipeline upload .buildkite/pipeline-production.yml\"\n\n"),
			Description:   pulumi.String("Production upload template"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Buildkite = Pulumiverse.Buildkite;

return await Deployment.RunAsync(() => 
{
    var templateRequired = new Buildkite.Pipeline.Template("templateRequired", new()
    {
        Configuration = @"steps:
  - label: "":pipeline:""
    command: ""buildkite-agent pipeline upload .buildkite/pipeline-qa.yml""

",
    });

    var templateFull = new Buildkite.Pipeline.Template("templateFull", new()
    {
        Available = true,
        Configuration = @"steps:
  - label: "":pipeline:""
    command: ""buildkite-agent pipeline upload .buildkite/pipeline-production.yml""

",
        Description = "Production upload template",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.buildkite.Pipeline.Template;
import com.pulumi.buildkite.Pipeline.TemplateArgs;
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 templateRequired = new Template("templateRequired", TemplateArgs.builder()        
            .configuration("""
steps:
  - label: ":pipeline:"
    command: "buildkite-agent pipeline upload .buildkite/pipeline-qa.yml"

            """)
            .build());

        var templateFull = new Template("templateFull", TemplateArgs.builder()        
            .available(true)
            .configuration("""
steps:
  - label: ":pipeline:"
    command: "buildkite-agent pipeline upload .buildkite/pipeline-production.yml"

            """)
            .description("Production upload template")
            .build());

    }
}
Copy
resources:
  templateRequired:
    type: buildkite:Pipeline:Template
    properties:
      configuration: |+
        steps:
          - label: ":pipeline:"
            command: "buildkite-agent pipeline upload .buildkite/pipeline-qa.yml"        

  templateFull:
    type: buildkite:Pipeline:Template
    properties:
      available: true
      configuration: |+
        steps:
          - label: ":pipeline:"
            command: "buildkite-agent pipeline upload .buildkite/pipeline-production.yml"        

      description: Production upload template
Copy

Create Template Resource

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

Constructor syntax

new Template(name: string, args: TemplateArgs, opts?: CustomResourceOptions);
@overload
def Template(resource_name: str,
             args: TemplateArgs,
             opts: Optional[ResourceOptions] = None)

@overload
def Template(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             configuration: Optional[str] = None,
             available: Optional[bool] = None,
             description: Optional[str] = None,
             name: Optional[str] = None)
func NewTemplate(ctx *Context, name string, args TemplateArgs, opts ...ResourceOption) (*Template, error)
public Template(string name, TemplateArgs args, CustomResourceOptions? opts = null)
public Template(String name, TemplateArgs args)
public Template(String name, TemplateArgs args, CustomResourceOptions options)
type: buildkite:Pipeline:Template
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. TemplateArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. TemplateArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. TemplateArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. TemplateArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. TemplateArgs
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 templateResource = new Buildkite.Pipeline.Template("templateResource", new()
{
    Configuration = "string",
    Available = false,
    Description = "string",
    Name = "string",
});
Copy
example, err := Pipeline.NewTemplate(ctx, "templateResource", &Pipeline.TemplateArgs{
	Configuration: pulumi.String("string"),
	Available:     pulumi.Bool(false),
	Description:   pulumi.String("string"),
	Name:          pulumi.String("string"),
})
Copy
var templateResource = new Template("templateResource", TemplateArgs.builder()
    .configuration("string")
    .available(false)
    .description("string")
    .name("string")
    .build());
Copy
template_resource = buildkite.pipeline.Template("templateResource",
    configuration="string",
    available=False,
    description="string",
    name="string")
Copy
const templateResource = new buildkite.pipeline.Template("templateResource", {
    configuration: "string",
    available: false,
    description: "string",
    name: "string",
});
Copy
type: buildkite:Pipeline:Template
properties:
    available: false
    configuration: string
    description: string
    name: string
Copy

Template 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 Template resource accepts the following input properties:

Configuration This property is required. string
The YAML step configuration for the pipeline template.
Available bool
If the pipeline template is available for assignment by non admin users.
Description string
A description for the pipeline template.
Name string
The name of the pipeline template.
Configuration This property is required. string
The YAML step configuration for the pipeline template.
Available bool
If the pipeline template is available for assignment by non admin users.
Description string
A description for the pipeline template.
Name string
The name of the pipeline template.
configuration This property is required. String
The YAML step configuration for the pipeline template.
available Boolean
If the pipeline template is available for assignment by non admin users.
description String
A description for the pipeline template.
name String
The name of the pipeline template.
configuration This property is required. string
The YAML step configuration for the pipeline template.
available boolean
If the pipeline template is available for assignment by non admin users.
description string
A description for the pipeline template.
name string
The name of the pipeline template.
configuration This property is required. str
The YAML step configuration for the pipeline template.
available bool
If the pipeline template is available for assignment by non admin users.
description str
A description for the pipeline template.
name str
The name of the pipeline template.
configuration This property is required. String
The YAML step configuration for the pipeline template.
available Boolean
If the pipeline template is available for assignment by non admin users.
description String
A description for the pipeline template.
name String
The name of the pipeline template.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Uuid string
The UUID of the pipeline template.
Id string
The provider-assigned unique ID for this managed resource.
Uuid string
The UUID of the pipeline template.
id String
The provider-assigned unique ID for this managed resource.
uuid String
The UUID of the pipeline template.
id string
The provider-assigned unique ID for this managed resource.
uuid string
The UUID of the pipeline template.
id str
The provider-assigned unique ID for this managed resource.
uuid str
The UUID of the pipeline template.
id String
The provider-assigned unique ID for this managed resource.
uuid String
The UUID of the pipeline template.

Look up Existing Template Resource

Get an existing Template 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?: TemplateState, opts?: CustomResourceOptions): Template
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        available: Optional[bool] = None,
        configuration: Optional[str] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        uuid: Optional[str] = None) -> Template
func GetTemplate(ctx *Context, name string, id IDInput, state *TemplateState, opts ...ResourceOption) (*Template, error)
public static Template Get(string name, Input<string> id, TemplateState? state, CustomResourceOptions? opts = null)
public static Template get(String name, Output<String> id, TemplateState state, CustomResourceOptions options)
resources:  _:    type: buildkite:Pipeline:Template    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Available bool
If the pipeline template is available for assignment by non admin users.
Configuration string
The YAML step configuration for the pipeline template.
Description string
A description for the pipeline template.
Name string
The name of the pipeline template.
Uuid string
The UUID of the pipeline template.
Available bool
If the pipeline template is available for assignment by non admin users.
Configuration string
The YAML step configuration for the pipeline template.
Description string
A description for the pipeline template.
Name string
The name of the pipeline template.
Uuid string
The UUID of the pipeline template.
available Boolean
If the pipeline template is available for assignment by non admin users.
configuration String
The YAML step configuration for the pipeline template.
description String
A description for the pipeline template.
name String
The name of the pipeline template.
uuid String
The UUID of the pipeline template.
available boolean
If the pipeline template is available for assignment by non admin users.
configuration string
The YAML step configuration for the pipeline template.
description string
A description for the pipeline template.
name string
The name of the pipeline template.
uuid string
The UUID of the pipeline template.
available bool
If the pipeline template is available for assignment by non admin users.
configuration str
The YAML step configuration for the pipeline template.
description str
A description for the pipeline template.
name str
The name of the pipeline template.
uuid str
The UUID of the pipeline template.
available Boolean
If the pipeline template is available for assignment by non admin users.
configuration String
The YAML step configuration for the pipeline template.
description String
A description for the pipeline template.
name String
The name of the pipeline template.
uuid String
The UUID of the pipeline template.

Import

import a pipeline template resource using the templates GraphQL ID

You can use this query to find the first 50 templates (adjust for less or more):

query getPipelineTemplateIds {

organization(slug: “ORGANIZATION_SLUG”) {

pipelineTemplates(first: 50) {

  edges{

    node{

      id

      name

    }

  }

}

}

}

$ pulumi import buildkite:Pipeline/template:Template template UGlwZWxpbmVUZW1wbGF0ZS0tLWU0YWQ3YjdjLTljZDYtNGM0MS1hYWE0LTY2ZmI3ODY0MTMwNw==
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
buildkite pulumiverse/pulumi-buildkite
License
Apache-2.0
Notes
This Pulumi package is based on the buildkite Terraform Provider.