Applicable Building Codes

To find your local codes related to specific applications of spray foam and Thermal Barrier, as Royal Rahimi for help in identifying the correct code for your project. 

Do I need a thermal barrier?

In an occupied space, you need a thermal barrier adjacent to either low density or medium density foam - this could be gypsum board or another prescriptive thermal barrier, or a spray-on barrier if allowed, depending on the spray foam section of your local code. See each Spray foam product to check which paint-on or spray-on thermal barriers can be used. 
If the space is unoccupied, you don't need a thermal barrier.

Do I need a vapor barrier?

This depends on your local code requirements.

What R-value do I need?

This depends on your local code requirements. 

ICC code allows spray foam insulation to be installed with less than the prescriptive minimum R-value and still meet the intent of the code. 

Compliance based on simulated energy performance requires that a proposed residence (proposed design) be shown to have an annual energy cost that is less than or equal to the annual energy cost of the standard reference design that is based on the minimum prescriptive standard. When the air tightness of the building envelope is factored into the computer calculations, the building will require less R-value than the prescriptive level mandates. Typically the R-value can be reduced by 20-25%, depending on the code version that is being used.