Skip to content

Resource: awsCodedeployDeploymentConfig

Provides a CodeDeploy deployment config for an application

Example Usage

Server Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCodedeployDeploymentConfigFoo =
  new aws.codedeployDeploymentConfig.CodedeployDeploymentConfig(this, "foo", {
    deploymentConfigName: "test-deployment-config",
    minimumHealthyHosts: {
      type: "HOST_COUNT",
      value: 2,
    },
  });
const awsCodedeployDeploymentGroupFoo =
  new aws.codedeployDeploymentGroup.CodedeployDeploymentGroup(this, "foo_1", {
    alarmConfiguration: {
      alarms: ["my-alarm-name"],
      enabled: true,
    },
    appName: "${aws_codedeploy_app.foo_app.name}",
    autoRollbackConfiguration: {
      enabled: true,
      events: ["DEPLOYMENT_FAILURE"],
    },
    deploymentConfigName: awsCodedeployDeploymentConfigFoo.id,
    deploymentGroupName: "bar",
    ec2TagFilter: [
      {
        key: "filterkey",
        type: "KEY_AND_VALUE",
        value: "filtervalue",
      },
    ],
    serviceRoleArn: "${aws_iam_role.foo_role.arn}",
    triggerConfiguration: [
      {
        triggerEvents: ["DeploymentFailure"],
        triggerName: "foo-trigger",
        triggerTargetArn: "foo-topic-arn",
      },
    ],
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCodedeployDeploymentGroupFoo.overrideLogicalId("foo");

Lambda Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCodedeployDeploymentConfigFoo =
  new aws.codedeployDeploymentConfig.CodedeployDeploymentConfig(this, "foo", {
    computePlatform: "Lambda",
    deploymentConfigName: "test-deployment-config",
    trafficRoutingConfig: {
      timeBasedLinear: {
        interval: 10,
        percentage: 10,
      },
      type: "TimeBasedLinear",
    },
  });
const awsCodedeployDeploymentGroupFoo =
  new aws.codedeployDeploymentGroup.CodedeployDeploymentGroup(this, "foo_1", {
    alarmConfiguration: {
      alarms: ["my-alarm-name"],
      enabled: true,
    },
    appName: "${aws_codedeploy_app.foo_app.name}",
    autoRollbackConfiguration: {
      enabled: true,
      events: ["DEPLOYMENT_STOP_ON_ALARM"],
    },
    deploymentConfigName: awsCodedeployDeploymentConfigFoo.id,
    deploymentGroupName: "bar",
    serviceRoleArn: "${aws_iam_role.foo_role.arn}",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCodedeployDeploymentGroupFoo.overrideLogicalId("foo");

Argument Reference

The following arguments are supported:

  • deploymentConfigName - (Required) The name of the deployment config.
  • computePlatform - (Optional) The compute platform can be server, lambda, or ecs. Default is server.
  • minimumHealthyHosts - (Optional) A minimum_healthy_hosts block. Required for server compute platform. Minimum Healthy Hosts are documented below.
  • trafficRoutingConfig - (Optional) A traffic_routing_config block. Traffic Routing Config is documented below.

The minimumHealthyHosts block supports the following:

  • type - (Required) The type can either be FLEET_PERCENT or HOST_COUNT.
  • value - (Required) The value when the type is FLEET_PERCENT represents the minimum number of healthy instances as a percentage of the total number of instances in the deployment. If you specify FLEET_PERCENT, at the start of the deployment, AWS CodeDeploy converts the percentage to the equivalent number of instance and rounds up fractional instances. When the type is HOST_COUNT, the value represents the minimum number of healthy instances as an absolute value.

The trafficRoutingConfig block supports the following:

  • type - (Optional) Type of traffic routing config. One of timeBasedCanary, timeBasedLinear, allAtOnce.
  • timeBasedCanary - (Optional) The time based canary configuration information. If type is timeBasedLinear, use timeBasedLinear instead.
  • timeBasedLinear - (Optional) The time based linear configuration information. If type is timeBasedCanary, use timeBasedCanary instead.

The timeBasedCanary block supports the following:

  • interval - (Optional) The number of minutes between the first and second traffic shifts of a timeBasedCanary deployment.
  • percentage - (Optional) The percentage of traffic to shift in the first increment of a timeBasedCanary deployment.

The timeBasedLinear block supports the following:

  • interval - (Optional) The number of minutes between each incremental traffic shift of a timeBasedLinear deployment.
  • percentage - (Optional) The percentage of traffic that is shifted at the start of each increment of a timeBasedLinear deployment.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The deployment group's config name.
  • deploymentConfigId - The AWS Assigned deployment config id

Import

CodeDeploy Deployment Configurations can be imported using the deploymentConfigName, e.g.,

$ terraform import aws_codedeploy_deployment_config.example my-deployment-config