It is a gray area.
For instance, in Curse of Strahd's Death House, there are doors that are barred with spinning blade traps. They inflict damage from failed saving throws as opposed to attack rolls, so aren't really attacks. When I ran it, I was prepared to rule that Blade Ward would work...