UNPKG

@pulumi/aws

Version:

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

265 lines • 12.2 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, Object.assign(Object.assign({}, 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 ? state.alarmConfiguration : undefined; resourceInputs["appName"] = state ? state.appName : undefined; resourceInputs["arn"] = state ? state.arn : undefined; resourceInputs["autoRollbackConfiguration"] = state ? state.autoRollbackConfiguration : undefined; resourceInputs["autoscalingGroups"] = state ? state.autoscalingGroups : undefined; resourceInputs["blueGreenDeploymentConfig"] = state ? state.blueGreenDeploymentConfig : undefined; resourceInputs["computePlatform"] = state ? state.computePlatform : undefined; resourceInputs["deploymentConfigName"] = state ? state.deploymentConfigName : undefined; resourceInputs["deploymentGroupId"] = state ? state.deploymentGroupId : undefined; resourceInputs["deploymentGroupName"] = state ? state.deploymentGroupName : undefined; resourceInputs["deploymentStyle"] = state ? state.deploymentStyle : undefined; resourceInputs["ec2TagFilters"] = state ? state.ec2TagFilters : undefined; resourceInputs["ec2TagSets"] = state ? state.ec2TagSets : undefined; resourceInputs["ecsService"] = state ? state.ecsService : undefined; resourceInputs["loadBalancerInfo"] = state ? state.loadBalancerInfo : undefined; resourceInputs["onPremisesInstanceTagFilters"] = state ? state.onPremisesInstanceTagFilters : undefined; resourceInputs["outdatedInstancesStrategy"] = state ? state.outdatedInstancesStrategy : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["serviceRoleArn"] = state ? state.serviceRoleArn : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; resourceInputs["terminationHookEnabled"] = state ? state.terminationHookEnabled : undefined; resourceInputs["triggerConfigurations"] = state ? state.triggerConfigurations : undefined; } else { const args = argsOrState; if ((!args || args.appName === undefined) && !opts.urn) { throw new Error("Missing required property 'appName'"); } if ((!args || args.deploymentGroupName === undefined) && !opts.urn) { throw new Error("Missing required property 'deploymentGroupName'"); } if ((!args || args.serviceRoleArn === undefined) && !opts.urn) { throw new Error("Missing required property 'serviceRoleArn'"); } resourceInputs["alarmConfiguration"] = args ? args.alarmConfiguration : undefined; resourceInputs["appName"] = args ? args.appName : undefined; resourceInputs["autoRollbackConfiguration"] = args ? args.autoRollbackConfiguration : undefined; resourceInputs["autoscalingGroups"] = args ? args.autoscalingGroups : undefined; resourceInputs["blueGreenDeploymentConfig"] = args ? args.blueGreenDeploymentConfig : undefined; resourceInputs["deploymentConfigName"] = args ? args.deploymentConfigName : undefined; resourceInputs["deploymentGroupName"] = args ? args.deploymentGroupName : undefined; resourceInputs["deploymentStyle"] = args ? args.deploymentStyle : undefined; resourceInputs["ec2TagFilters"] = args ? args.ec2TagFilters : undefined; resourceInputs["ec2TagSets"] = args ? args.ec2TagSets : undefined; resourceInputs["ecsService"] = args ? args.ecsService : undefined; resourceInputs["loadBalancerInfo"] = args ? args.loadBalancerInfo : undefined; resourceInputs["onPremisesInstanceTagFilters"] = args ? args.onPremisesInstanceTagFilters : undefined; resourceInputs["outdatedInstancesStrategy"] = args ? args.outdatedInstancesStrategy : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["serviceRoleArn"] = args ? args.serviceRoleArn : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["terminationHookEnabled"] = args ? args.terminationHookEnabled : undefined; resourceInputs["triggerConfigurations"] = args ? args.triggerConfigurations : undefined; 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