Terraform command not recognized in Gitlab Windows Runners - gitlab

I setup Gitlab runner on a local Windows machine. There are some jobs defined, but one of them is "terraform version", but the job failed in Gitlab CI, below is the error,
$ terraform version
terraform: The term 'terraform' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Note: Terraform works fine locally without Gitlab when executed from the working directory.
Can someone through some lights here, thanks.

As windows issue is not resolved or can't be resolved in my case, i have tried another option ie. by installing Windows Subsystem for Linux (WSL) on the same windows machine.
Thanks all.

Related

Terraform version is giving incorrect version in windows

I noticed when I run terraform version in command prompt is not giving the correct terraform version, I just downloaded and kept in c:/terraform folder.
If you notice terraform version command in command prompt is not giving the correct terraform version, you just downloaded and kept in c:/terraform path then check these two things.
Check whether you Updated system path variable with c:/terraform
Check where terraform was installed using (get-command terraform.exe).Path in PowerShell.
Check whether you already installed terraform using chocolatey.

VS Code cannot activate virtual environment with env\Scripts\activate.bat

I've been looking at all sorts of sources and I cannot make it happen that a virtual environment is created. I have serious problems with the Terminal. Whereas in the other sources by just typing the commands as instructed like \env\Scripts\activate.bat works perfectly, for me I just get an error saying it is not recognized as a name of a cmdlet nor a function nor a script file nor an executable program, see screenshot. It's a nightmare. I also e.g. changed the settings.json as in some suggested methods, but no luck.
enter image description here
In the virtual environment Scripts folder there are 2 activate scripts: activate.bat and activate.ps1.
.bat files aren't recognized in the terminal.
Try running just env\Scripts\activate.

Activating virtual environment environment

please for a while now i've been trying to activate virtual environment for my windows 7 machine; I've run commands like env\Scripts\activate where env is the installed virtual environment folder in the project, but each time i run the command, it gives me an error like: activate is not recognized as an internal or external command, operable program or batch file. Please what could be the problem, what should i do?
Do you have activate.bat inside Scripts folder? If yes, run that. If not, delete everything and run python -m venv env again and let me know what happens. Please note that you may change env to whatever you want.
Here it is (just google it, there are a lot of post explaining that):
https://programwithus.com/learn-to-code/Pip-and-virtualenv-on-Windows/

Getting error trying to make Terraform work with IBM Cloud

I am using the following instructions:
https://console.bluemix.net/docs/terraform/setup_cli.html#setup_cli
When I run terraform init
I get the following error:
Provider "ibm" not available for installation.
A provider named "ibm" could not be found in the official repository.
This may result from mistyping the provider name, or the given provider may
be a third-party provider that cannot be installed automatically.
In the latter case, the plugin must be installed manually by locating and
downloading a suitable distribution package and placing the plugin's executable
file in the following directory:
terraform.d/plugins/windows_amd64
Terraform detects necessary plugins by inspecting the configuration and state.
To view the provider versions requested by each module, run
"terraform providers".
I am on windows 10 pc, I tried placing following executable under:
$HOME/terraform.d/plugins/windows_amd64/terraform-provider-ibm_v0.14.1.exe
Can anyone point why this is not working?
I think there is a bug in instructions of IBM Cloud. But when I put the executable file under the following path it works:
$HOME\terraform.d\plugins\terraform-provider-ibm_v0.14.1.exe
Hope this answer will help save someone some time.
There are clear steps on how to configure the IBM Cloud Provider for Terraform in this solution tutorial on both Windows and non-windows operating systems.
On Windows, the file needs to be placed in terraform.d/plugins beneath your user's "Application Data" directory.
Run the below commands on a command prompt Provider Configuration
MD %USERPROFILE%\AppData\terraform.d\plugins
MOVE PATH_TO_UNZIPPED_PROVIDER_FILE\terraform-provider-ibm.exe %USERPROFILE%\AppData\terraform.d\plugins
Launch Windows Powershell (Start + R > Powershell) and run the below command to create terraform.rc file
echo > $env:APPDATA\terraform.rc
At the first prompt, enter the below content
# ~/.terraformrc
providers {
ibm = "PATH_TO_YOUR_APPDATA_PLUGINS/terraform-provider-ibm.exe"
}
The file terraform.rc should be saved with Encoding ANSI and you have to be sure of not having weird characters.

Running Azure node.js Tools on Ubuntu

I have followed these instructions.
And as far as I can tell I have successfully installed node.js azure tools. No error - nothing to suggest it failed.
However, I cannot, and the documentation says, simple run "azure"...
Maybe there is something I am missing with node.js?
There are a few problems you may be experiencing.
First of all, I would ensure you are running Node.js v0.6.20. You can do this by opening the command prompt and running:
node -v
You should have v0.6.20 echoed back.
If this doesn't work, you may be missing a path variable to Node.js or the NPM cache. Verify the Environment variables exist by running [in the command prompt]:
path
you should see two paths:
%appdata%\npm
[x64 Machine]
%programfiles(x86)%\nodejs\
[x86 Machine]
%programfiles%\nodejs\
If this doesn't work, I would check to ensure that the azure module was loaded into the %appdata%\npm\node_modules directory.
It could be the PATH issue. In my case, the azure program is located at ~/.npm-global/bin.
run "export PATH=$PATH:~/.npm-global/bin". Or just add to bash source file

Resources