Class DeploymentGroup
Provides a CodeDeploy Deployment Group for a CodeDeploy Application
NOTE on blue/green deployments: When using
green_fleet_provisioning_optionwith theCOPY_AUTO_SCALING_GROUPaction, 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 asDISCOVER_EXISTINGwith separate blue and green ASG.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleRole = new Aws.Iam.Role("exampleRole", new Aws.Iam.RoleArgs
{
AssumeRolePolicy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
""Sid"": """",
""Effect"": ""Allow"",
""Principal"": {
""Service"": ""codedeploy.amazonaws.com""
},
""Action"": ""sts:AssumeRole""
}
]
}
",
});
var aWSCodeDeployRole = new Aws.Iam.RolePolicyAttachment("aWSCodeDeployRole", new Aws.Iam.RolePolicyAttachmentArgs
{
PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSCodeDeployRole",
Role = exampleRole.Name,
});
var exampleApplication = new Aws.CodeDeploy.Application("exampleApplication", new Aws.CodeDeploy.ApplicationArgs
{
});
var exampleTopic = new Aws.Sns.Topic("exampleTopic", new Aws.Sns.TopicArgs
{
});
var exampleDeploymentGroup = new Aws.CodeDeploy.DeploymentGroup("exampleDeploymentGroup", new Aws.CodeDeploy.DeploymentGroupArgs
{
AlarmConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAlarmConfigurationArgs
{
Alarms =
{
"my-alarm-name",
},
Enabled = true,
},
AppName = exampleApplication.Name,
AutoRollbackConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAutoRollbackConfigurationArgs
{
Enabled = true,
Events =
{
"DEPLOYMENT_FAILURE",
},
},
DeploymentGroupName = "example-group",
Ec2TagSets =
{
new Aws.CodeDeploy.Inputs.DeploymentGroupEc2TagSetArgs
{
Ec2TagFilter =
{
{
{ "key", "filterkey1" },
{ "type", "KEY_AND_VALUE" },
{ "value", "filtervalue" },
},
{
{ "key", "filterkey2" },
{ "type", "KEY_AND_VALUE" },
{ "value", "filtervalue" },
},
},
},
},
ServiceRoleArn = exampleRole.Arn,
TriggerConfigurations =
{
new Aws.CodeDeploy.Inputs.DeploymentGroupTriggerConfigurationArgs
{
TriggerEvents =
{
"DeploymentFailure",
},
TriggerName = "example-trigger",
TriggerTargetArn = exampleTopic.Arn,
},
},
});
}
}
Blue Green Deployments with ECS
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleApplication = new Aws.CodeDeploy.Application("exampleApplication", new Aws.CodeDeploy.ApplicationArgs
{
ComputePlatform = "ECS",
});
var exampleDeploymentGroup = new Aws.CodeDeploy.DeploymentGroup("exampleDeploymentGroup", new Aws.CodeDeploy.DeploymentGroupArgs
{
AppName = exampleApplication.Name,
AutoRollbackConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAutoRollbackConfigurationArgs
{
Enabled = true,
Events =
{
"DEPLOYMENT_FAILURE",
},
},
BlueGreenDeploymentConfig = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigArgs
{
DeploymentReadyOption = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigDeploymentReadyOptionArgs
{
ActionOnTimeout = "CONTINUE_DEPLOYMENT",
},
TerminateBlueInstancesOnDeploymentSuccess = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigTerminateBlueInstancesOnDeploymentSuccessArgs
{
Action = "TERMINATE",
TerminationWaitTimeInMinutes = 5,
},
},
DeploymentConfigName = "CodeDeployDefault.ECSAllAtOnce",
DeploymentGroupName = "example",
DeploymentStyle = new Aws.CodeDeploy.Inputs.DeploymentGroupDeploymentStyleArgs
{
DeploymentOption = "WITH_TRAFFIC_CONTROL",
DeploymentType = "BLUE_GREEN",
},
EcsService = new Aws.CodeDeploy.Inputs.DeploymentGroupEcsServiceArgs
{
ClusterName = aws_ecs_cluster.Example.Name,
ServiceName = aws_ecs_service.Example.Name,
},
LoadBalancerInfo = new Aws.CodeDeploy.Inputs.DeploymentGroupLoadBalancerInfoArgs
{
TargetGroupPairInfo = new Aws.CodeDeploy.Inputs.DeploymentGroupLoadBalancerInfoTargetGroupPairInfoArgs
{
ProdTrafficRoute = new Aws.CodeDeploy.Inputs.DeploymentGroupLoadBalancerInfoTargetGroupPairInfoProdTrafficRouteArgs
{
ListenerArns =
{
aws_lb_listener.Example.Arn,
},
},
TargetGroup =
{
{
{ "name", aws_lb_target_group.Blue.Name },
},
{
{ "name", aws_lb_target_group.Green.Name },
},
},
},
},
ServiceRoleArn = aws_iam_role.Example.Arn,
});
}
}
Blue Green Deployments with Servers and Classic ELB
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleApplication = new Aws.CodeDeploy.Application("exampleApplication", new Aws.CodeDeploy.ApplicationArgs
{
});
var exampleDeploymentGroup = new Aws.CodeDeploy.DeploymentGroup("exampleDeploymentGroup", new Aws.CodeDeploy.DeploymentGroupArgs
{
AppName = exampleApplication.Name,
BlueGreenDeploymentConfig = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigArgs
{
DeploymentReadyOption = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigDeploymentReadyOptionArgs
{
ActionOnTimeout = "STOP_DEPLOYMENT",
WaitTimeInMinutes = 60,
},
GreenFleetProvisioningOption = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigGreenFleetProvisioningOptionArgs
{
Action = "DISCOVER_EXISTING",
},
TerminateBlueInstancesOnDeploymentSuccess = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigTerminateBlueInstancesOnDeploymentSuccessArgs
{
Action = "KEEP_ALIVE",
},
},
DeploymentGroupName = "example-group",
DeploymentStyle = new Aws.CodeDeploy.Inputs.DeploymentGroupDeploymentStyleArgs
{
DeploymentOption = "WITH_TRAFFIC_CONTROL",
DeploymentType = "BLUE_GREEN",
},
LoadBalancerInfo = new Aws.CodeDeploy.Inputs.DeploymentGroupLoadBalancerInfoArgs
{
ElbInfo =
{
{
{ "name", aws_elb.Example.Name },
},
},
},
ServiceRoleArn = aws_iam_role.Example.Arn,
});
}
}
Inherited Members
Namespace: Pulumi.Aws.CodeDeploy
Assembly: Pulumi.Aws.dll
Syntax
public class DeploymentGroup : CustomResource
Constructors
View SourceDeploymentGroup(String, DeploymentGroupArgs, CustomResourceOptions)
Create a DeploymentGroup resource with the given unique name, arguments, and options.
Declaration
public DeploymentGroup(string name, DeploymentGroupArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| DeploymentGroupArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceAlarmConfiguration
Configuration block of alarms associated with the deployment group (documented below).
Declaration
public Output<DeploymentGroupAlarmConfiguration> AlarmConfiguration { get; }
Property Value
| Type | Description |
|---|---|
| Output<DeploymentGroupAlarmConfiguration> |
AppName
The name of the application.
Declaration
public Output<string> AppName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
AutoRollbackConfiguration
Configuration block of the automatic rollback configuration associated with the deployment group (documented below).
Declaration
public Output<DeploymentGroupAutoRollbackConfiguration> AutoRollbackConfiguration { get; }
Property Value
| Type | Description |
|---|---|
| Output<DeploymentGroupAutoRollbackConfiguration> |
AutoscalingGroups
Autoscaling groups associated with the deployment group.
Declaration
public Output<ImmutableArray<string>> AutoscalingGroups { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
BlueGreenDeploymentConfig
Configuration block of the blue/green deployment options for a deployment group (documented below).
Declaration
public Output<DeploymentGroupBlueGreenDeploymentConfig> BlueGreenDeploymentConfig { get; }
Property Value
| Type | Description |
|---|---|
| Output<DeploymentGroupBlueGreenDeploymentConfig> |
DeploymentConfigName
The name of the group's deployment config. The default is "CodeDeployDefault.OneAtATime".
Declaration
public Output<string> DeploymentConfigName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DeploymentGroupName
The name of the deployment group.
Declaration
public Output<string> DeploymentGroupName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DeploymentStyle
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).
Declaration
public Output<DeploymentGroupDeploymentStyle> DeploymentStyle { get; }
Property Value
| Type | Description |
|---|---|
| Output<DeploymentGroupDeploymentStyle> |
Ec2TagFilters
Tag filters associated with the deployment group. See the AWS docs for details.
Declaration
public Output<ImmutableArray<DeploymentGroupEc2TagFilter>> Ec2TagFilters { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<DeploymentGroupEc2TagFilter>> |
Ec2TagSets
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.
Declaration
public Output<ImmutableArray<DeploymentGroupEc2TagSet>> Ec2TagSets { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<DeploymentGroupEc2TagSet>> |
EcsService
Configuration block(s) of the ECS services for a deployment group (documented below).
Declaration
public Output<DeploymentGroupEcsService> EcsService { get; }
Property Value
| Type | Description |
|---|---|
| Output<DeploymentGroupEcsService> |
LoadBalancerInfo
Single configuration block of the load balancer to use in a blue/green deployment (documented below).
Declaration
public Output<DeploymentGroupLoadBalancerInfo> LoadBalancerInfo { get; }
Property Value
| Type | Description |
|---|---|
| Output<DeploymentGroupLoadBalancerInfo> |
OnPremisesInstanceTagFilters
On premise tag filters associated with the group. See the AWS docs for details.
Declaration
public Output<ImmutableArray<DeploymentGroupOnPremisesInstanceTagFilter>> OnPremisesInstanceTagFilters { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<DeploymentGroupOnPremisesInstanceTagFilter>> |
ServiceRoleArn
The service role ARN that allows deployments.
Declaration
public Output<string> ServiceRoleArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
TriggerConfigurations
Configuration block(s) of the triggers for the deployment group (documented below).
Declaration
public Output<ImmutableArray<DeploymentGroupTriggerConfiguration>> TriggerConfigurations { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<DeploymentGroupTriggerConfiguration>> |
Methods
View SourceGet(String, Input<String>, DeploymentGroupState, CustomResourceOptions)
Get an existing DeploymentGroup resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static DeploymentGroup Get(string name, Input<string> id, DeploymentGroupState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| DeploymentGroupState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| DeploymentGroup |