Skip to content

Commit

Permalink
DNS: Improve duplicate record handling for Route 53
Browse files Browse the repository at this point in the history
  • Loading branch information
webprofusion-chrisc committed Oct 29, 2024
1 parent 92ae0ef commit 0b2a264
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Certify.Providers/DNS/AWSRoute53/DnsProviderAWSRoute53.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,16 @@ public async Task<ActionResult> CreateRecord(DnsRecord request)

if (targetRecordSet != null)
{
targetRecordSet.ResourceRecords.Add(
new ResourceRecord { Value = "\"" + request.RecordValue + "\"" }
);
if (targetRecordSet.ResourceRecords.Any(t => t.Value == "\"" + request.RecordValue + "\""))
{
return new ActionResult { IsSuccess = true, Message = $"Dns Record already exists with required value. Skipping." };
}
else
{
targetRecordSet.ResourceRecords.Add(
new ResourceRecord { Value = "\"" + request.RecordValue + "\"" }
);
}
}
else
{
Expand Down

0 comments on commit 0b2a264

Please sign in to comment.