diff --git a/internal/service/autoscaling/group.go b/internal/service/autoscaling/group.go index 830d6d044e3..9c6794744d2 100644 --- a/internal/service/autoscaling/group.go +++ b/internal/service/autoscaling/group.go @@ -235,6 +235,11 @@ func ResourceGroup() *schema.Resource { ExactlyOneOf: []string{"launch_configuration", "launch_template", "mixed_instances_policy"}, }, + "context": { + Type: schema.TypeString, + Optional: true, + }, + "capacity_rebalance": { Type: schema.TypeBool, Optional: true, @@ -732,6 +737,10 @@ func resourceGroupCreate(d *schema.ResourceData, meta interface{}) error { createOpts.Tags = Tags(KeyValueTags(v, asgName, TagResourceTypeGroup).IgnoreAWS()) } + if v, ok := d.GetOk("context"); ok { + createOpts.Context = aws.String(v.(string)) + } + if v, ok := d.GetOk("capacity_rebalance"); ok { createOpts.CapacityRebalance = aws.Bool(v.(bool)) } @@ -874,6 +883,7 @@ func resourceGroupRead(d *schema.ResourceData, meta interface{}) error { } d.Set("arn", g.AutoScalingGroupARN) + d.Set("context", g.Context) d.Set("capacity_rebalance", g.CapacityRebalance) d.Set("default_cooldown", g.DefaultCooldown) d.Set("desired_capacity", g.DesiredCapacity) @@ -1062,6 +1072,10 @@ func resourceGroupUpdate(d *schema.ResourceData, meta interface{}) error { opts.DefaultCooldown = aws.Int64(int64(d.Get("default_cooldown").(int))) } + if d.HasChange("context") { + opts.Context = aws.String(d.Get("context").(string)) + } + if d.HasChange("capacity_rebalance") { // If the capacity rebalance field is set to null, we need to explicitly set // it back to "false", or the API won't reset it for us. diff --git a/internal/service/autoscaling/group_test.go b/internal/service/autoscaling/group_test.go index be1e27d6152..45d8850ca48 100644 --- a/internal/service/autoscaling/group_test.go +++ b/internal/service/autoscaling/group_test.go @@ -69,6 +69,7 @@ func TestAccAutoScalingGroup_basic(t *testing.T) { resource.TestCheckResourceAttr("aws_autoscaling_group.bar", "min_size", "2"), resource.TestCheckResourceAttr("aws_autoscaling_group.bar", "mixed_instances_policy.#", "0"), resource.TestCheckResourceAttr("aws_autoscaling_group.bar", "name", randName), + resource.TestCheckResourceAttr("aws_autoscaling_group.bar", "context", ""), resource.TestCheckResourceAttr("aws_autoscaling_group.bar", "placement_group", ""), resource.TestCheckResourceAttr("aws_autoscaling_group.bar", "protect_from_scale_in", "false"), acctest.CheckResourceAttrGlobalARN("aws_autoscaling_group.bar", "service_linked_role_arn", "iam", "role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling"), diff --git a/website/docs/r/autoscaling_group.html.markdown b/website/docs/r/autoscaling_group.html.markdown index 33a2c82e356..dab67e31eb1 100644 --- a/website/docs/r/autoscaling_group.html.markdown +++ b/website/docs/r/autoscaling_group.html.markdown @@ -347,6 +347,7 @@ The following arguments are supported: * `min_size` - (Required) The minimum size of the Auto Scaling Group. (See also [Waiting for Capacity](#waiting-for-capacity) below.) * `availability_zones` - (Optional) A list of one or more availability zones for the group. Used for EC2-Classic, attaching a network interface via id from a launch template and default subnets when not specified with `vpc_zone_identifier` argument. Conflicts with `vpc_zone_identifier`. +* `context` - (Optional) Reserved. * `capacity_rebalance` - (Optional) Indicates whether capacity rebalance is enabled. Otherwise, capacity rebalance is disabled. * `default_cooldown` - (Optional) The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. * `launch_configuration` - (Optional) The name of the launch configuration to use.