Tools to easily swap terraform versions - linux

I found the tools tfenv and tfswitch to easily and quickly change the terraform and terragrunt version - and I guess the tools work cause people use it, but for some reason they don't chagne the versions on my computer, after I run let's say
$ tfswitch 0.12.25
Downloading https://releases.hashicorp.com/terraform/0.12.25/terraform_0.12.25_darwin_amd64.zip to terraform_0.12.25_darwin_amd64.zip
Downloading ...
18220765 bytes downloaded.
Switched terraform to version "0.12.25"
It seems I correctly switch to version 0.12.25, but after checking it with terraform it didin't change
$ terraform --version
Terraform v0.12.18
+ provider.google v3.29.0
+ provider.random v2.3.0
Your version of Terraform is out of date! The latest version
is 0.12.28. You can update by downloading from https://www.terraform.io/downloads.html
same goes for tfenv tool, anyone met with that problem ? I tried running it with sudo as well, but without success - I see the binaries are being downloaded to config dir of those tools and I even add them to PATH, but they don't overwrite the main terraform or terragrunt binaries that's why I'm left with the old versions, any thoughts ?

I had the same problem in the past, I solved it by removing the reference of Terraform from .bash_profile or .zshrc for zsh.

I'm having the exact same problem whilst using tfswitch
tfswitch 0.13.0
Installing terraform at /home/bin
Switched terraform to version "0.13.0"
terraform -v
Terraform v0.12.26
Terraform doesn't actually switch the versions and remains at v0.12.26
The answer provided on this post for removing the tf references located in .bash_profile doesn't appear to be working for me as the only reference to $PATH is the binaries for tfswitch for /home/bin which is required for it to work.

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.

Python3 installed using homebrew but not updated version being used

On my Mac terminal i've installed python3 (3.7.6) using homebrew - e.g. if I issue command to upgrade via homebrew, it returns the up to date version:
$brew upgrade python3
Warning: python3 3.7.6_1 already installed
However when I ask for the version it tells me an older version (3.4.0) is installed:
$python3 --version
Python 3.4.0
So it's installed but not updated. I'd quite like 3.6 or later on my mac. I've tried uninstalling and reinstalling using homebrew, and had no luck. Wondering if anyone has any ideas?
//
Sidenote (1) - i'm relatively new to homebrew... $ brew doctor returns config scripts "outside your system or Homebrew directories" - not sure if this helps, and if this is the issue where to move them to.
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4-config
Sidenote (2) - 3.7.6 isn't the newest version out, but this is the latest version that homebrew will install. Is there any way to get an even newer version?
By chance i've come across the/a answer. I was editing .bash_profile and saw the very top says:
# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
So I moved to this directory .../Versions/, found it had three subdirectories 3.3, 3.4, and 3.8, and updated to use:
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
And this seems to do the trick (to use the most recent). Although interestingly i've not came across 3.7.6... but is a bit redundant in my case since I can use the newer 3.8 version.
Quick fix:
You should be able to run the required version by running python3.7 instead of python3. You can set up an alias if you like with
"alias python=/usr/local/bin/python3.7"
where you put the desired binary on the RHS. This will create an alias for your current session. To always evoke this functionality, you can add this line to your bashrc file so this alias will work every time you log in to a new session
echo "alias python=/usr/local/bin/python3.7" >> ~/.bashrc
These commands were lifted from
https://opensource.com/article/19/5/python-3-default-mac
which explains some do and do-nots.
Alternative:
Also check out Python virtual environments, particularly virtualenv and virtualenvwrapper, which are great tools for separating out your Python working environments and allow you to set default Python version for each project separately, as well as managing any modules you pip install separately for each project. This is much cleaner in my opinion.
https://www.bogotobogo.com/python/python_virtualenv_virtualenvwrapper.php

How to install KUDO Kubectl Plugin in linux without using brew?

I am new in creating Kubernetes operators and found we can easily make one using the KUDO (Kubernetes Universal Declarative Operator) plugin. From the documentation, KUDO was installed using brew https://kudo.dev/docs/cli.html#setup-the-kudo-kubectl-plugin. Can anyone suggest a method to setup KUDO in linux without using linuxbrew-wrapper ?
Found a workaround to fix the kudo plugin in linux reducing the overhead of installing brew.
apt install linuxbrew-wrapper
brew install kudo-cli
First you figure out the corresponding package from the release page, which is compatible to your machine. Download and extract the file (my case : kudo_0.10.1_linux_x86_64.tar.gz) and there you can find the executable for kubectl-kudo.
Export the path :
export PATH=$PATH:/path/to/downloaded/executable/
You are almost done and can find the commands working. Try kubectl kudo version.
To make it permanent add this export line into your .bashrc and reload.

Compiling pdftohtml binary for AWS-Lambda: GLIBC issues

I'm trying to get a Lambda happy version of XPDF's pdftohtml to work but am having no luck.
So far the following has been tried:
Created Docker container running the latest amazonlinux image
I've copied the source code into this container and ran:
yum install cmake, gcc, gcc-c++, freetype-devel
Compiling the code with cmake produces a binary which executes perfectly in the container which should be the same OS and environment as Lambda.
I've verified the version of libc.so.6 as 2.26 within the container.
I've copied this into my AWS zip folder and included the following dependencies in a lib folder ready to upload:
libfreetype.so.6.10.0, libpng15.so.15, libstdc++.so.6.0.24
These dependencies are copied directly from the container used to compile the code.
Python function then connects these via
os.environ.update(dict(LD_LIBRARY_PATH='/var/task/lib'))
At the end of this, I run the function and get the following error code:
/var/task/pdftohtml: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /var/task/lib/libstdc++.so.6)
I've no idea where the GLIBC_2.18 comes from as this version isn't present in the container used to compile it.
Really stumped but keen to get it finished as it would produce a lightweight binary perfect for a Lambda function!
Where am I going wrong?
EDIT
SOLVED - see the comments below. There are two versions of AWS Linux and Lambda runs this version
I ran in an EC2 instance as one of the commenters suggested. Whilst the libstdc++.so.6.24 looked to be the right version, as it was itself compiled with a different GLIBC version, it throws an error. Compiling in EC2 from the source code worked fine. The other trick was making sure the CXX_FLAGS included -std=c++11. Thanks to those who contributed to help me solve this!
I've no idea where the GLIBC_2.18 comes from as this version isn't present in the container used to compile it.
I think you don't understand symbol version dependencies (see here).
The error message is telling you that your libstdc++.so.6 was built against GLIBC-2.18 or newer, and you are running against GLIBC-2.17 or older.
Where am I going wrong?
Your build environment is targeting something much newer than what your deployment environment contains.
You need to either find a built environment that matches your deployment target, or you need to change your deployment target to be not older than your build environment.

Cannot find package Libvala

I'm trying to configure the latest version of monodevelop but I'm stuck. I have the latest version of libvala and versions before that. Could someone please explain this to me.
checking for LIBVALA... no
configure: error: Package requirements (libvala-0.12 >= 0.12) were not met:
No package 'libvala-0.12' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBVALA_CFLAGS
and LIBVALA_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
How can I set LIBVALA_LIB? Is LIBVALA a env variable? In the configure.in for the Valabindings it looks like this:
PKG_CHECK_MODULES(LIBVALA, libvala-0.12 >= $LIBVALA_REQUIRED_VERSION)
AC_SUBST(LIBVALA_LIBS)
What is that? How can I solve this?
Under /usr/lib/pkgconfig I have Libvala-0.12.pc if that can help. And if I run dpkg -i libvala-0.12-0 I get that it's installed and works fine.
Do you have libvala-0.12-dev installed? What version of Ubuntu do you have?
The version of libvala required is >= libvala-0.12-dev. Both 0.14 and 0.16 packages are available for Debian Wheezy:
libvala-0.14-dev
libvala-0.16-dev
After installing the package you wish, edit: /extras/Valabinding/configure.in. There is one instance of libvala-0.12. Replace it with the version you want to use (e.g. libvala-0.14).
After making this change, ./configure worked fine.

Resources