function main(projectId) {
  // [START compute_template_list]
  /**
   * TODO(developer): Uncomment and replace these variables before running the sample.
   */
  // const projectId = 'YOUR_PROJECT_ID';

  const compute = require('@google-cloud/compute');

  // Print a list of instance template objects available in a project.
  async function listInstanceTemplates() {
    const instanceTemplatesClient = new compute.InstanceTemplatesClient();

    const instanceTemplates = instanceTemplatesClient.listAsync({
      project: projectId,
    });

    for await (const instanceTemplate of instanceTemplates) {
      console.log(` - ${instanceTemplate.name}`);
    }
  }

  listInstanceTemplates();
  // [END compute_template_list]
}
Prints a list of instance template objects available in a project.

@param {string} projectId - Project ID or project number of the Cloud project you use.