I think you might be missing to allow the firewall traffic on port: tcp/5986 from anywhere. By default it allows SSH and RDP but not WinRM. Except for that everything looks fine with me. The user should be created and the password is retrieved over the API in the same way as the gcloud tool do.
https://console.cloud.google.com/networking/firewalls/list On 22 February 2017 at 15:19, Russell Seymour < [email protected]> wrote: > Hello, > > I am trying to get Packer to build a custom Windows image on GCE. > > This is the build section for `googlecompute` in my Packer file: > > { > "type": "googlecompute", > "account_file": "{{user `gce_account_file`}}", > "project_id": "{{user `gce_project_id`}}", > "source_image": "{{user `gce_source_image`}}", > "zone": "{{user `gce_zone`}}", > "disk_type": "pd-ssd", > "disk_size": "80", > "machine_type": "n1-highcpu-8", > "image_name": "workstation-{{user `workstation-number`}}-{{ > timestamp}}", > "communicator": "winrm", > "winrm_username": "packer", > "winrm_use_ssl": "true", > "winrm_insecure": "true", > "winrm_port": 5986, > "winrm_timeout": "5m" > } > > > The source image is set as `windows-server-2012-r2-dc-v20170117`. > > When I attempt to build this machine I get a timeout error for WinRM: > > ==> googlecompute: Checking image does not exist... > ==> googlecompute: Creating temporary SSH key for instance... > ==> googlecompute: Using image: windows-server-2012-r2-dc-v20170117 > ==> googlecompute: Creating instance... > googlecompute: Loading zone: europe-west1-b > googlecompute: Loading machine type: n1-highcpu-8 > googlecompute: Loading network: default > googlecompute: Requesting instance creation... > googlecompute: Waiting for creation operation to complete... > googlecompute: Instance has been created! > ==> googlecompute: Creating windows user for instance... > googlecompute: Waiting for windows password to complete... > googlecompute: Created password. > ==> googlecompute: Waiting for the instance to become running... > googlecompute: IP: 146.148.18.82 > ==> googlecompute: Waiting for WinRM to become available... > ==> googlecompute: Timeout waiting for WinRM. > ==> googlecompute: Deleting instance... > googlecompute: Instance has been deleted! > ==> googlecompute: Deleting disk... > googlecompute: Disk has been deleted! > Build 'googlecompute' errored: Timeout waiting for WinRM. > > > Reading around this I have seen that the Windows user only seems to get > created from the Console or the command line using `gcloud`. If this is > the case is it possible to get Packer to create and configure a Windows > machine in GCE? If it is possible to get Packer to build a Windows machine > in GCE what am I missing? > > Thanks, Russell > > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/mitchellh/packer/issues > IRC: #packer-tool on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Packer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/packer-tool/5a36c410-99e8-4def-acae-8c606bed0003%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/5a36c410-99e8-4def-acae-8c606bed0003%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CALz9Rt8VNjHUFx3fwSJUQkEQcDQAWFVpzm8F%3DJyayTJb6V32tg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
