You'll need a permit from your municipality. Where I live, the zoning officer also has to sign off. You will need a level foundation below the frost line and the materials to build it. Some municipalities also require plans to determine if they are safe and appropriate.
Anything attached to a permanent structure requires a permit. If you are doing the work yourself, you need to pull the permit and familiarize yourself with the process. If hiring out, your contractor wiil pull the permit an be responsible for the inspection schedule. Here are a few sites to get you started so you know what to expect.
Hi Tonia - These are two articles that show how we took our small and sad deck and turned it into a gorgeous entertainment space complete with a pergola. Hope they help with some inspiration! Hugs, Holly