Open janegilring opened 5 years ago
Hei hei @janegilring. Thanks for reporting this. I haven't used Windows since Windows 98, and the vast majority of usage would be from Linux (through automation) and Mac. I think @cdoan1 did some work with a Windows user, though. @cdoan1 did you find a workaround for this type of problem?
As a workaround, I deployed from Azure Cloud Shell - which is using a Linux OS.
The deployment went past the issues I mentioned initially, but failed on a later step - which is probably unrelated to this issue:
module.icpprovision.null_resource.icp-image (remote-exec): Loading image ibmcom/icp-inception-amd64:3.1.2-ee module.icpprovision.null_resource.icp-image (remote-exec): Error response from daemon: manifest for ibmcom/icp-inception-amd64:3.1.2-ee not found
Error: Error applying plan:
1 error occurred:
I created a new issue for this problem.
Back to this issue (running on Windows): On Windows 10 I also have other workarounds, such as using Windows Subsystem for Linux, or a Docker container running Linux.
However, it would also be convenient if it was working from native Windows since that is where we run other Terraform deployments from.
I am trying to deploy the icp-ee-az Terraform template from Windows, and all Azure resources is deployed successfully.
However, the icpprovisioning module fails. The error message is:
7 error(s) occurred:
Status 127 means "File or command not found".
When logging into the bastion host where the bash scripts is failing, I can find them here: /tmp/terraform*
root@bnd01:/tmp$ sudo /tmp/icp-common-scripts/prereqs.sh sudo: unable to execute /tmp/icp-common-scripts/prereqs.sh: No such file or directory
If I manually run one of the scripts, I get this:
root@bnd01:/tmp$ sudo ./terraform_1802524159.sh ssh-rsa AAAABsnlpNsx6ehPL...
./terraform_1802524159.sh: 6: ./terraform_1802524159.sh: /tmp/icp-common-scripts/prereqs.sh: not found ./terraform_1802524159.sh: 7: ./terraform_1802524159.sh: /tmp/icp-common-scripts/version-specific.sh: not found ./terraform_1802524159.sh: 8: ./terraform_1802524159.sh: /tmp/icp-common-scripts/docker-user.sh: not found
I then try to run one of the scripts it is complaining about: root@bnd01:/tmp$ sudo /tmp/icp-common-scripts/docker-user.sh sudo: unable to execute /tmp/icp-common-scripts/docker-user.sh: No such file or directory Hangup
However, the file is there: root@bnd01:/tmp$ ls /tmp/icp-common-scripts/docker-user.sh /tmp/icp-common-scripts/docker-user.sh root@bnd01:/tmp$
Hence, I am suspecting the Terraform configuration files is written from Linux, and I get this behaviour when running from Windows.
The EOL (End Of Line) character in DOS is '\r\n'
The EOL (End Of Line) character in UNIX is '\n'
I think the issue is that the ICP deploy scripts has the wrong EOL when deployed from Windows: https://github.com/ibm-cloud-architecture/terraform-module-icp-deploy/tree/master/scripts
I tried changing the EOL character using PowerShell: Get-ChildItem -File -Recurse | % { $x = get-content -raw -path $.fullname; $x -replace "
r
n","`n" | set-content -path $.fullname }Which seemed to resolve the issue, but I think the files are overwritten for each terraform apply.
Anyone tried deploying the ICP template from Terraform on Windows?
In my testing, I was using the following source: source = "github.com/ibm-cloud-architecture/terraform-module-icp-deploy?ref=3.1.1"