local

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 12

Documentation

Index

Constants

View Source
const (
	// Capture stdout in logs but not stderr
	LoggingStdout = Logging("stdout")
	// Capture stderr in logs but not stdout
	LoggingStderr = Logging("stderr")
	// Capture stdout and stderr in logs
	LoggingStdoutAndStderr = Logging("stdoutAndStderr")
	// Capture no logs
	LoggingNone = Logging("none")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	pulumi.CustomResourceState

	// If the previous command's stdout and stderr (as generated by the prior create/update) is
	// injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR.
	// Defaults to true.
	AddPreviousOutputInEnv pulumi.BoolPtrOutput `pulumi:"addPreviousOutputInEnv"`
	// An archive asset containing files found after running the command.
	Archive pulumi.ArchiveOutput `pulumi:"archive"`
	// A list of path globs to return as a single archive asset after the command completes.
	//
	// When specifying glob patterns the following rules apply:
	// - We only include files not directories for assets and archives.
	// - Path separators are `/` on all platforms - including Windows.
	// - Patterns starting with `!` are 'exclude' rules.
	// - Rules are evaluated in order, so exclude rules should be after inclusion rules.
	// - `*` matches anything except `/`
	// - `**` matches anything, _including_ `/`
	// - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
	// - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
	//
	// #### Example
	//
	// Given the rules:
	//
	// When evaluating against this folder:
	//
	// The following paths will be returned:
	ArchivePaths pulumi.StringArrayOutput `pulumi:"archivePaths"`
	// A list of path globs to read after the command completes.
	//
	// When specifying glob patterns the following rules apply:
	// - We only include files not directories for assets and archives.
	// - Path separators are `/` on all platforms - including Windows.
	// - Patterns starting with `!` are 'exclude' rules.
	// - Rules are evaluated in order, so exclude rules should be after inclusion rules.
	// - `*` matches anything except `/`
	// - `**` matches anything, _including_ `/`
	// - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
	// - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
	//
	// #### Example
	//
	// Given the rules:
	//
	// When evaluating against this folder:
	//
	// The following paths will be returned:
	AssetPaths pulumi.StringArrayOutput `pulumi:"assetPaths"`
	// A map of assets found after running the command.
	// The key is the relative path from the command dir
	Assets pulumi.AssetOrArchiveMapOutput `pulumi:"assets"`
	// The command to run on create.
	Create pulumi.StringPtrOutput `pulumi:"create"`
	// The command to run on delete. The environment variables PULUMI_COMMAND_STDOUT
	// and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the
	// Command resource from previous create or update steps.
	Delete pulumi.StringPtrOutput `pulumi:"delete"`
	// The directory from which to run the command from. If `dir` does not exist, then
	// `Command` will fail.
	Dir pulumi.StringPtrOutput `pulumi:"dir"`
	// Additional environment variables available to the command's process.
	Environment pulumi.StringMapOutput `pulumi:"environment"`
	// The program and arguments to run the command.
	// On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`
	Interpreter pulumi.StringArrayOutput `pulumi:"interpreter"`
	// If the command's stdout and stderr should be logged. This doesn't affect the capturing of
	// stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the
	// outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
	Logging LoggingPtrOutput `pulumi:"logging"`
	// The standard error of the command's process
	Stderr pulumi.StringOutput `pulumi:"stderr"`
	// Pass a string to the command's process as standard in
	Stdin pulumi.StringPtrOutput `pulumi:"stdin"`
	// The standard output of the command's process
	Stdout pulumi.StringOutput `pulumi:"stdout"`
	// Trigger a resource replacement on changes to any of these values. The
	// trigger values can be of any type. If a value is different in the current update compared to the
	// previous update, the resource will be replaced, i.e., the "create" command will be re-run.
	// Please see the resource documentation for examples.
	Triggers pulumi.ArrayOutput `pulumi:"triggers"`
	// The command to run on update, if empty, create will
	// run again. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR
	// are set to the stdout and stderr properties of the Command resource from previous
	// create or update steps.
	Update pulumi.StringPtrOutput `pulumi:"update"`
}

A local command to be executed.

This command can be inserted into the life cycles of other resources using the `dependsOn` or `parent` resource options. A command is considered to have failed when it finished with a non-zero exit code. This will fail the CRUD step of the `Command` resource.

## Example Usage

### Basic Example

This example shows the simplest use case, simply running a command on `create` in the Pulumi lifecycle.

```go package main

import (

"github.com/pulumi/pulumi-command/sdk/go/command/local"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"

)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		random, err := local.NewCommand(ctx, "my-bucket", &local.CommandArgs{
			Create: pulumi.String("openssl rand -hex 16"),
		})
		if err != nil {
			return err
		}

		ctx.Export("output", random.Stdout)
		return nil
	})
}

```

### Invoking a Lambda during Pulumi Deployment

This example show using a local command to invoke an AWS Lambda once it's deployed. The Lambda invocation could also depend on other resources.

```go package main

import (

"encoding/json"
"fmt"

"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda"
"github.com/pulumi/pulumi-command/sdk/go/command/local"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"

)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		awsConfig := config.New(ctx, "aws")
		awsRegion := awsConfig.Require("region")

		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"Version": "2012-10-17",
			"Statement": []map[string]interface{}{
				{
					"Action": "sts:AssumeRole",
					"Effect": "Allow",
					"Principal": map[string]interface{}{
						"Service": "lambda.amazonaws.com",
					},
				},
			},
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		lambdaRole, err := iam.NewRole(ctx, "lambdaRole", &iam.RoleArgs{
			AssumeRolePolicy: pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		lambdaFunction, err := lambda.NewFunction(ctx, "lambdaFunction", &lambda.FunctionArgs{
			Name:    pulumi.String("f"),
			Publish: pulumi.Bool(true),
			Role:    lambdaRole.Arn,
			Handler: pulumi.String("index.handler"),
			Runtime: pulumi.String(lambda.RuntimeNodeJS20dX),
			Code:    pulumi.NewFileArchive("./handler"),
		})
		if err != nil {
			return err
		}
		invokeCommand, err := local.NewCommand(ctx, "invokeCommand", &local.CommandArgs{
			Create: pulumi.String(fmt.Sprintf("aws lambda invoke --function-name \"$FN\" --payload '{\"stackName\": \"%v\"}' --cli-binary-format raw-in-base64-out out.txt >/dev/null && cat out.txt | tr -d '\"'  && rm out.txt", ctx.Stack())),
			Environment: pulumi.StringMap{
				"FN":         lambdaFunction.Arn,
				"AWS_REGION": pulumi.String(awsRegion),
				"AWS_PAGER":  pulumi.String(""),
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			lambdaFunction,
		}))
		if err != nil {
			return err
		}
		ctx.Export("output", invokeCommand.Stdout)
		return nil
	})
}

```

### Using Triggers

This example defines several trigger values of various kinds. Changes to any of them will cause `cmd` to be re-run.

```go package main

import (

"github.com/pulumi/pulumi-command/sdk/go/command/local"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"

)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		str := pulumi.String("foo")

		fileAsset := pulumi.NewFileAsset("Pulumi.yaml")

		rand, err := random.NewRandomString(ctx, "rand", &random.RandomStringArgs{
			Length: pulumi.Int(5),
		})
		if err != nil {
			return err
		}

		localFile, err := local.NewCommand(ctx, "localFile", &local.CommandArgs{
			Create: pulumi.String("touch foo.txt"),
			ArchivePaths: pulumi.StringArray{
				pulumi.String("*.txt"),
			},
		})
		if err != nil {
			return err
		}

		_, err = local.NewCommand(ctx, "cmd", &local.CommandArgs{
			Create: pulumi.String("echo create > op.txt"),
			Delete: pulumi.String("echo delete >> op.txt"),
			Triggers: pulumi.Array{
				str,
				rand.Result,
				fileAsset,
				localFile.Archive,
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}

```

func GetCommand

func GetCommand(ctx *pulumi.Context,
	name string, id pulumi.IDInput, state *CommandState, opts ...pulumi.ResourceOption) (*Command, error)

GetCommand gets an existing Command resource's state with the given name, ID, and optional state properties that are used to uniquely qualify the lookup (nil if not required).

func NewCommand

func NewCommand(ctx *pulumi.Context,
	name string, args *CommandArgs, opts ...pulumi.ResourceOption) (*Command, error)

NewCommand registers a new resource with the given unique name, arguments, and options.

func (*Command) ElementType

func (*Command) ElementType() reflect.Type

func (*Command) ToCommandOutput

func (i *Command) ToCommandOutput() CommandOutput

func (*Command) ToCommandOutputWithContext

func (i *Command) ToCommandOutputWithContext(ctx context.Context) CommandOutput

type CommandArgs

type CommandArgs struct {
	// If the previous command's stdout and stderr (as generated by the prior create/update) is
	// injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR.
	// Defaults to true.
	AddPreviousOutputInEnv pulumi.BoolPtrInput
	// A list of path globs to return as a single archive asset after the command completes.
	//
	// When specifying glob patterns the following rules apply:
	// - We only include files not directories for assets and archives.
	// - Path separators are `/` on all platforms - including Windows.
	// - Patterns starting with `!` are 'exclude' rules.
	// - Rules are evaluated in order, so exclude rules should be after inclusion rules.
	// - `*` matches anything except `/`
	// - `**` matches anything, _including_ `/`
	// - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
	// - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
	//
	// #### Example
	//
	// Given the rules:
	//
	// When evaluating against this folder:
	//
	// The following paths will be returned:
	ArchivePaths pulumi.StringArrayInput
	// A list of path globs to read after the command completes.
	//
	// When specifying glob patterns the following rules apply:
	// - We only include files not directories for assets and archives.
	// - Path separators are `/` on all platforms - including Windows.
	// - Patterns starting with `!` are 'exclude' rules.
	// - Rules are evaluated in order, so exclude rules should be after inclusion rules.
	// - `*` matches anything except `/`
	// - `**` matches anything, _including_ `/`
	// - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
	// - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
	//
	// #### Example
	//
	// Given the rules:
	//
	// When evaluating against this folder:
	//
	// The following paths will be returned:
	AssetPaths pulumi.StringArrayInput
	// The command to run on create.
	Create pulumi.StringPtrInput
	// The command to run on delete. The environment variables PULUMI_COMMAND_STDOUT
	// and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the
	// Command resource from previous create or update steps.
	Delete pulumi.StringPtrInput
	// The directory from which to run the command from. If `dir` does not exist, then
	// `Command` will fail.
	Dir pulumi.StringPtrInput
	// Additional environment variables available to the command's process.
	Environment pulumi.StringMapInput
	// The program and arguments to run the command.
	// On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`
	Interpreter pulumi.StringArrayInput
	// If the command's stdout and stderr should be logged. This doesn't affect the capturing of
	// stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the
	// outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
	Logging LoggingPtrInput
	// Pass a string to the command's process as standard in
	Stdin pulumi.StringPtrInput
	// Trigger a resource replacement on changes to any of these values. The
	// trigger values can be of any type. If a value is different in the current update compared to the
	// previous update, the resource will be replaced, i.e., the "create" command will be re-run.
	// Please see the resource documentation for examples.
	Triggers pulumi.ArrayInput
	// The command to run on update, if empty, create will
	// run again. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR
	// are set to the stdout and stderr properties of the Command resource from previous
	// create or update steps.
	Update pulumi.StringPtrInput
}

The set of arguments for constructing a Command resource.

func (CommandArgs) ElementType

func (CommandArgs) ElementType() reflect.Type

type CommandArray

type CommandArray []CommandInput

func (CommandArray) ElementType

func (CommandArray) ElementType() reflect.Type

func (CommandArray) ToCommandArrayOutput

func (i CommandArray) ToCommandArrayOutput() CommandArrayOutput

func (CommandArray) ToCommandArrayOutputWithContext

func (i CommandArray) ToCommandArrayOutputWithContext(ctx context.Context) CommandArrayOutput

type CommandArrayInput

type CommandArrayInput interface {
	pulumi.Input

	ToCommandArrayOutput() CommandArrayOutput
	ToCommandArrayOutputWithContext(context.Context) CommandArrayOutput
}

CommandArrayInput is an input type that accepts CommandArray and CommandArrayOutput values. You can construct a concrete instance of `CommandArrayInput` via:

CommandArray{ CommandArgs{...} }

type CommandArrayOutput

type CommandArrayOutput struct{ *pulumi.OutputState }

func (CommandArrayOutput) ElementType

func (CommandArrayOutput) ElementType() reflect.Type

func (CommandArrayOutput) Index

func (CommandArrayOutput) ToCommandArrayOutput

func (o CommandArrayOutput) ToCommandArrayOutput() CommandArrayOutput

func (CommandArrayOutput) ToCommandArrayOutputWithContext

func (o CommandArrayOutput) ToCommandArrayOutputWithContext(ctx context.Context) CommandArrayOutput

type CommandInput

type CommandInput interface {
	pulumi.Input

	ToCommandOutput() CommandOutput
	ToCommandOutputWithContext(ctx context.Context) CommandOutput
}

type CommandMap

type CommandMap map[string]CommandInput

func (CommandMap) ElementType

func (CommandMap) ElementType() reflect.Type

func (CommandMap) ToCommandMapOutput

func (i CommandMap) ToCommandMapOutput() CommandMapOutput

func (CommandMap) ToCommandMapOutputWithContext

func (i CommandMap) ToCommandMapOutputWithContext(ctx context.Context) CommandMapOutput

type CommandMapInput

type CommandMapInput interface {
	pulumi.Input

	ToCommandMapOutput() CommandMapOutput
	ToCommandMapOutputWithContext(context.Context) CommandMapOutput
}

CommandMapInput is an input type that accepts CommandMap and CommandMapOutput values. You can construct a concrete instance of `CommandMapInput` via:

CommandMap{ "key": CommandArgs{...} }

type CommandMapOutput

type CommandMapOutput struct{ *pulumi.OutputState }

func (CommandMapOutput) ElementType

func (CommandMapOutput) ElementType() reflect.Type

func (CommandMapOutput) MapIndex

func (CommandMapOutput) ToCommandMapOutput

func (o CommandMapOutput) ToCommandMapOutput() CommandMapOutput

func (CommandMapOutput) ToCommandMapOutputWithContext

func (o CommandMapOutput) ToCommandMapOutputWithContext(ctx context.Context) CommandMapOutput

type CommandOutput

type CommandOutput struct{ *pulumi.OutputState }

func (CommandOutput) AddPreviousOutputInEnv added in v0.10.0

func (o CommandOutput) AddPreviousOutputInEnv() pulumi.BoolPtrOutput

If the previous command's stdout and stderr (as generated by the prior create/update) is injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR. Defaults to true.

func (CommandOutput) Archive added in v0.4.0

func (o CommandOutput) Archive() pulumi.ArchiveOutput

An archive asset containing files found after running the command.

func (CommandOutput) ArchivePaths added in v0.4.0

func (o CommandOutput) ArchivePaths() pulumi.StringArrayOutput

A list of path globs to return as a single archive asset after the command completes.

When specifying glob patterns the following rules apply: - We only include files not directories for assets and archives. - Path separators are `/` on all platforms - including Windows. - Patterns starting with `!` are 'exclude' rules. - Rules are evaluated in order, so exclude rules should be after inclusion rules. - `*` matches anything except `/` - `**` matches anything, _including_ `/` - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`. - For full details of the globbing syntax, see github.com/gobwas/glob(https://github.com/gobwas/glob)

#### Example

Given the rules:

When evaluating against this folder:

The following paths will be returned:

func (CommandOutput) AssetPaths added in v0.4.0

func (o CommandOutput) AssetPaths() pulumi.StringArrayOutput

A list of path globs to read after the command completes.

When specifying glob patterns the following rules apply: - We only include files not directories for assets and archives. - Path separators are `/` on all platforms - including Windows. - Patterns starting with `!` are 'exclude' rules. - Rules are evaluated in order, so exclude rules should be after inclusion rules. - `*` matches anything except `/` - `**` matches anything, _including_ `/` - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`. - For full details of the globbing syntax, see github.com/gobwas/glob(https://github.com/gobwas/glob)

#### Example

Given the rules:

When evaluating against this folder:

The following paths will be returned:

func (CommandOutput) Assets added in v0.4.0

A map of assets found after running the command. The key is the relative path from the command dir

func (CommandOutput) Create added in v0.2.0

The command to run on create.

func (CommandOutput) Delete added in v0.2.0

The command to run on delete. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

func (CommandOutput) Dir added in v0.2.0

The directory from which to run the command from. If `dir` does not exist, then `Command` will fail.

func (CommandOutput) ElementType

func (CommandOutput) ElementType() reflect.Type

func (CommandOutput) Environment added in v0.2.0

func (o CommandOutput) Environment() pulumi.StringMapOutput

Additional environment variables available to the command's process.

func (CommandOutput) Interpreter added in v0.2.0

func (o CommandOutput) Interpreter() pulumi.StringArrayOutput

The program and arguments to run the command. On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`

func (CommandOutput) Logging added in v0.11.0

func (o CommandOutput) Logging() LoggingPtrOutput

If the command's stdout and stderr should be logged. This doesn't affect the capturing of stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.

func (CommandOutput) Stderr added in v0.2.0

func (o CommandOutput) Stderr() pulumi.StringOutput

The standard error of the command's process

func (CommandOutput) Stdin added in v0.2.0

Pass a string to the command's process as standard in

func (CommandOutput) Stdout added in v0.2.0

func (o CommandOutput) Stdout() pulumi.StringOutput

The standard output of the command's process

func (CommandOutput) ToCommandOutput

func (o CommandOutput) ToCommandOutput() CommandOutput

func (CommandOutput) ToCommandOutputWithContext

func (o CommandOutput) ToCommandOutputWithContext(ctx context.Context) CommandOutput

func (CommandOutput) Triggers added in v0.2.0

func (o CommandOutput) Triggers() pulumi.ArrayOutput

Trigger a resource replacement on changes to any of these values. The trigger values can be of any type. If a value is different in the current update compared to the previous update, the resource will be replaced, i.e., the "create" command will be re-run. Please see the resource documentation for examples.

func (CommandOutput) Update added in v0.2.0

The command to run on update, if empty, create will run again. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

type CommandState

type CommandState struct {
}

func (CommandState) ElementType

func (CommandState) ElementType() reflect.Type

type Logging added in v0.11.1

type Logging string

func (Logging) ElementType added in v0.11.1

func (Logging) ElementType() reflect.Type

func (Logging) ToLoggingOutput added in v0.11.1

func (e Logging) ToLoggingOutput() LoggingOutput

func (Logging) ToLoggingOutputWithContext added in v0.11.1

func (e Logging) ToLoggingOutputWithContext(ctx context.Context) LoggingOutput

func (Logging) ToLoggingPtrOutput added in v0.11.1

func (e Logging) ToLoggingPtrOutput() LoggingPtrOutput

func (Logging) ToLoggingPtrOutputWithContext added in v0.11.1

func (e Logging) ToLoggingPtrOutputWithContext(ctx context.Context) LoggingPtrOutput

func (Logging) ToStringOutput added in v0.11.1

func (e Logging) ToStringOutput() pulumi.StringOutput

func (Logging) ToStringOutputWithContext added in v0.11.1

func (e Logging) ToStringOutputWithContext(ctx context.Context) pulumi.StringOutput

func (Logging) ToStringPtrOutput added in v0.11.1

func (e Logging) ToStringPtrOutput() pulumi.StringPtrOutput

func (Logging) ToStringPtrOutputWithContext added in v0.11.1

func (e Logging) ToStringPtrOutputWithContext(ctx context.Context) pulumi.StringPtrOutput

type LoggingInput added in v0.11.1

type LoggingInput interface {
	pulumi.Input

	ToLoggingOutput() LoggingOutput
	ToLoggingOutputWithContext(context.Context) LoggingOutput
}

LoggingInput is an input type that accepts values of the Logging enum A concrete instance of `LoggingInput` can be one of the following:

LoggingStdout
LoggingStderr
LoggingStdoutAndStderr
LoggingNone

type LoggingOutput added in v0.11.1

type LoggingOutput struct{ *pulumi.OutputState }

func (LoggingOutput) ElementType added in v0.11.1

func (LoggingOutput) ElementType() reflect.Type

func (LoggingOutput) ToLoggingOutput added in v0.11.1

func (o LoggingOutput) ToLoggingOutput() LoggingOutput

func (LoggingOutput) ToLoggingOutputWithContext added in v0.11.1

func (o LoggingOutput) ToLoggingOutputWithContext(ctx context.Context) LoggingOutput

func (LoggingOutput) ToLoggingPtrOutput added in v0.11.1

func (o LoggingOutput) ToLoggingPtrOutput() LoggingPtrOutput

func (LoggingOutput) ToLoggingPtrOutputWithContext added in v0.11.1

func (o LoggingOutput) ToLoggingPtrOutputWithContext(ctx context.Context) LoggingPtrOutput

func (LoggingOutput) ToStringOutput added in v0.11.1

func (o LoggingOutput) ToStringOutput() pulumi.StringOutput

func (LoggingOutput) ToStringOutputWithContext added in v0.11.1

func (o LoggingOutput) ToStringOutputWithContext(ctx context.Context) pulumi.StringOutput

func (LoggingOutput) ToStringPtrOutput added in v0.11.1

func (o LoggingOutput) ToStringPtrOutput() pulumi.StringPtrOutput

func (LoggingOutput) ToStringPtrOutputWithContext added in v0.11.1

func (o LoggingOutput) ToStringPtrOutputWithContext(ctx context.Context) pulumi.StringPtrOutput

type LoggingPtrInput added in v0.11.1

type LoggingPtrInput interface {
	pulumi.Input

	ToLoggingPtrOutput() LoggingPtrOutput
	ToLoggingPtrOutputWithContext(context.Context) LoggingPtrOutput
}

func LoggingPtr added in v0.11.1

func LoggingPtr(v string) LoggingPtrInput

type LoggingPtrOutput added in v0.11.1

type LoggingPtrOutput struct{ *pulumi.OutputState }

func (LoggingPtrOutput) Elem added in v0.11.1

func (LoggingPtrOutput) ElementType added in v0.11.1

func (LoggingPtrOutput) ElementType() reflect.Type

func (LoggingPtrOutput) ToLoggingPtrOutput added in v0.11.1

func (o LoggingPtrOutput) ToLoggingPtrOutput() LoggingPtrOutput

func (LoggingPtrOutput) ToLoggingPtrOutputWithContext added in v0.11.1

func (o LoggingPtrOutput) ToLoggingPtrOutputWithContext(ctx context.Context) LoggingPtrOutput

func (LoggingPtrOutput) ToStringPtrOutput added in v0.11.1

func (o LoggingPtrOutput) ToStringPtrOutput() pulumi.StringPtrOutput

func (LoggingPtrOutput) ToStringPtrOutputWithContext added in v0.11.1

func (o LoggingPtrOutput) ToStringPtrOutputWithContext(ctx context.Context) pulumi.StringPtrOutput

type RunArgs added in v0.4.0

type RunArgs struct {
	// If the previous command's stdout and stderr (as generated by the prior create/update) is
	// injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR.
	// Defaults to true.
	AddPreviousOutputInEnv *bool `pulumi:"addPreviousOutputInEnv"`
	// A list of path globs to return as a single archive asset after the command completes.
	//
	// When specifying glob patterns the following rules apply:
	// - We only include files not directories for assets and archives.
	// - Path separators are `/` on all platforms - including Windows.
	// - Patterns starting with `!` are 'exclude' rules.
	// - Rules are evaluated in order, so exclude rules should be after inclusion rules.
	// - `*` matches anything except `/`
	// - `**` matches anything, _including_ `/`
	// - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
	// - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
	//
	// #### Example
	//
	// Given the rules:
	//
	// When evaluating against this folder:
	//
	// The following paths will be returned:
	ArchivePaths []string `pulumi:"archivePaths"`
	// A list of path globs to read after the command completes.
	//
	// When specifying glob patterns the following rules apply:
	// - We only include files not directories for assets and archives.
	// - Path separators are `/` on all platforms - including Windows.
	// - Patterns starting with `!` are 'exclude' rules.
	// - Rules are evaluated in order, so exclude rules should be after inclusion rules.
	// - `*` matches anything except `/`
	// - `**` matches anything, _including_ `/`
	// - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
	// - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
	//
	// #### Example
	//
	// Given the rules:
	//
	// When evaluating against this folder:
	//
	// The following paths will be returned:
	AssetPaths []string `pulumi:"assetPaths"`
	// The command to run.
	Command string `pulumi:"command"`
	// The directory from which to run the command from. If `dir` does not exist, then
	// `Command` will fail.
	Dir *string `pulumi:"dir"`
	// Additional environment variables available to the command's process.
	Environment map[string]string `pulumi:"environment"`
	// The program and arguments to run the command.
	// On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`
	Interpreter []string `pulumi:"interpreter"`
	// If the command's stdout and stderr should be logged. This doesn't affect the capturing of
	// stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the
	// outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
	Logging *Logging `pulumi:"logging"`
	// Pass a string to the command's process as standard in
	Stdin *string `pulumi:"stdin"`
}

func (*RunArgs) Defaults added in v0.10.0

func (val *RunArgs) Defaults() *RunArgs

Defaults sets the appropriate defaults for RunArgs

type RunOutputArgs added in v0.4.0

type RunOutputArgs struct {
	// If the previous command's stdout and stderr (as generated by the prior create/update) is
	// injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR.
	// Defaults to true.
	AddPreviousOutputInEnv pulumi.BoolPtrInput `pulumi:"addPreviousOutputInEnv"`
	// A list of path globs to return as a single archive asset after the command completes.
	//
	// When specifying glob patterns the following rules apply:
	// - We only include files not directories for assets and archives.
	// - Path separators are `/` on all platforms - including Windows.
	// - Patterns starting with `!` are 'exclude' rules.
	// - Rules are evaluated in order, so exclude rules should be after inclusion rules.
	// - `*` matches anything except `/`
	// - `**` matches anything, _including_ `/`
	// - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
	// - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
	//
	// #### Example
	//
	// Given the rules:
	//
	// When evaluating against this folder:
	//
	// The following paths will be returned:
	ArchivePaths pulumi.StringArrayInput `pulumi:"archivePaths"`
	// A list of path globs to read after the command completes.
	//
	// When specifying glob patterns the following rules apply:
	// - We only include files not directories for assets and archives.
	// - Path separators are `/` on all platforms - including Windows.
	// - Patterns starting with `!` are 'exclude' rules.
	// - Rules are evaluated in order, so exclude rules should be after inclusion rules.
	// - `*` matches anything except `/`
	// - `**` matches anything, _including_ `/`
	// - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
	// - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
	//
	// #### Example
	//
	// Given the rules:
	//
	// When evaluating against this folder:
	//
	// The following paths will be returned:
	AssetPaths pulumi.StringArrayInput `pulumi:"assetPaths"`
	// The command to run.
	Command pulumi.StringInput `pulumi:"command"`
	// The directory from which to run the command from. If `dir` does not exist, then
	// `Command` will fail.
	Dir pulumi.StringPtrInput `pulumi:"dir"`
	// Additional environment variables available to the command's process.
	Environment pulumi.StringMapInput `pulumi:"environment"`
	// The program and arguments to run the command.
	// On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`
	Interpreter pulumi.StringArrayInput `pulumi:"interpreter"`
	// If the command's stdout and stderr should be logged. This doesn't affect the capturing of
	// stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the
	// outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
	Logging LoggingPtrInput `pulumi:"logging"`
	// Pass a string to the command's process as standard in
	Stdin pulumi.StringPtrInput `pulumi:"stdin"`
}

func (RunOutputArgs) ElementType added in v0.4.0

func (RunOutputArgs) ElementType() reflect.Type

type RunResult added in v0.4.0

type RunResult struct {
	// If the previous command's stdout and stderr (as generated by the prior create/update) is
	// injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR.
	// Defaults to true.
	AddPreviousOutputInEnv *bool `pulumi:"addPreviousOutputInEnv"`
	// An archive asset containing files found after running the command.
	Archive pulumi.Archive `pulumi:"archive"`
	// A list of path globs to return as a single archive asset after the command completes.
	//
	// When specifying glob patterns the following rules apply:
	// - We only include files not directories for assets and archives.
	// - Path separators are `/` on all platforms - including Windows.
	// - Patterns starting with `!` are 'exclude' rules.
	// - Rules are evaluated in order, so exclude rules should be after inclusion rules.
	// - `*` matches anything except `/`
	// - `**` matches anything, _including_ `/`
	// - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
	// - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
	//
	// #### Example
	//
	// Given the rules:
	//
	// When evaluating against this folder:
	//
	// The following paths will be returned:
	ArchivePaths []string `pulumi:"archivePaths"`
	// A list of path globs to read after the command completes.
	//
	// When specifying glob patterns the following rules apply:
	// - We only include files not directories for assets and archives.
	// - Path separators are `/` on all platforms - including Windows.
	// - Patterns starting with `!` are 'exclude' rules.
	// - Rules are evaluated in order, so exclude rules should be after inclusion rules.
	// - `*` matches anything except `/`
	// - `**` matches anything, _including_ `/`
	// - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`.
	// - For full details of the globbing syntax, see [github.com/gobwas/glob](https://github.com/gobwas/glob)
	//
	// #### Example
	//
	// Given the rules:
	//
	// When evaluating against this folder:
	//
	// The following paths will be returned:
	AssetPaths []string `pulumi:"assetPaths"`
	// A map of assets found after running the command.
	// The key is the relative path from the command dir
	Assets map[string]pulumi.AssetOrArchive `pulumi:"assets"`
	// The command to run.
	Command string `pulumi:"command"`
	// The directory from which to run the command from. If `dir` does not exist, then
	// `Command` will fail.
	Dir *string `pulumi:"dir"`
	// Additional environment variables available to the command's process.
	Environment map[string]string `pulumi:"environment"`
	// The program and arguments to run the command.
	// On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`
	Interpreter []string `pulumi:"interpreter"`
	// If the command's stdout and stderr should be logged. This doesn't affect the capturing of
	// stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the
	// outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
	Logging *Logging `pulumi:"logging"`
	// The standard error of the command's process
	Stderr string `pulumi:"stderr"`
	// Pass a string to the command's process as standard in
	Stdin *string `pulumi:"stdin"`
	// The standard output of the command's process
	Stdout string `pulumi:"stdout"`
}

func Run added in v0.4.0

func Run(ctx *pulumi.Context, args *RunArgs, opts ...pulumi.InvokeOption) (*RunResult, error)

A local command to be executed. This command will always be run on any preview or deployment. Use `local.Command` to avoid duplicating executions.

func (*RunResult) Defaults added in v0.10.0

func (val *RunResult) Defaults() *RunResult

Defaults sets the appropriate defaults for RunResult

type RunResultOutput added in v0.4.0

type RunResultOutput struct{ *pulumi.OutputState }

func RunOutput added in v0.4.0

func RunOutput(ctx *pulumi.Context, args RunOutputArgs, opts ...pulumi.InvokeOption) RunResultOutput

func (RunResultOutput) AddPreviousOutputInEnv added in v0.10.0

func (o RunResultOutput) AddPreviousOutputInEnv() pulumi.BoolPtrOutput

If the previous command's stdout and stderr (as generated by the prior create/update) is injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR. Defaults to true.

func (RunResultOutput) Archive added in v0.4.0

func (o RunResultOutput) Archive() pulumi.ArchiveOutput

An archive asset containing files found after running the command.

func (RunResultOutput) ArchivePaths added in v0.7.0

func (o RunResultOutput) ArchivePaths() pulumi.StringArrayOutput

A list of path globs to return as a single archive asset after the command completes.

When specifying glob patterns the following rules apply: - We only include files not directories for assets and archives. - Path separators are `/` on all platforms - including Windows. - Patterns starting with `!` are 'exclude' rules. - Rules are evaluated in order, so exclude rules should be after inclusion rules. - `*` matches anything except `/` - `**` matches anything, _including_ `/` - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`. - For full details of the globbing syntax, see github.com/gobwas/glob(https://github.com/gobwas/glob)

#### Example

Given the rules:

When evaluating against this folder:

The following paths will be returned:

func (RunResultOutput) AssetPaths added in v0.7.0

func (o RunResultOutput) AssetPaths() pulumi.StringArrayOutput

A list of path globs to read after the command completes.

When specifying glob patterns the following rules apply: - We only include files not directories for assets and archives. - Path separators are `/` on all platforms - including Windows. - Patterns starting with `!` are 'exclude' rules. - Rules are evaluated in order, so exclude rules should be after inclusion rules. - `*` matches anything except `/` - `**` matches anything, _including_ `/` - All returned paths are relative to the working directory (without leading `./`) e.g. `file.text` or `subfolder/file.txt`. - For full details of the globbing syntax, see github.com/gobwas/glob(https://github.com/gobwas/glob)

#### Example

Given the rules:

When evaluating against this folder:

The following paths will be returned:

func (RunResultOutput) Assets added in v0.4.0

A map of assets found after running the command. The key is the relative path from the command dir

func (RunResultOutput) Command added in v0.4.0

func (o RunResultOutput) Command() pulumi.StringOutput

The command to run.

func (RunResultOutput) Dir added in v0.4.0

The directory from which to run the command from. If `dir` does not exist, then `Command` will fail.

func (RunResultOutput) ElementType added in v0.4.0

func (RunResultOutput) ElementType() reflect.Type

func (RunResultOutput) Environment added in v0.4.0

func (o RunResultOutput) Environment() pulumi.StringMapOutput

Additional environment variables available to the command's process.

func (RunResultOutput) Interpreter added in v0.4.0

func (o RunResultOutput) Interpreter() pulumi.StringArrayOutput

The program and arguments to run the command. On Linux and macOS, defaults to: `["/bin/sh", "-c"]`. On Windows, defaults to: `["cmd", "/C"]`

func (RunResultOutput) Logging added in v0.11.0

func (o RunResultOutput) Logging() LoggingPtrOutput

If the command's stdout and stderr should be logged. This doesn't affect the capturing of stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.

func (RunResultOutput) Stderr added in v0.4.0

func (o RunResultOutput) Stderr() pulumi.StringOutput

The standard error of the command's process

func (RunResultOutput) Stdin added in v0.4.0

Pass a string to the command's process as standard in

func (RunResultOutput) Stdout added in v0.4.0

func (o RunResultOutput) Stdout() pulumi.StringOutput

The standard output of the command's process

func (RunResultOutput) ToRunResultOutput added in v0.4.0

func (o RunResultOutput) ToRunResultOutput() RunResultOutput

func (RunResultOutput) ToRunResultOutputWithContext added in v0.4.0

func (o RunResultOutput) ToRunResultOutputWithContext(ctx context.Context) RunResultOutput

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL