title: Using Ansible playbook to create instances in google cloud (gcp)
body: <p>I'm using the following code </p>
  
  <pre><code>- name: create a instance
    gcp_compute_instance:
      name: test_object
      machine_type: n1-standard-1
      disks:
      - auto_delete: 'false'
        boot: 'true'
        source: "{{ disk }}"
      metadata:
        startup-script-url:
        cost-center:
      labels:
        environment: production                                                               
      network_interfaces:                                                                     
      - network: "{{ network }}"                                                              
        access_configs:                                                                       
        - name: External NAT                                                                  
          nat_ip: "{{ address }}"                                                             
          type: ONE_TO_ONE_NAT                                                                
      zone: us-central1-a                                                                     
      project: test-12y38912634812648                                                         
      auth_kind: serviceaccount                                                               
      service_account_file: "~/programming/gcloud/test-1283891264812-8h3981f3.json"      
      state: present                                                                          
  </code></pre>
  
  <p>and I saved the file as create2.yml</p>
  
  <p>Then I run Ansible-playbook create2.yml and I get the following error</p>
  
  <pre><code>ERROR! 'gcp_compute_instance' is not a valid attribute for a Play
  
  The error appears to be in '/Users/xxx/programming/gcloud-test/create2.yml': line 1, column 3, but may
  be elsewhere in the file depending on the exact syntax problem.
  
  The offending line appears to be:
  
  
  - name: create a instance
    ^ here
  
  </code></pre>
  
  <p>I followed the documentation. What am I doing wrong and how do I fix it?</p>