DeploymentGroup

class DeploymentGroup : KotlinCustomResource

Provides a CodeDeploy Deployment Group for a CodeDeploy Application

NOTE on blue/green deployments: When using green_fleet_provisioning_option 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

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicyAttachment;
import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
import com.pulumi.aws.codedeploy.Application;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.codedeploy.DeploymentGroup;
import com.pulumi.aws.codedeploy.DeploymentGroupArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupEc2TagSetArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupTriggerConfigurationArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupAutoRollbackConfigurationArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupAlarmConfigurationArgs;
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) {
final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("codedeploy.amazonaws.com")
.build())
.actions("sts:AssumeRole")
.build())
.build());
var exampleRole = new Role("exampleRole", RoleArgs.builder()
.assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var aWSCodeDeployRole = new RolePolicyAttachment("aWSCodeDeployRole", RolePolicyAttachmentArgs.builder()
.policyArn("arn:aws:iam::aws:policy/service-role/AWSCodeDeployRole")
.role(exampleRole.name())
.build());
var exampleApplication = new Application("exampleApplication");
var exampleTopic = new Topic("exampleTopic");
var exampleDeploymentGroup = new DeploymentGroup("exampleDeploymentGroup", DeploymentGroupArgs.builder()
.appName(exampleApplication.name())
.deploymentGroupName("example-group")
.serviceRoleArn(exampleRole.arn())
.ec2TagSets(DeploymentGroupEc2TagSetArgs.builder()
.ec2TagFilters(
DeploymentGroupEc2TagSetEc2TagFilterArgs.builder()
.key("filterkey1")
.type("KEY_AND_VALUE")
.value("filtervalue")
.build(),
DeploymentGroupEc2TagSetEc2TagFilterArgs.builder()
.key("filterkey2")
.type("KEY_AND_VALUE")
.value("filtervalue")
.build())
.build())
.triggerConfigurations(DeploymentGroupTriggerConfigurationArgs.builder()
.triggerEvents("DeploymentFailure")
.triggerName("example-trigger")
.triggerTargetArn(exampleTopic.arn())
.build())
.autoRollbackConfiguration(DeploymentGroupAutoRollbackConfigurationArgs.builder()
.enabled(true)
.events("DEPLOYMENT_FAILURE")
.build())
.alarmConfiguration(DeploymentGroupAlarmConfigurationArgs.builder()
.alarms("my-alarm-name")
.enabled(true)
.build())
.build());
}
}

Blue Green Deployments with ECS

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.codedeploy.Application;
import com.pulumi.aws.codedeploy.ApplicationArgs;
import com.pulumi.aws.codedeploy.DeploymentGroup;
import com.pulumi.aws.codedeploy.DeploymentGroupArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupAutoRollbackConfigurationArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupBlueGreenDeploymentConfigArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupBlueGreenDeploymentConfigDeploymentReadyOptionArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupBlueGreenDeploymentConfigTerminateBlueInstancesOnDeploymentSuccessArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupDeploymentStyleArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupEcsServiceArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupLoadBalancerInfoArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupLoadBalancerInfoTargetGroupPairInfoArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupLoadBalancerInfoTargetGroupPairInfoProdTrafficRouteArgs;
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 exampleApplication = new Application("exampleApplication", ApplicationArgs.builder()
.computePlatform("ECS")
.build());
var exampleDeploymentGroup = new DeploymentGroup("exampleDeploymentGroup", DeploymentGroupArgs.builder()
.appName(exampleApplication.name())
.deploymentConfigName("CodeDeployDefault.ECSAllAtOnce")
.deploymentGroupName("example")
.serviceRoleArn(aws_iam_role.example().arn())
.autoRollbackConfiguration(DeploymentGroupAutoRollbackConfigurationArgs.builder()
.enabled(true)
.events("DEPLOYMENT_FAILURE")
.build())
.blueGreenDeploymentConfig(DeploymentGroupBlueGreenDeploymentConfigArgs.builder()
.deploymentReadyOption(DeploymentGroupBlueGreenDeploymentConfigDeploymentReadyOptionArgs.builder()
.actionOnTimeout("CONTINUE_DEPLOYMENT")
.build())
.terminateBlueInstancesOnDeploymentSuccess(DeploymentGroupBlueGreenDeploymentConfigTerminateBlueInstancesOnDeploymentSuccessArgs.builder()
.action("TERMINATE")
.terminationWaitTimeInMinutes(5)
.build())
.build())
.deploymentStyle(DeploymentGroupDeploymentStyleArgs.builder()
.deploymentOption("WITH_TRAFFIC_CONTROL")
.deploymentType("BLUE_GREEN")
.build())
.ecsService(DeploymentGroupEcsServiceArgs.builder()
.clusterName(aws_ecs_cluster.example().name())
.serviceName(aws_ecs_service.example().name())
.build())
.loadBalancerInfo(DeploymentGroupLoadBalancerInfoArgs.builder()
.targetGroupPairInfo(DeploymentGroupLoadBalancerInfoTargetGroupPairInfoArgs.builder()
.prodTrafficRoute(DeploymentGroupLoadBalancerInfoTargetGroupPairInfoProdTrafficRouteArgs.builder()
.listenerArns(aws_lb_listener.example().arn())
.build())
.targetGroups(
DeploymentGroupLoadBalancerInfoTargetGroupPairInfoTargetGroupArgs.builder()
.name(aws_lb_target_group.blue().name())
.build(),
DeploymentGroupLoadBalancerInfoTargetGroupPairInfoTargetGroupArgs.builder()
.name(aws_lb_target_group.green().name())
.build())
.build())
.build())
.build());
}
}

Blue Green Deployments with Servers and Classic ELB

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.codedeploy.Application;
import com.pulumi.aws.codedeploy.DeploymentGroup;
import com.pulumi.aws.codedeploy.DeploymentGroupArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupDeploymentStyleArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupLoadBalancerInfoArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupBlueGreenDeploymentConfigArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupBlueGreenDeploymentConfigDeploymentReadyOptionArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupBlueGreenDeploymentConfigGreenFleetProvisioningOptionArgs;
import com.pulumi.aws.codedeploy.inputs.DeploymentGroupBlueGreenDeploymentConfigTerminateBlueInstancesOnDeploymentSuccessArgs;
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 exampleApplication = new Application("exampleApplication");
var exampleDeploymentGroup = new DeploymentGroup("exampleDeploymentGroup", DeploymentGroupArgs.builder()
.appName(exampleApplication.name())
.deploymentGroupName("example-group")
.serviceRoleArn(aws_iam_role.example().arn())
.deploymentStyle(DeploymentGroupDeploymentStyleArgs.builder()
.deploymentOption("WITH_TRAFFIC_CONTROL")
.deploymentType("BLUE_GREEN")
.build())
.loadBalancerInfo(DeploymentGroupLoadBalancerInfoArgs.builder()
.elbInfos(DeploymentGroupLoadBalancerInfoElbInfoArgs.builder()
.name(aws_elb.example().name())
.build())
.build())
.blueGreenDeploymentConfig(DeploymentGroupBlueGreenDeploymentConfigArgs.builder()
.deploymentReadyOption(DeploymentGroupBlueGreenDeploymentConfigDeploymentReadyOptionArgs.builder()
.actionOnTimeout("STOP_DEPLOYMENT")
.waitTimeInMinutes(60)
.build())
.greenFleetProvisioningOption(DeploymentGroupBlueGreenDeploymentConfigGreenFleetProvisioningOptionArgs.builder()
.action("DISCOVER_EXISTING")
.build())
.terminateBlueInstancesOnDeploymentSuccess(DeploymentGroupBlueGreenDeploymentConfigTerminateBlueInstancesOnDeploymentSuccessArgs.builder()
.action("KEEP_ALIVE")
.build())
.build())
.build());
}
}

Import

CodeDeploy Deployment Groups can be imported by their app_name, a colon, and deployment_group_name, e.g.,

$ pulumi import aws:codedeploy/deploymentGroup:DeploymentGroup example my-application:my-deployment-group

1http://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-sns-event-notifications-create-trigger.html

Properties

Link copied to clipboard

Configuration block of alarms associated with the deployment group (documented below).

Link copied to clipboard
val appName: Output<String>

The name of the application.

Link copied to clipboard
val arn: Output<String>

The ARN of the CodeDeploy deployment group.

Link copied to clipboard

Configuration block of the automatic rollback configuration associated with the deployment group (documented below).

Link copied to clipboard

Autoscaling groups associated with the deployment group.

Link copied to clipboard

Configuration block of the blue/green deployment options for a deployment group (documented below).

Link copied to clipboard
val computePlatform: Output<String>

The destination platform type for the deployment.

Link copied to clipboard

The name of the group's deployment config. The default is "CodeDeployDefault.OneAtATime".

Link copied to clipboard

The ID of the CodeDeploy deployment group.

Link copied to clipboard

The name of the deployment group.

Link copied to clipboard

Configuration block of the type of deployment, either in-place or blue/green, you want to run and whether to route deployment traffic behind a load balancer (documented below).

Link copied to clipboard

Tag filters associated with the deployment group. See the AWS docs for details.

Link copied to clipboard

Configuration block(s) of Tag filters associated with the deployment group, which are also referred to as tag groups (documented below). See the AWS docs for details.

Link copied to clipboard

Configuration block(s) of the ECS services for a deployment group (documented below).

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Single configuration block of the load balancer to use in a blue/green deployment (documented below).

Link copied to clipboard

On premise tag filters associated with the group. See the AWS docs for details.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val serviceRoleArn: Output<String>

The service role ARN that allows deployments.

Link copied to clipboard
val tags: Output<Map<String, String>>?

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard

Configuration block(s) of the triggers for the deployment group (documented below).

Link copied to clipboard
val urn: Output<String>