Skip to content

Commit

Permalink
Fix: Don't delete predefined deployment strategies (#1081)
Browse files Browse the repository at this point in the history
  • Loading branch information
der-eismann committed Aug 23, 2023
1 parent 3472f9d commit 88607f3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions resources/appconfig-deploymentstrategies.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package resources

import (
"fmt"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/appconfig"
Expand Down Expand Up @@ -39,6 +42,13 @@ func ListAppConfigDeploymentStrategies(sess *session.Session) ([]Resource, error
return resources, nil
}

func (f *AppConfigDeploymentStrategy) Filter() error {
if strings.HasPrefix(*f.name, "AppConfig.") {
return fmt.Errorf("cannot delete predefined Deployment Strategy")
}
return nil
}

func (f *AppConfigDeploymentStrategy) Remove() error {
_, err := f.svc.DeleteDeploymentStrategy(&appconfig.DeleteDeploymentStrategyInput{
DeploymentStrategyId: f.id,
Expand Down

0 comments on commit 88607f3

Please sign in to comment.