UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

265 lines • 11.3 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.DeploymentGroup = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a CodeDeploy Deployment Group for a CodeDeploy Application * * > **NOTE on blue/green deployments:** When using `greenFleetProvisioningOption` with the `COPY_AUTO_SCALING_GROUP` action, CodeDeploy will create a new ASG with a different name. This ASG is _not_ managed by this provider and will conflict with existing configuration and state. You may want to use a different approach to managing deployments that involve multiple ASG, such as `DISCOVER_EXISTING` with separate blue and green ASG. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const assumeRole = aws.iam.getPolicyDocument({ * statements: [{ * effect: "Allow", * principals: [{ * type: "Service", * identifiers: ["codedeploy.amazonaws.com"], * }], * actions: ["sts:AssumeRole"], * }], * }); * const example = new aws.iam.Role("example", { * name: "example-role", * assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json), * }); * const aWSCodeDeployRole = new aws.iam.RolePolicyAttachment("AWSCodeDeployRole", { * policyArn: "arn:aws:iam::aws:policy/service-role/AWSCodeDeployRole", * role: example.name, * }); * const exampleApplication = new aws.codedeploy.Application("example", {name: "example-app"}); * const exampleTopic = new aws.sns.Topic("example", {name: "example-topic"}); * const exampleDeploymentGroup = new aws.codedeploy.DeploymentGroup("example", { * appName: exampleApplication.name, * deploymentGroupName: "example-group", * serviceRoleArn: example.arn, * ec2TagSets: [{ * ec2TagFilters: [ * { * key: "filterkey1", * type: "KEY_AND_VALUE", * value: "filtervalue", * }, * { * key: "filterkey2", * type: "KEY_AND_VALUE", * value: "filtervalue", * }, * ], * }], * triggerConfigurations: [{ * triggerEvents: ["DeploymentFailure"], * triggerName: "example-trigger", * triggerTargetArn: exampleTopic.arn, * }], * autoRollbackConfiguration: { * enabled: true, * events: ["DEPLOYMENT_FAILURE"], * }, * alarmConfiguration: { * alarms: ["my-alarm-name"], * enabled: true, * }, * outdatedInstancesStrategy: "UPDATE", * }); * ``` * * ### Blue Green Deployments with ECS * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.codedeploy.Application("example", { * computePlatform: "ECS", * name: "example", * }); * const exampleDeploymentGroup = new aws.codedeploy.DeploymentGroup("example", { * appName: example.name, * deploymentConfigName: "CodeDeployDefault.ECSAllAtOnce", * deploymentGroupName: "example", * serviceRoleArn: exampleAwsIamRole.arn, * autoRollbackConfiguration: { * enabled: true, * events: ["DEPLOYMENT_FAILURE"], * }, * blueGreenDeploymentConfig: { * deploymentReadyOption: { * actionOnTimeout: "CONTINUE_DEPLOYMENT", * }, * terminateBlueInstancesOnDeploymentSuccess: { * action: "TERMINATE", * terminationWaitTimeInMinutes: 5, * }, * }, * deploymentStyle: { * deploymentOption: "WITH_TRAFFIC_CONTROL", * deploymentType: "BLUE_GREEN", * }, * ecsService: { * clusterName: exampleAwsEcsCluster.name, * serviceName: exampleAwsEcsService.name, * }, * loadBalancerInfo: { * targetGroupPairInfo: { * prodTrafficRoute: { * listenerArns: [exampleAwsLbListener.arn], * }, * targetGroups: [ * { * name: blue.name, * }, * { * name: green.name, * }, * ], * }, * }, * }); * ``` * * ### Blue Green Deployments with Servers and Classic ELB * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.codedeploy.Application("example", {name: "example-app"}); * const exampleDeploymentGroup = new aws.codedeploy.DeploymentGroup("example", { * appName: example.name, * deploymentGroupName: "example-group", * serviceRoleArn: exampleAwsIamRole.arn, * deploymentStyle: { * deploymentOption: "WITH_TRAFFIC_CONTROL", * deploymentType: "BLUE_GREEN", * }, * loadBalancerInfo: { * elbInfos: [{ * name: exampleAwsElb.name, * }], * }, * blueGreenDeploymentConfig: { * deploymentReadyOption: { * actionOnTimeout: "STOP_DEPLOYMENT", * waitTimeInMinutes: 60, * }, * greenFleetProvisioningOption: { * action: "DISCOVER_EXISTING", * }, * terminateBlueInstancesOnDeploymentSuccess: { * action: "KEEP_ALIVE", * }, * }, * }); * ``` * * ## Import * * Using `pulumi import`, import CodeDeploy Deployment Groups using `app_name`, a colon, and `deployment_group_name`. For example: * * ```sh * $ pulumi import aws:codedeploy/deploymentGroup:DeploymentGroup example my-application:my-deployment-group * ``` */ class DeploymentGroup extends pulumi.CustomResource { /** * Get an existing DeploymentGroup resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new DeploymentGroup(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of DeploymentGroup. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === DeploymentGroup.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["alarmConfiguration"] = state?.alarmConfiguration; resourceInputs["appName"] = state?.appName; resourceInputs["arn"] = state?.arn; resourceInputs["autoRollbackConfiguration"] = state?.autoRollbackConfiguration; resourceInputs["autoscalingGroups"] = state?.autoscalingGroups; resourceInputs["blueGreenDeploymentConfig"] = state?.blueGreenDeploymentConfig; resourceInputs["computePlatform"] = state?.computePlatform; resourceInputs["deploymentConfigName"] = state?.deploymentConfigName; resourceInputs["deploymentGroupId"] = state?.deploymentGroupId; resourceInputs["deploymentGroupName"] = state?.deploymentGroupName; resourceInputs["deploymentStyle"] = state?.deploymentStyle; resourceInputs["ec2TagFilters"] = state?.ec2TagFilters; resourceInputs["ec2TagSets"] = state?.ec2TagSets; resourceInputs["ecsService"] = state?.ecsService; resourceInputs["loadBalancerInfo"] = state?.loadBalancerInfo; resourceInputs["onPremisesInstanceTagFilters"] = state?.onPremisesInstanceTagFilters; resourceInputs["outdatedInstancesStrategy"] = state?.outdatedInstancesStrategy; resourceInputs["region"] = state?.region; resourceInputs["serviceRoleArn"] = state?.serviceRoleArn; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["terminationHookEnabled"] = state?.terminationHookEnabled; resourceInputs["triggerConfigurations"] = state?.triggerConfigurations; } else { const args = argsOrState; if (args?.appName === undefined && !opts.urn) { throw new Error("Missing required property 'appName'"); } if (args?.deploymentGroupName === undefined && !opts.urn) { throw new Error("Missing required property 'deploymentGroupName'"); } if (args?.serviceRoleArn === undefined && !opts.urn) { throw new Error("Missing required property 'serviceRoleArn'"); } resourceInputs["alarmConfiguration"] = args?.alarmConfiguration; resourceInputs["appName"] = args?.appName; resourceInputs["autoRollbackConfiguration"] = args?.autoRollbackConfiguration; resourceInputs["autoscalingGroups"] = args?.autoscalingGroups; resourceInputs["blueGreenDeploymentConfig"] = args?.blueGreenDeploymentConfig; resourceInputs["deploymentConfigName"] = args?.deploymentConfigName; resourceInputs["deploymentGroupName"] = args?.deploymentGroupName; resourceInputs["deploymentStyle"] = args?.deploymentStyle; resourceInputs["ec2TagFilters"] = args?.ec2TagFilters; resourceInputs["ec2TagSets"] = args?.ec2TagSets; resourceInputs["ecsService"] = args?.ecsService; resourceInputs["loadBalancerInfo"] = args?.loadBalancerInfo; resourceInputs["onPremisesInstanceTagFilters"] = args?.onPremisesInstanceTagFilters; resourceInputs["outdatedInstancesStrategy"] = args?.outdatedInstancesStrategy; resourceInputs["region"] = args?.region; resourceInputs["serviceRoleArn"] = args?.serviceRoleArn; resourceInputs["tags"] = args?.tags; resourceInputs["terminationHookEnabled"] = args?.terminationHookEnabled; resourceInputs["triggerConfigurations"] = args?.triggerConfigurations; resourceInputs["arn"] = undefined /*out*/; resourceInputs["computePlatform"] = undefined /*out*/; resourceInputs["deploymentGroupId"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DeploymentGroup.__pulumiType, name, resourceInputs, opts); } } exports.DeploymentGroup = DeploymentGroup; /** @internal */ DeploymentGroup.__pulumiType = 'aws:codedeploy/deploymentGroup:DeploymentGroup'; //# sourceMappingURL=deploymentGroup.js.map