Deployment
Provides an API Gateway REST Deployment.
Note: This resource depends on having at least one
aws.apigateway.Integrationcreated 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 thetriggersargument or explicit resource references using the resourcedependsOnmeta-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
new Deployment(name: string, args: DeploymentArgs, opts?: CustomResourceOptions);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:
- Rest
Api string The ID of the associated REST API
- Description string
The description of the deployment
- Stage
Description string The description of the stage
- Stage
Name 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
- Rest
Api interface{} The ID of the associated REST API
- Description string
The description of the deployment
- Stage
Description string The description of the stage
- Stage
Name 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
- rest
Api string | RestApi The ID of the associated REST API
- description string
The description of the deployment
- stage
Description string The description of the stage
- stage
Name 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:
- Created
Date string The creation date of the deployment
- Execution
Arn string The execution ARN to be used in
lambda_permissionresource’ssource_arnwhen 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.
- Invoke
Url 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 string The creation date of the deployment
- Execution
Arn string The execution ARN to be used in
lambda_permissionresource’ssource_arnwhen 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.
- Invoke
Url 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 string The creation date of the deployment
- execution
Arn string The execution ARN to be used in
lambda_permissionresource’ssource_arnwhen 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.
- invoke
Url 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_permissionresource’ssource_arnwhen 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): Deploymentstatic 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:
- Created
Date string The creation date of the deployment
- Description string
The description of the deployment
- Execution
Arn string The execution ARN to be used in
lambda_permissionresource’ssource_arnwhen allowing API Gateway to invoke a Lambda function, e.g.arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod- Invoke
Url string 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 The ID of the associated REST API
- Stage
Description string The description of the stage
- Stage
Name 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
- Created
Date string The creation date of the deployment
- Description string
The description of the deployment
- Execution
Arn string The execution ARN to be used in
lambda_permissionresource’ssource_arnwhen allowing API Gateway to invoke a Lambda function, e.g.arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod- Invoke
Url string The URL to invoke the API pointing to the stage, e.g.
https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod- Rest
Api interface{} The ID of the associated REST API
- Stage
Description string The description of the stage
- Stage
Name 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
- created
Date string The creation date of the deployment
- description string
The description of the deployment
- execution
Arn string The execution ARN to be used in
lambda_permissionresource’ssource_arnwhen allowing API Gateway to invoke a Lambda function, e.g.arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod- invoke
Url string 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 | RestApi The ID of the associated REST API
- stage
Description string The description of the stage
- stage
Name 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_permissionresource’ssource_arnwhen 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
awsTerraform Provider.