Skip to content

Commit 102228c

Browse files
authored
Merge pull request #1555 from OmerKahani/Change_Order_Delete_Before_Create
AWS: change the order of the actions, DELETE before CREATE fixes #1411
2 parents ccab168 + 231fbea commit 102228c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

provider/aws/aws.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,8 @@ func (p *AWSProvider) tagsForZone(ctx context.Context, zoneID string) (map[strin
592592

593593
func batchChangeSet(cs []*route53.Change, batchSize int) [][]*route53.Change {
594594
if len(cs) <= batchSize {
595-
return [][]*route53.Change{cs}
595+
res := sortChangesByActionNameType(cs)
596+
return [][]*route53.Change{res}
596597
}
597598

598599
batchChanges := make([][]*route53.Change, 0)
@@ -639,10 +640,10 @@ func batchChangeSet(cs []*route53.Change, batchSize int) [][]*route53.Change {
639640

640641
func sortChangesByActionNameType(cs []*route53.Change) []*route53.Change {
641642
sort.SliceStable(cs, func(i, j int) bool {
642-
if *cs[i].Action < *cs[j].Action {
643+
if *cs[i].Action > *cs[j].Action {
643644
return true
644645
}
645-
if *cs[i].Action > *cs[j].Action {
646+
if *cs[i].Action < *cs[j].Action {
646647
return false
647648
}
648649
if *cs[i].ResourceRecordSet.Name < *cs[j].ResourceRecordSet.Name {

0 commit comments

Comments
 (0)