Auto increment serial number on resource change

Is there a way to have a serial number that it’s increased each time a resource changes?

For example I have a SOA aws_route53_record and the first number in the record is the SOA Record SERIAL. Currently I have to manually update this serial number each time I do a modification on this record. Is there anyway to generate a serial number that it’s autoincremented on resource change?

resource "aws_route53_record" "soa" {
  allow_overwrite = true
  zone_id         = aws_route53_zone.main.zone_id
  name            = aws_route53_zone.main.name
  type            = "SOA"
  ttl             = "30"


  records = [ # serial refreshTTL retryTTL expiryTTL NXTTL
    format("%s. awsdns-hostmaster.amazon.com. ${myserialnumber} 7200 900 1209600 300", aws_route53_zone.main.name_servers[0])
  ]
}