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(
|
||||
s *terraform.ResourceState,
|
||||
meta interface{}) error {
|
||||
// p := meta.(*ResourceProvider)
|
||||
// autoscalingconn := p.autoscalingconn
|
||||
p := meta.(*ResourceProvider)
|
||||
autoscalingconn := p.autoscalingconn
|
||||
|
||||
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 ok && autoscalingerr.Code == "InvalidGroup.NotFound" {
|
||||
// return nil
|
||||
// }
|
||||
// }
|
||||
if err != nil {
|
||||
autoscalingerr, ok := err.(*autoscaling.Error)
|
||||
if ok && autoscalingerr.Code == "InvalidGroup.NotFound" {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -85,10 +85,20 @@ func resource_aws_launch_configuration_update(
|
|||
func resource_aws_launch_configuration_destroy(
|
||||
s *terraform.ResourceState,
|
||||
meta interface{}) error {
|
||||
// p := meta.(*ResourceProvider)
|
||||
// autoscalingconn := p.autoscalingconn
|
||||
p := meta.(*ResourceProvider)
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue