Deployment

Provides an API Gateway REST Deployment.

Note: This resource depends on having at least one aws.apigateway.Integration created in the REST API, which itself has other dependencies. To avoid race conditions when all resources are being created together, you need to add implicit resource references via the triggers argument or explicit resource references using the resource dependsOn meta-argument.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
        {
            Description = "This is my API for demonstration purposes",
        });
        var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
        {
            RestApi = myDemoAPI.Id,
            ParentId = myDemoAPI.RootResourceId,
            PathPart = "test",
        });
        var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
        {
            RestApi = myDemoAPI.Id,
            ResourceId = myDemoResource.Id,
            HttpMethod = "GET",
            Authorization = "NONE",
        });
        var myDemoIntegration = new Aws.ApiGateway.Integration("myDemoIntegration", new Aws.ApiGateway.IntegrationArgs
        {
            RestApi = myDemoAPI.Id,
            ResourceId = myDemoResource.Id,
            HttpMethod = myDemoMethod.HttpMethod,
            Type = "MOCK",
        });
        var myDemoDeployment = new Aws.ApiGateway.Deployment("myDemoDeployment", new Aws.ApiGateway.DeploymentArgs
        {
            RestApi = myDemoAPI.Id,
            StageName = "test",
            Variables = 
            {
                { "answer", "42" },
            },
        }, new CustomResourceOptions
        {
            DependsOn = 
            {
                myDemoIntegration,
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/apigateway"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        myDemoAPI, err := apigateway.NewRestApi(ctx, "myDemoAPI", &apigateway.RestApiArgs{
            Description: pulumi.String("This is my API for demonstration purposes"),
        })
        if err != nil {
            return err
        }
        myDemoResource, err := apigateway.NewResource(ctx, "myDemoResource", &apigateway.ResourceArgs{
            RestApi:  myDemoAPI.ID(),
            ParentId: myDemoAPI.RootResourceId,
            PathPart: pulumi.String("test"),
        })
        if err != nil {
            return err
        }
        myDemoMethod, err := apigateway.NewMethod(ctx, "myDemoMethod", &apigateway.MethodArgs{
            RestApi:       myDemoAPI.ID(),
            ResourceId:    myDemoResource.ID(),
            HttpMethod:    pulumi.String("GET"),
            Authorization: pulumi.String("NONE"),
        })
        if err != nil {
            return err
        }
        myDemoIntegration, err := apigateway.NewIntegration(ctx, "myDemoIntegration", &apigateway.IntegrationArgs{
            RestApi:    myDemoAPI.ID(),
            ResourceId: myDemoResource.ID(),
            HttpMethod: myDemoMethod.HttpMethod,
            Type:       pulumi.String("MOCK"),
        })
        if err != nil {
            return err
        }
        _, err = apigateway.NewDeployment(ctx, "myDemoDeployment", &apigateway.DeploymentArgs{
            RestApi:   myDemoAPI.ID(),
            StageName: pulumi.String("test"),
            Variables: pulumi.StringMap{
                "answer": pulumi.String("42"),
            },
        }, pulumi.DependsOn([]pulumi.Resource{
            myDemoIntegration,
        }))
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

my_demo_api = aws.apigateway.RestApi("myDemoAPI", description="This is my API for demonstration purposes")
my_demo_resource = aws.apigateway.Resource("myDemoResource",
    rest_api=my_demo_api.id,
    parent_id=my_demo_api.root_resource_id,
    path_part="test")
my_demo_method = aws.apigateway.Method("myDemoMethod",
    rest_api=my_demo_api.id,
    resource_id=my_demo_resource.id,
    http_method="GET",
    authorization="NONE")
my_demo_integration = aws.apigateway.Integration("myDemoIntegration",
    rest_api=my_demo_api.id,
    resource_id=my_demo_resource.id,
    http_method=my_demo_method.http_method,
    type="MOCK")
my_demo_deployment = aws.apigateway.Deployment("myDemoDeployment",
    rest_api=my_demo_api.id,
    stage_name="test",
    variables={
        "answer": "42",
    },
    opts=ResourceOptions(depends_on=[my_demo_integration]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const myDemoAPI = new aws.apigateway.RestApi("myDemoAPI", {description: "This is my API for demonstration purposes"});
const myDemoResource = new aws.apigateway.Resource("myDemoResource", {
    restApi: myDemoAPI.id,
    parentId: myDemoAPI.rootResourceId,
    pathPart: "test",
});
const myDemoMethod = new aws.apigateway.Method("myDemoMethod", {
    restApi: myDemoAPI.id,
    resourceId: myDemoResource.id,
    httpMethod: "GET",
    authorization: "NONE",
});
const myDemoIntegration = new aws.apigateway.Integration("myDemoIntegration", {
    restApi: myDemoAPI.id,
    resourceId: myDemoResource.id,
    httpMethod: myDemoMethod.httpMethod,
    type: "MOCK",
});
const myDemoDeployment = new aws.apigateway.Deployment("myDemoDeployment", {
    restApi: myDemoAPI.id,
    stageName: "test",
    variables: {
        answer: "42",
    },
}, {
    dependsOn: [myDemoIntegration],
});

Create a Deployment Resource

def Deployment(resource_name, opts=None, description=None, rest_api=None, stage_description=None, stage_name=None, triggers=None, variables=None, __props__=None);
func NewDeployment(ctx *Context, name string, args DeploymentArgs, opts ...ResourceOption) (*Deployment, error)
public Deployment(string name, DeploymentArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args DeploymentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args DeploymentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DeploymentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Deployment Resource Properties

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

Inputs

The Deployment resource accepts the following input properties:

RestApi string

The ID of the associated REST API

Description string

The description of the deployment

StageDescription string

The description of the stage

StageName string

The name of the stage. If the specified stage already exists, it will be updated to point to the new deployment. If the stage does not exist, a new one will be created and point to this deployment.

Triggers Dictionary<string, string>

A map of arbitrary keys and values that, when changed, will trigger a redeployment.

Variables Dictionary<string, string>

A map that defines variables for the stage

RestApi interface{}

The ID of the associated REST API

Description string

The description of the deployment

StageDescription string

The description of the stage

StageName string

The name of the stage. If the specified stage already exists, it will be updated to point to the new deployment. If the stage does not exist, a new one will be created and point to this deployment.

Triggers map[string]string

A map of arbitrary keys and values that, when changed, will trigger a redeployment.

Variables map[string]string

A map that defines variables for the stage

restApi string | RestApi

The ID of the associated REST API

description string

The description of the deployment

stageDescription string

The description of the stage

stageName string

The name of the stage. If the specified stage already exists, it will be updated to point to the new deployment. If the stage does not exist, a new one will be created and point to this deployment.

triggers {[key: string]: string}

A map of arbitrary keys and values that, when changed, will trigger a redeployment.

variables {[key: string]: string}

A map that defines variables for the stage

rest_api string | str

The ID of the associated REST API

description str

The description of the deployment

stage_description str

The description of the stage

stage_name str

The name of the stage. If the specified stage already exists, it will be updated to point to the new deployment. If the stage does not exist, a new one will be created and point to this deployment.

triggers Dict[str, str]

A map of arbitrary keys and values that, when changed, will trigger a redeployment.

variables Dict[str, str]

A map that defines variables for the stage

Outputs

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

CreatedDate string

The creation date of the deployment

ExecutionArn string

The execution ARN to be used in lambda_permission resource’s source_arn when allowing API Gateway to invoke a Lambda function, e.g. arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod

Id string
The provider-assigned unique ID for this managed resource.
InvokeUrl string

The URL to invoke the API pointing to the stage, e.g. https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod

CreatedDate string

The creation date of the deployment

ExecutionArn string

The execution ARN to be used in lambda_permission resource’s source_arn when allowing API Gateway to invoke a Lambda function, e.g. arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod

Id string
The provider-assigned unique ID for this managed resource.
InvokeUrl string

The URL to invoke the API pointing to the stage, e.g. https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod

createdDate string

The creation date of the deployment

executionArn string

The execution ARN to be used in lambda_permission resource’s source_arn when allowing API Gateway to invoke a Lambda function, e.g. arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod

id string
The provider-assigned unique ID for this managed resource.
invokeUrl string

The URL to invoke the API pointing to the stage, e.g. https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod

created_date str

The creation date of the deployment

execution_arn str

The execution ARN to be used in lambda_permission resource’s source_arn when allowing API Gateway to invoke a Lambda function, e.g. arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod

id str
The provider-assigned unique ID for this managed resource.
invoke_url str

The URL to invoke the API pointing to the stage, e.g. https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod

Look up an Existing Deployment Resource

Get an existing Deployment 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?: DeploymentState, opts?: CustomResourceOptions): Deployment
static get(resource_name, id, opts=None, created_date=None, description=None, execution_arn=None, invoke_url=None, rest_api=None, stage_description=None, stage_name=None, triggers=None, variables=None, __props__=None);
func GetDeployment(ctx *Context, name string, id IDInput, state *DeploymentState, opts ...ResourceOption) (*Deployment, error)
public static Deployment Get(string name, Input<string> id, DeploymentState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

CreatedDate string

The creation date of the deployment

Description string

The description of the deployment

ExecutionArn string

The execution ARN to be used in lambda_permission resource’s source_arn when allowing API Gateway to invoke a Lambda function, e.g. arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod

InvokeUrl string

The URL to invoke the API pointing to the stage, e.g. https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod

RestApi string

The ID of the associated REST API

StageDescription string

The description of the stage

StageName string

The name of the stage. If the specified stage already exists, it will be updated to point to the new deployment. If the stage does not exist, a new one will be created and point to this deployment.

Triggers Dictionary<string, string>

A map of arbitrary keys and values that, when changed, will trigger a redeployment.

Variables Dictionary<string, string>

A map that defines variables for the stage

CreatedDate string

The creation date of the deployment

Description string

The description of the deployment

ExecutionArn string

The execution ARN to be used in lambda_permission resource’s source_arn when allowing API Gateway to invoke a Lambda function, e.g. arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod

InvokeUrl string

The URL to invoke the API pointing to the stage, e.g. https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod

RestApi interface{}

The ID of the associated REST API

StageDescription string

The description of the stage

StageName string

The name of the stage. If the specified stage already exists, it will be updated to point to the new deployment. If the stage does not exist, a new one will be created and point to this deployment.

Triggers map[string]string

A map of arbitrary keys and values that, when changed, will trigger a redeployment.

Variables map[string]string

A map that defines variables for the stage

createdDate string

The creation date of the deployment

description string

The description of the deployment

executionArn string

The execution ARN to be used in lambda_permission resource’s source_arn when allowing API Gateway to invoke a Lambda function, e.g. arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod

invokeUrl string

The URL to invoke the API pointing to the stage, e.g. https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod

restApi string | RestApi

The ID of the associated REST API

stageDescription string

The description of the stage

stageName string

The name of the stage. If the specified stage already exists, it will be updated to point to the new deployment. If the stage does not exist, a new one will be created and point to this deployment.

triggers {[key: string]: string}

A map of arbitrary keys and values that, when changed, will trigger a redeployment.

variables {[key: string]: string}

A map that defines variables for the stage

created_date str

The creation date of the deployment

description str

The description of the deployment

execution_arn str

The execution ARN to be used in lambda_permission resource’s source_arn when allowing API Gateway to invoke a Lambda function, e.g. arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod

invoke_url str

The URL to invoke the API pointing to the stage, e.g. https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod

rest_api string | str

The ID of the associated REST API

stage_description str

The description of the stage

stage_name str

The name of the stage. If the specified stage already exists, it will be updated to point to the new deployment. If the stage does not exist, a new one will be created and point to this deployment.

triggers Dict[str, str]

A map of arbitrary keys and values that, when changed, will trigger a redeployment.

variables Dict[str, str]

A map that defines variables for the stage

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.