remove old case to have only one alert/handler for wrong arn
parent
465e6fd7f0
commit
160f541767
|
@ -19,20 +19,6 @@ import (
|
|||
"github.com/cloudskiff/driftctl/pkg/terraform"
|
||||
)
|
||||
|
||||
type pendingTopicAlert struct {
|
||||
endpoint *string
|
||||
}
|
||||
|
||||
func (p *pendingTopicAlert) Message() string {
|
||||
return fmt.Sprintf("%s with pending confirmation status for endpoint \"%s\" will be ignored",
|
||||
aws.AwsSnsTopicSubscriptionResourceType,
|
||||
awssdk.StringValue(p.endpoint))
|
||||
}
|
||||
|
||||
func (p *pendingTopicAlert) ShouldIgnoreResource() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
type wrongArnTopicAlert struct {
|
||||
arn string
|
||||
endpoint *string
|
||||
|
@ -89,21 +75,11 @@ func (s *SNSTopicSubscriptionSupplier) Resources() ([]resource.Resource, error)
|
|||
|
||||
func (s *SNSTopicSubscriptionSupplier) readTopicSubscription(subscription *sns.Subscription, alertr alerter.AlerterInterface) (cty.Value, error) {
|
||||
if subscription.SubscriptionArn != nil && !arn.IsARN(*subscription.SubscriptionArn) {
|
||||
switch *subscription.SubscriptionArn {
|
||||
case "PendingConfirmation":
|
||||
alertr.SendAlert(
|
||||
fmt.Sprintf("%s.%s", aws.AwsSnsTopicSubscriptionResourceType, *subscription.SubscriptionArn),
|
||||
&pendingTopicAlert{subscription.Endpoint},
|
||||
)
|
||||
return cty.NilVal, nil
|
||||
default:
|
||||
alertr.SendAlert(
|
||||
fmt.Sprintf("%s.%s", aws.AwsSnsTopicSubscriptionResourceType, *subscription.SubscriptionArn),
|
||||
&wrongArnTopicAlert{*subscription.SubscriptionArn, subscription.Endpoint},
|
||||
)
|
||||
return cty.NilVal, nil
|
||||
|
||||
}
|
||||
alertr.SendAlert(
|
||||
fmt.Sprintf("%s.%s", aws.AwsSnsTopicSubscriptionResourceType, *subscription.SubscriptionArn),
|
||||
&wrongArnTopicAlert{*subscription.SubscriptionArn, subscription.Endpoint},
|
||||
)
|
||||
return cty.NilVal, nil
|
||||
}
|
||||
|
||||
val, err := s.reader.ReadResource(terraform.ReadResourceArgs{
|
||||
|
|
|
@ -71,7 +71,7 @@ func TestSNSTopicSubscriptionSupplier_Resources(t *testing.T) {
|
|||
},
|
||||
alerts: map[string][]alerter.Alert{
|
||||
"aws_sns_topic_subscription.PendingConfirmation": []alerter.Alert{
|
||||
&pendingTopicAlert{aws.String("TEST")},
|
||||
&wrongArnTopicAlert{"PendingConfirmation", aws.String("TEST")},
|
||||
},
|
||||
"aws_sns_topic_subscription.Incorrect": []alerter.Alert{
|
||||
&wrongArnTopicAlert{"Incorrect", aws.String("INCORRECT")},
|
||||
|
|
Loading…
Reference in New Issue