F5Networks / terraform-gcp-bigip-module

Terraform module for Deploying BIG-IP in GCP
Apache License 2.0
9 stars 13 forks source link

BIG-IP fails to onboard when Terraform is used on Windows #7

Closed memes closed 2 years ago

memes commented 2 years ago

I've been troubleshooting a customer deployment, and the root-cause appears to be the way the startup-script is rendered on Windows systems. The startup-script fails to execute in the VM launched by Windows, with serial output ending at mcpd has reached 'running' state (see win-1nic-9dd5-f5vm01.serial.log) but the exact same example Terraform files when executed on macOS succeeds (see mac-1nic-826e-f5vm01.serial.log).

Examining the generated startup-scripts, it looks like the Windows module renders the shell script with \n\r line endings, instead of \n, breaking the onboarding process.

Reproducing using 1nic example

  1. Create a new 1NIC from published example, patch to use module from registry (see bugreport.patch.txt) on macOS and Windows

    terraform init -from-module github.com/F5Networks/terraform-gcp-bigip-module/examples/bigip_gcp_1nic_deploy
    patch -p2 < bugreport.patch
    terraform init -upgrade
  2. Create a terraform.tfvars file

  3. Apply

    terraform apply -auto-approve
  4. Compare serial port output of VM launched from macOS with serial port output of VM launched from Windows

    for vm in VM_FROM_MAC VM_FROM_WIN; do gcloud compute instances get-serial-port-output ${vm} --project f5-gcs-4138-sales-cloud-sales --zone us-west1-a > ../../${vm}.serial.log; done
memes commented 2 years ago

Additional information:

macOS versions

terraform version; uname -a

Terraform v1.0.11
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v3.90.1
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/template v2.2.0

Darwin REDACTED 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64

Windows versions

terraform version

Terraform v1.0.11
on windows_amd64
+ provider registry.terraform.io/hashicorp/google v3.90.1
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/template v2.2.0

ver

Microsoft Windows [Version 10.0.19043.1320]
memes commented 2 years ago

PR #10 is a proposed solution to the issue that removes all \r characters from the rendered onboarding script.