providers/aws: support non-destructive update of desired_capacity for

ASG
pull/396/head
Mitchell Hashimoto 12 years ago
parent ad20bbe6f2
commit 5eccbba606

@ -33,7 +33,6 @@ func resourceAwsAutoscalingGroup() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
Computed: true,
ForceNew: true,
},
"min_size": &schema.Schema{
@ -168,6 +167,11 @@ func resourceAwsAutoscalingGroupUpdate(d *schema.ResourceData, meta interface{})
Name: d.Id(),
}
if d.HasChange("desired_capacity") {
opts.DesiredCapacity = d.Get("desired_capacity").(int)
opts.SetDesiredCapacity = true
}
if d.HasChange("min_size") {
opts.MinSize = d.Get("min_size").(int)
opts.SetMinSize = true

@ -40,6 +40,15 @@ func TestAccAWSAutoScalingGroup_basic(t *testing.T) {
"aws_autoscaling_group.bar", "force_delete", "true"),
),
},
resource.TestStep{
Config: testAccAWSAutoScalingGroupConfigUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSAutoScalingGroupExists("aws_autoscaling_group.bar", &group),
resource.TestCheckResourceAttr(
"aws_autoscaling_group.bar", "desired_capacity", "5"),
),
},
},
})
}
@ -198,6 +207,27 @@ resource "aws_autoscaling_group" "bar" {
}
`
const testAccAWSAutoScalingGroupConfigUpdate = `
resource "aws_launch_configuration" "foobar" {
name = "foobarautoscaling-terraform-test"
image_id = "ami-21f78e11"
instance_type = "t1.micro"
}
resource "aws_autoscaling_group" "bar" {
availability_zones = ["us-west-2a"]
name = "foobar3-terraform-test"
max_size = 5
min_size = 2
health_check_grace_period = 300
health_check_type = "ELB"
desired_capacity = 5
force_delete = true
launch_configuration = "${aws_launch_configuration.foobar.name}"
}
`
const testAccAWSAutoScalingGroupConfigWithLoadBalancer = `
resource "aws_elb" "bar" {
name = "foobar-terraform-test"

Loading…
Cancel
Save