Ejemplo n.º 1
0
    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"      },
Ejemplo n.º 2
0
 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  },
                     },