If you get the Term store exception below while creating terms programmatically make sure the user logged into the site has the term store administrator rights for the service application instance you are making changes to.
at Microsoft.SharePoint.Taxonomy.Internal.Security.CheckPermissions(TaxonomyRights permissions, SPAcl`1 acl, TermStore termStore, Group group, Boolean isSiteCollectionGroupCreate, SPSite siteCollectionForGroup)
at Microsoft.SharePoint.Taxonomy.Group.CreateTermSet(String name, Guid newTermSetId, Int32 lcid)
at Microsoft.SharePoint.Taxonomy.Group.CreateTermSet(String name)

