how to add taxonomy vocabulary and terms through code I have added some taxanomy vocabulary with terms in my local development server which I need in some modules. I want to get these vocabularies with terms auto inserted when ever I install these modules where I have used them. Is there a way I write some code in drupal module which inserts the taxonomy vocabularies and terms when ever I install the module.

Thanks for your suggestions.
Rather than writing code, I use the Taxonomy CSV module.  It allows you to export and import taxonomy as CSV files.  You can use the module's user interface or do it by command line with Drush to speed things up even more.

Initial configuration can be a little tricky, but it's able to preserve tree hierarchies and order, etc. so a bit of complexity is to be expected.