DeploymentArgs

data class DeploymentArgs(val description: Output<String>? = null, val restApi: Output<String>? = null, val stageDescription: Output<String>? = null, val stageName: Output<String>? = null, val triggers: Output<Map<String, String>>? = null, val variables: Output<Map<String, String>>? = null) : ConvertibleToJava<DeploymentArgs>

Manages an API Gateway REST Deployment. A deployment is a snapshot of the REST API configuration. The deployment can then be published to callable endpoints via the aws.apigateway.Stage resource and optionally managed further with the aws.apigateway.BasePathMapping resource, aws.apigateway.DomainName resource, and aws_api_method_settings resource. For more information, see the API Gateway Developer Guide. To properly capture all REST API configuration in a deployment, this resource must have dependencies on all prior resources that manage resources/paths, methods, integrations, etc.

  • For REST APIs that are configured via OpenAPI specification (aws.apigateway.RestApi resource body argument), no special dependency setup is needed beyond referencing the id attribute of that resource unless additional resources have further customized the REST API.

  • When the REST API configuration involves other resources (aws.apigateway.Integration resource), the dependency setup can be done with implicit resource references in the triggers argument or explicit resource references using the resource dependsOn custom option. The triggers argument should be preferred over depends_on, since depends_on can only capture dependency ordering and will not cause the resource to recreate (redeploy the REST API) with upstream configuration changes. !>WARNING: It is recommended to use the aws.apigateway.Stage resource instead of managing an API Gateway Stage via the stage_name argument of this resource. When this resource is recreated (REST API redeployment) with the stage_name configured, the stage is deleted and recreated. This will cause a temporary service interruption, increase provide plan differences, and can require a second apply to recreate any downstream stage configuration such as associated aws_api_method_settings resources.

Example Usage

OpenAPI Specification

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigateway.RestApi;
import com.pulumi.aws.apigateway.RestApiArgs;
import com.pulumi.aws.apigateway.Deployment;
import com.pulumi.aws.apigateway.DeploymentArgs;
import com.pulumi.aws.apigateway.Stage;
import com.pulumi.aws.apigateway.StageArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 exampleRestApi = new RestApi("exampleRestApi", RestApiArgs.builder()
.body(serializeJson(
jsonObject(
jsonProperty("openapi", "3.0.1"),
jsonProperty("info", jsonObject(
jsonProperty("title", "example"),
jsonProperty("version", "1.0")
)),
jsonProperty("paths", jsonObject(
jsonProperty("/path1", jsonObject(
jsonProperty("get", jsonObject(
jsonProperty("x-amazon-apigateway-integration", jsonObject(
jsonProperty("httpMethod", "GET"),
jsonProperty("payloadFormatVersion", "1.0"),
jsonProperty("type", "HTTP_PROXY"),
jsonProperty("uri", "https://ip-ranges.amazonaws.com/ip-ranges.json")
))
))
))
))
)))
.build());
var exampleDeployment = new Deployment("exampleDeployment", DeploymentArgs.builder()
.restApi(exampleRestApi.id())
.triggers(Map.of("redeployment", exampleRestApi.body().applyValue(body -> serializeJson(
body)).applyValue(toJSON -> computeSHA1(toJSON))))
.build());
var exampleStage = new Stage("exampleStage", StageArgs.builder()
.deployment(exampleDeployment.id())
.restApi(exampleRestApi.id())
.stageName("example")
.build());
}
}

Resources

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigateway.RestApi;
import com.pulumi.aws.apigateway.Resource;
import com.pulumi.aws.apigateway.ResourceArgs;
import com.pulumi.aws.apigateway.Method;
import com.pulumi.aws.apigateway.MethodArgs;
import com.pulumi.aws.apigateway.Integration;
import com.pulumi.aws.apigateway.IntegrationArgs;
import com.pulumi.aws.apigateway.Deployment;
import com.pulumi.aws.apigateway.DeploymentArgs;
import com.pulumi.aws.apigateway.Stage;
import com.pulumi.aws.apigateway.StageArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 exampleRestApi = new RestApi("exampleRestApi");
var exampleResource = new Resource("exampleResource", ResourceArgs.builder()
.parentId(exampleRestApi.rootResourceId())
.pathPart("example")
.restApi(exampleRestApi.id())
.build());
var exampleMethod = new Method("exampleMethod", MethodArgs.builder()
.authorization("NONE")
.httpMethod("GET")
.resourceId(exampleResource.id())
.restApi(exampleRestApi.id())
.build());
var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder()
.httpMethod(exampleMethod.httpMethod())
.resourceId(exampleResource.id())
.restApi(exampleRestApi.id())
.type("MOCK")
.build());
var exampleDeployment = new Deployment("exampleDeployment", DeploymentArgs.builder()
.restApi(exampleRestApi.id())
.triggers(Map.of("redeployment", Output.tuple(exampleResource.id(), exampleMethod.id(), exampleIntegration.id()).applyValue(values -> {
var exampleResourceId = values.t1;
var exampleMethodId = values.t2;
var exampleIntegrationId = values.t3;
return serializeJson(
jsonArray(
exampleResourceId,
exampleMethodId,
exampleIntegrationId
));
}).applyValue(toJSON -> computeSHA1(toJSON))))
.build());
var exampleStage = new Stage("exampleStage", StageArgs.builder()
.deployment(exampleDeployment.id())
.restApi(exampleRestApi.id())
.stageName("example")
.build());
}
}

Import

aws_api_gateway_deployment can be imported using REST-API-ID/DEPLOYMENT-ID, e.g.,

$ pulumi import aws:apigateway/deployment:Deployment example aabbccddee/1122334

The stage_name, stage_description, and variables arguments cannot be imported. Use the aws_api_gateway_stage resource to import and manage stages. The triggers argument cannot be imported.

Constructors

Link copied to clipboard
constructor(description: Output<String>? = null, restApi: Output<String>? = null, stageDescription: Output<String>? = null, stageName: Output<String>? = null, triggers: Output<Map<String, String>>? = null, variables: Output<Map<String, String>>? = null)

Properties

Link copied to clipboard
val description: Output<String>? = null

Description of the deployment

Link copied to clipboard
val restApi: Output<String>? = null

REST API identifier.

Link copied to clipboard
val stageDescription: Output<String>? = null

Description to set on the stage managed by the stage_name argument.

Link copied to clipboard
val stageName: Output<String>? = null

Name of the stage to create with this deployment. If the specified stage already exists, it will be updated to point to the new deployment. We recommend using the aws.apigateway.Stage resource instead to manage stages.

Link copied to clipboard
val triggers: Output<Map<String, String>>? = null

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

Link copied to clipboard
val variables: Output<Map<String, String>>? = null

Map to set on the stage managed by the stage_name argument.

Functions

Link copied to clipboard
open override fun toJava(): DeploymentArgs