providers/aws: destroy for autoscaling and launch conf

This commit is contained in:
Jack Pearkes 2014-07-10 15:41:06 -04:00
parent 4a5fb8c0b9
commit 45d318f573
2 changed files with 23 additions and 14 deletions

View File

@ -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
} }

View File

@ -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
} }