No
Sure, defense ranks high in the list of reasons for a nation's foreign policy to be the way that it is, but there are other factors, such as:
Economy: Trading alliances, Fundings for projects, economy, etc.
=> Trade: Trading for products that one's country does not produce (or in small quantities, depending on supply and demand).
This is just one of the many (excluding defense) that affect a nation's foreign policy.
~