From 44b00782c3df13732636969daefcde5574ddad7f Mon Sep 17 00:00:00 2001 From: Trevor Pounds Date: Fri, 22 Jan 2016 23:33:20 -0800 Subject: [PATCH] Fix termination policies read logic. --- .../providers/aws/resource_aws_autoscaling_group.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_autoscaling_group.go b/builtin/providers/aws/resource_aws_autoscaling_group.go index 83b39e6ae..9f2788978 100644 --- a/builtin/providers/aws/resource_aws_autoscaling_group.go +++ b/builtin/providers/aws/resource_aws_autoscaling_group.go @@ -251,7 +251,16 @@ func resourceAwsAutoscalingGroupRead(d *schema.ResourceData, meta interface{}) e d.Set("name", g.AutoScalingGroupName) d.Set("tag", g.Tags) d.Set("vpc_zone_identifier", strings.Split(*g.VPCZoneIdentifier, ",")) - d.Set("termination_policies", g.TerminationPolicies) + + // If no termination polices are explicitly configured and the upstream state + // is only using the "Default" policy, clear the state to make it consistent + // with the default AWS create API behavior. + _, ok := d.GetOk("termination_policies") + if !ok && len(g.TerminationPolicies) == 1 && *g.TerminationPolicies[0] == "Default" { + d.Set("termination_policies", []interface{}{}) + } else { + d.Set("termination_policies", flattenStringList(g.TerminationPolicies)) + } return nil }