Skip to content

aws.autoscaling-group resource

Description

Group is an EC2 Auto Scaling group: a fleet of instances kept at a target size from a launch template. The group is keyed by name, the one field fixed at create time; everything else is reconciled in place. CreateAutoScalingGroup accepts the size, placement, health-check, and policy fields plus the structured tags inline; the suspended processes, enabled metrics, and target groups are each reconciled by their own follow-on calls in Create and Update. Because a real instance launches, Create waits for the group to reach its target capacity before returning, and Delete drains the group to zero before removing it. Not-found is an empty describe result, never a typed exception.

Several large sub-features of the CloudFormation resource are out of scope for this port and are not modeled: mixed-instances-policy and launch-configuration (so the launch-template block is required), warm-pool, instance-refresh, traffic-source, the initial-lifecycle-hook two-step create, classic-ELB load-balancers, availability-zone-distribution, and capacity-reservation-specification. The reserved context field, the deprecated launch-configuration ELB-health wait variant, and the deletion of failed scaling activities by an ignore flag are likewise omitted; the failed-activity short-circuit itself is always applied.

Source: internal/service/autoscaling/group_rsrc.go:42

Example usage:

imports: {
  aws: 'github.com/cloudboss/unobin-library-aws'
}

resources: {
  example: aws.autoscaling-group {
    # Set input fields here.
  }
}

Inputs

name

string

required

min-size

integer

required

max-size

integer

required

desired-capacity

optional(integer)

desired-capacity-type

optional(string)

launch-template

object
object({
  id: optional(string)
  name: optional(string)
  version: optional(string)
})

required

availability-zones

list(string)

vpc-zone-identifier

list(string)

default-cooldown

optional(integer)

default-instance-warmup

optional(integer)

health-check-type

optional(string)

health-check-grace-period

optional(integer)

capacity-rebalance

optional(boolean)

max-instance-lifetime

optional(integer)

placement-group

optional(string)

service-linked-role-arn

optional(string)

protect-from-scale-in

optional(boolean)

termination-policies

list(string)

instance-maintenance-policy

optional(object)
optional(
  object({
    min-healthy-percentage: integer
    max-healthy-percentage: integer
  })
)

tags

list(object)
list(
  object({
    key: string
    value: string
    propagate-at-launch: boolean
  })
)

suspended-processes

list(string)

enabled-metrics

list(string)

metrics-granularity

optional(string)

target-group-arns

list(string)

force-delete

optional(boolean)

wait-for-capacity-timeout

optional(string)

Input Constraints

Min size rules

min-size must be zero or greater.

Rule logic
Require
input.min-size == null
|| input.min-size >= 0

Max size rules

max-size must be zero or greater.

Rule logic
Require
input.max-size == null
|| input.max-size >= 0

Field combinations

At most one of availability-zones or vpc-zone-identifier.

Availability zones rules

one of availability-zones or vpc-zone-identifier is required.

Rule logic
Require
input.availability-zones != null
|| input.vpc-zone-identifier != null

Launch template rules

At most one of launch-template.id or launch-template.name.

launch-template requires one of id or name.

Rule logic
Require
input.launch-template.id != null
|| input.launch-template.name != null

Desired capacity type rules

desired-capacity-type must be units, vcpu, or memory-mib.

Rule logic
When
input.desired-capacity-type != null
Require
input.desired-capacity-type == 'units'
|| input.desired-capacity-type == 'vcpu'
|| input.desired-capacity-type == 'memory-mib'

Health check type rules

health-check-type must be EC2, ELB, or VPC_LATTICE.

Rule logic
When
input.health-check-type != null
Require
input.health-check-type == 'EC2'
|| input.health-check-type == 'ELB'
|| input.health-check-type == 'VPC_LATTICE'

Metrics granularity rules

metrics-granularity must be 1Minute.

Rule logic
When
input.metrics-granularity != null
Require
input.metrics-granularity == '1Minute'

Outputs

arn

string

availability-zones

list(string)

vpc-zone-identifier

list(string)

default-cooldown

integer

health-check-type

string

desired-capacity

integer

service-linked-role-arn

string