providers/aws: destroy for autoscaling and launch conf
This commit is contained in:
parent
4a5fb8c0b9
commit
45d318f573
|
@ -102,21 +102,20 @@ func resource_aws_autoscaling_group_update(
|
||||||
func resource_aws_autoscaling_group_destroy(
|
func resource_aws_autoscaling_group_destroy(
|
||||||
s *terraform.ResourceState,
|
s *terraform.ResourceState,
|
||||||
meta interface{}) error {
|
meta interface{}) error {
|
||||||
// p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
// autoscalingconn := p.autoscalingconn
|
autoscalingconn := p.autoscalingconn
|
||||||
|
|
||||||
log.Printf("[DEBUG] autoscaling Group destroy: %v", s.ID)
|
log.Printf("[DEBUG] autoscaling Group destroy: %v", s.ID)
|
||||||
|
|
||||||
// err := nil
|
_, err := autoscalingconn.DeleteAutoScalingGroup(&autoscaling.DeleteAutoScalingGroup{Name: s.ID})
|
||||||
|
|
||||||
// _, err := autoscalingconn.DeleteAutoScalingGroup(autoscaling.autoscalingGroup{Id: s.ID})
|
if err != nil {
|
||||||
|
autoscalingerr, ok := err.(*autoscaling.Error)
|
||||||
// if err != nil {
|
if ok && autoscalingerr.Code == "InvalidGroup.NotFound" {
|
||||||
// autoscalingerr, ok := err.(*autoscaling.Error)
|
return nil
|
||||||
// if ok && autoscalingerr.Code == "InvalidGroup.NotFound" {
|
}
|
||||||
// return nil
|
return err
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,10 +85,20 @@ func resource_aws_launch_configuration_update(
|
||||||
func resource_aws_launch_configuration_destroy(
|
func resource_aws_launch_configuration_destroy(
|
||||||
s *terraform.ResourceState,
|
s *terraform.ResourceState,
|
||||||
meta interface{}) error {
|
meta interface{}) error {
|
||||||
// p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
// autoscalingconn := p.autoscalingconn
|
autoscalingconn := p.autoscalingconn
|
||||||
|
|
||||||
log.Printf("[DEBUG] launch configuration destroy: %v", s.ID)
|
log.Printf("[DEBUG] Launch Configuration destroy: %v", s.ID)
|
||||||
|
|
||||||
|
_, err := autoscalingconn.DeleteLaunchConfiguration(&autoscaling.DeleteLaunchConfiguration{Name: s.ID})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
autoscalingerr, ok := err.(*autoscaling.Error)
|
||||||
|
if ok && autoscalingerr.Code == "InvalidConfiguration.NotFound" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue