The French Maginot Line was an amazing system of fortifications and artillery. The Nazis would have been idiots to try to penetrate it. Thankfully the French left the Ardennes open -- building their "wall" through that was too expensive and they rationalized the Germans would also decide the Ardennes was too hard to get mechanized stuff through. This was not really so much a failure of the Maginot Line per se but a failure on the part of the French to think like the enemy would. From the German perspective tearing through the Ardennes was so much the better choice than dealing with the Maginot Line.
It's more complicated than this.
The Belgians had their border with Germany defended by an array of fortifications of their own.
The French government expected that the Belgian forts would last long enough they'd be able to maneuver an armored force into position to stop the Germans.
Not only did this fail (because German fort-capturing tactics were better than anyone ever expected), but there was a worse failure:
The French military spirit, sapped by the experience of WW1, was not up for a new fight. There were literal peace protesters blocking runways on bomber bases so planes could not operate.
No amount of fortifications will protect a country whose spirit has already failed.
(That said, later in the war the Allies managed to organize a French army of over a million strong, so I guess they learned their lesson.)