title: issue while creating VM instance using python code in GCP
body: <p>I am trying to write a code which will read values from excel file and will create VMs in Google Cloud. I am facing problem at two locations, while creating tags if I use 'items': [tag] or while creating service account scope it starts giving me error.</p>
  <pre><code>import os, json
  import googleapiclient.discovery
  from google.oauth2 import service_account
  import csv
  
  credentials = service_account.Credentials.from_service_account_file('G:/python/json/mykids-280210.json')
  compute = googleapiclient.discovery.build('compute', 'v1', credentials=credentials)
  
  def create_instance(compute, vm_name, image_project, image_family, machinetype, startupscript, zone, network,
                            subnet, project, scope, tag):
      # Get the latest Debian Jessie image.
      image_response = compute.images().getFromFamily(
          project=image_project, family=image_family).execute()
      source_disk_image = image_response['selfLink']
  
      # Configure the machine
      machine_type = &quot;zones/&quot; + zone + &quot;/machineTypes/&quot; + machinetype
      startup_script = startupscript
  
      config = {
          'name': vm_name,
          'machineType': machine_type,
  
          'description': 'This VM was created with python code',
  
          'tags': {
              'items': ['external', 'home', 'local']              #'items': [tag] &lt;~~~~~~~~~~~
          },
  
          'deletionProtection': False,
  
          'labels': {'env': 'dev', 'server': 'mytower', 'purpose': 'personal'},
  
          # Specify the boot disk and the image to use as a source.
          'disks': [
              {
                  'boot': True,
                  'autoDelete': True,
                  'initializeParams': {
                      'sourceImage': source_disk_image,
                  }
              }
          ],
  
          # Specify a network interface with NAT to access the public
          # internet.
          'networkInterfaces': [{
              'network': 'global/networks/' + network,
              'subnetwork': 'regions/us-central1/subnetworks/' + subnet,
              'accessConfigs': [
                  {'type': 'ONE_TO_ONE_NAT', 'name': 'External NAT'}
              ]
          }],
  
          # Allow the instance to access cloud storage and logging.
          'serviceAccounts': [{
              'email': 'default',
              'scopes': [
                  #'https://www.googleapis.com/auth/devstorage.read_write', 'https://www.googleapis.com/auth/logging.write'
                  #scope                          # scope      &lt;~~~~~~~~~~~~~~~~~~~~
              ]
          }],
          'scheduling': {
              &quot;preemptible&quot;: True
          },
  
          # Metadata is readable from the instance and allows you to
          # pass configuration from deployment scripts to instances.
           'metadata': {
              'items': [{
          # Startup script is automatically executed by the
          # instance upon startup.
                  'key': 'startup-script',
                  'value': startup_script
              }]
           }
      }
  
      return compute.instances().insert(
          project=project,
          zone=zone,
          body=config).execute()
  # [END create_instance]
  
  with open('vms.csv', newline='') as csvfile:
      data = csv.DictReader(csvfile)
      for row in data:
          vm_name = row['vm_name']
          image_project = row['image_project']
          image_family = row['image_family']
          machinetype = row['machinetype']
          startupscript = row['startupscript']
          zone = row['zone']
          network = row['network']
          subnet = row['subnet']
          project = row['project']
          scope = row['scopes']
          tag = row['tags']
  
          print(create_instance(compute, vm_name, image_project, image_family, machinetype, startupscript, zone, network,
                            subnet, project, scope, tag))
      csvfile.close()
  </code></pre>
  <p>error when use scope variable</p>
  <pre><code>G:\python\pythonProject\venv\Scripts\python.exe G:/python/pythonProject/read-excel-gcp/vm/create_vm.py
  Traceback (most recent call last):
    File &quot;G:\python\pythonProject\read-excel-gcp\vm\create_vm.py&quot;, line 100, in &lt;module&gt;
      print(create_instance(compute, vm_name, image_project, image_family, machinetype, startupscript, zone, network,
    File &quot;G:\python\pythonProject\read-excel-gcp\vm\create_vm.py&quot;, line 79, in create_instance
      return compute.instances().insert(
    File &quot;G:\python\pythonProject\venv\lib\site-packages\googleapiclient\_helpers.py&quot;, line 134, in positional_wrapper
      return wrapped(*args, **kwargs)
    File &quot;G:\python\pythonProject\venv\lib\site-packages\googleapiclient\http.py&quot;, line 915, in execute
      raise HttpError(resp, content, uri=self.uri)
  googleapiclient.errors.HttpError: &lt;HttpError 400 when requesting https://compute.googleapis.com/compute/v1/projects/mykids-280210/zones/us-central1-a/instances?alt=json returned &quot;One or more of the service account scopes are invalid: 'https://www.googleapis.com/auth/devstorage.read_write',  'https://www.googleapis.com/auth/logging.write''&quot;. Details: &quot;One or more of the service account scopes are invalid: 'https://www.googleapis.com/auth/devstorage.read_write',  'https://www.googleapis.com/auth/logging.write''&quot;&gt;
  
  Process finished with exit code 1
  </code></pre>
  <p>I get a similar error when I use tag variable.</p>
  <p>I have # the value the way I am passing in the above code.</p>
  <p>Below is my csv file details</p>
  <pre><code>vm_name,image_project,image_family,machinetype,startupscript,zone,network,subnet,project,scopes,tags
  python-vm1,debian-cloud,debian-9,e2-micro,G:/python/json/startup-script.sh,us-central1-a,myvpc,subnet-a,mykids-280210,&quot;https://www.googleapis.com/auth/devstorage.read_write',  'https://www.googleapis.com/auth/logging.write'&quot;,&quot;external', 'home', 'local'&quot;
  python-vm2,debian-cloud,debian-9,e2-micro,G:/python/json/startup-script.sh,us-central1-a,myvpc,subnet-a,mykids-280210,&quot;https://www.googleapis.com/auth/devstorage.read_write',  'https://www.googleapis.com/auth/logging.write'&quot;,&quot;external', 'home', 'local'&quot;
  </code></pre>
  <p>I am not sure that when the value are passed directly it works, but when passing the value through variable, it fails.</p>
  <p>I have marked the problem area with &lt;~~~~~~~~~~~~</p>
  <p>Please suggest if anyone understands the issue.</p>