Class Deployment
Deployment is the entry-point to a Pulumi application. .NET applications
should perform all startup logic they need in their Main
method and then end with:
}static Task<int> Main(string[] args)
{
// program initialization code ...
return Deployment.Run(async () =>
{
// Code that creates resources.
});
Inherited Members
Namespace: Pulumi
Assembly: Pulumi.dll
Syntax
public sealed class Deployment
Properties
View SourceInstance
The current running deployment instance. This is only available from inside the function passed to RunAsync(Action) (or its overloads).
Declaration
public static DeploymentInstance Instance { get; }
Property Value
Type | Description |
---|---|
DeploymentInstance |
Methods
View SourceRunAsync(Action)
RunAsync(Func<Task<IDictionary<string, object?>>>, StackOptions?) for more details.
Declaration
public static Task<int> RunAsync(Action action)
Parameters
Type | Name | Description |
---|---|---|
Action | action | Callback that creates stack resources. |
Returns
Type | Description |
---|---|
Task<int> |
RunAsync(Func<IDictionary<string, object?>>)
RunAsync(Func<Task<IDictionary<string, object?>>>, StackOptions?) for more details.
Declaration
public static Task<int> RunAsync(Func<IDictionary<string, object?>> func)
Parameters
Type | Name | Description |
---|---|---|
Func<IDictionary<string, object>> | func | Callback that creates stack resources. |
Returns
Type | Description |
---|---|
Task<int> | A dictionary of stack outputs. |
RunAsync(Func<Task<IDictionary<string, object?>>>, StackOptions?)
RunAsync(Func<Task<IDictionary<string, object?>>>, StackOptions?) is an
entry-point to a Pulumi application. .NET applications should perform all startup logic
they need in their Main
method and then end with:
}static Task<int> Main(string[] args)
{
// program initialization code ...
return Deployment.Run(async () =>
{
// Code that creates resources.
});
Declaration
public static Task<int> RunAsync(Func<Task<IDictionary<string, object?>>> func, StackOptions? options = null)
Parameters
Type | Name | Description |
---|---|---|
Func<Task<IDictionary<string, object>>> | func | Callback that creates stack resources. |
StackOptions | options | Stack options. |
Returns
Type | Description |
---|---|
Task<int> |
RunAsync(Func<Task>)
RunAsync(Func<Task<IDictionary<string, object?>>>, StackOptions?) for more details.
Declaration
public static Task<int> RunAsync(Func<Task> func)
Parameters
Type | Name | Description |
---|---|---|
Func<Task> | func | Callback that creates stack resources. |
Returns
Type | Description |
---|---|
Task<int> |
RunAsync<TStack>()
RunAsync<TStack>() is an entry-point to a Pulumi
application. .NET applications should perform all startup logic they
need in their Main
method and then end with:
static Task<int> Main(string[] args) {// program
initialization code ...
return Deployment.Run<MyStack>();}</code>
Deployment will instantiate a new stack instance based on the type passed as TStack type parameter. Importantly, cloud resources cannot be created outside of the Pulumi.Deployment.Stack component.
Because cloud Resource construction is inherently asynchronous, the result of this function is a Task<TResult> which should then be returned or awaited. This will ensure that any problems that are encountered during the running of the program are properly reported. Failure to do this may lead to the program ending early before all resources are properly registered.
Declaration
public static Task<int> RunAsync<TStack>() where TStack : Stack, new()
Returns
Type | Description |
---|---|
Task<int> |
Type Parameters
Name | Description |
---|---|
TStack |
RunAsync<TStack>(IServiceProvider)
RunAsync<TStack>() is an entry-point to a Pulumi
application. .NET applications should perform all startup logic they
need in their Main
method and then end with:
static Task<int> Main(string[] args) {// program
initialization code ...
return Deployment.Run<MyStack>(serviceProvider);}</code>
Deployment will instantiate a new stack instance based on the type passed as TStack type parameter using the serviceProvider. Importantly, cloud resources cannot be created outside of the Pulumi.Deployment.Stack component.
Because cloud Resource construction is inherently asynchronous, the result of this function is a Task<TResult> which should then be returned or awaited. This will ensure that any problems that are encountered during the running of the program are properly reported. Failure to do this may lead to the program ending early before all resources are properly registered.
Declaration
public static Task<int> RunAsync<TStack>(IServiceProvider serviceProvider) where TStack : Stack
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider |
Returns
Type | Description |
---|---|
Task<int> |
Type Parameters
Name | Description |
---|---|
TStack |
TestAsync(IMocks, TestOptions, Action)
Entry point to test a Pulumi application. Deployment will run the provided function that creates resources but doesn't actually deploy them Note: Currently, unit tests that call this function must run serially; parallel execution is not supported.
Declaration
public static Task<ImmutableArray<Resource>> TestAsync(IMocks testMocks, TestOptions testOptions, Action createResources)
Parameters
Type | Name | Description |
---|---|---|
IMocks | testMocks | Hooks to mock the engine calls. |
TestOptions | testOptions | Optional settings for the test run. |
Action | createResources | The function which creates resources and returns outputs. |
Returns
Type | Description |
---|---|
Task<ImmutableArray<Resource>> | Test result containing created resources and outputs, if any. |
TestAsync(IMocks, TestOptions, Func<IDictionary<string, object?>>)
Entry point to test a Pulumi application. Deployment will run the provided function that creates resources but doesn't actually deploy them Note: Currently, unit tests that call this function must run serially; parallel execution is not supported.
Declaration
public static Task<(ImmutableArray<Resource> Resources, IDictionary<string, object?> Outputs)> TestAsync(IMocks testMocks, TestOptions testOptions, Func<IDictionary<string, object?>> createResources)
Parameters
Type | Name | Description |
---|---|---|
IMocks | testMocks | Hooks to mock the engine calls. |
TestOptions | testOptions | Optional settings for the test run. |
Func<IDictionary<string, object>> | createResources | The function which creates resources and returns outputs. |
Returns
Type | Description |
---|---|
Task<(ImmutableArray<Resource> Resources, IDictionary<string, object> Outputs)> | Test result containing created resources and outputs, if any. |
TestAsync(IMocks, TestOptions, Func<Task<IDictionary<string, object?>>>)
Entry point to test a Pulumi application. Deployment will run the provided function that creates resources but doesn't actually deploy them Note: Currently, unit tests that call this function must run serially; parallel execution is not supported.
Declaration
public static Task<(ImmutableArray<Resource> Resources, IDictionary<string, object?> Outputs)> TestAsync(IMocks testMocks, TestOptions testOptions, Func<Task<IDictionary<string, object?>>> createResources)
Parameters
Type | Name | Description |
---|---|---|
IMocks | testMocks | Hooks to mock the engine calls. |
TestOptions | testOptions | Optional settings for the test run. |
Func<Task<IDictionary<string, object>>> | createResources | The function which creates resources and returns outputs. |
Returns
Type | Description |
---|---|
Task<(ImmutableArray<Resource> Resources, IDictionary<string, object> Outputs)> | Test result containing created resources and outputs, if any. |
TestAsync(IMocks, TestOptions, Func<Task>)
Entry point to test a Pulumi application. Deployment will run the provided function that creates resources but doesn't actually deploy them Note: Currently, unit tests that call this function must run serially; parallel execution is not supported.
Declaration
public static Task<ImmutableArray<Resource>> TestAsync(IMocks testMocks, TestOptions testOptions, Func<Task> createResources)
Parameters
Type | Name | Description |
---|---|---|
IMocks | testMocks | Hooks to mock the engine calls. |
TestOptions | testOptions | Optional settings for the test run. |
Func<Task> | createResources | The function which creates resources and returns outputs. |
Returns
Type | Description |
---|---|
Task<ImmutableArray<Resource>> | Test result containing created resources and outputs, if any. |
TestAsync<TStack>(IMocks, TestOptions?)
Entry point to test a Pulumi application. Deployment will instantiate a new stack instance based on the type passed as TStack type parameter. This method creates no real resources. Note: Currently, unit tests that call TestAsync<TStack>(IMocks, TestOptions?) must run serially; parallel execution is not supported.
Declaration
public static Task<ImmutableArray<Resource>> TestAsync<TStack>(IMocks mocks, TestOptions? options = null) where TStack : Stack, new()
Parameters
Type | Name | Description |
---|---|---|
IMocks | mocks | Hooks to mock the engine calls. |
TestOptions | options | Optional settings for the test run. |
Returns
Type | Description |
---|---|
Task<ImmutableArray<Resource>> | Test result containing created resources and errors, if any. |
Type Parameters
Name | Description |
---|---|
TStack | The type of the stack to test. |
TestWithServiceProviderAsync<TStack>(IMocks, IServiceProvider, TestOptions?)
Entry point to test a Pulumi application. Deployment will instantiate a new stack instance based on the type passed as TStack type parameter using the given service provider. This method creates no real resources. Note: Currently, unit tests that call TestWithServiceProviderAsync<TStack>(IMocks, IServiceProvider, TestOptions?) must run serially; parallel execution is not supported.
Declaration
public static Task<ImmutableArray<Resource>> TestWithServiceProviderAsync<TStack>(IMocks mocks, IServiceProvider serviceProvider, TestOptions? options = null) where TStack : Stack
Parameters
Type | Name | Description |
---|---|---|
IMocks | mocks | Hooks to mock the engine calls. |
IServiceProvider | serviceProvider | |
TestOptions | options | Optional settings for the test run. |
Returns
Type | Description |
---|---|
Task<ImmutableArray<Resource>> | Test result containing created resources and errors, if any. |
Type Parameters
Name | Description |
---|---|
TStack | The type of the stack to test. |