pearcec/Invoke-Terraform

Linux Support

charltonstanley opened this issue · 3 comments

This looks like a really neat module and I was excited to try it out, but I ran into a few issues on Linux; I'm guessing this wasn't written with Linux support in mind.

Is your feature request related to a problem? Please describe.
Installing on Linux via Install-Module -Name Invoke-Terraform -Repository PSGallery -Scope CurrentUser works, but commands within the module (i.e. Get-ConfigurationPath) return the system configuration path instead of the config path within the user's home directory. The system configuration path requires root privileges to write to. I've attempted to go down the rabbit hole with this a little bit and get it working properly on Linux, but without intimately knowing exactly how this module is supposed to work, progress is slow and difficult.

Describe the solution you'd like
Proper support for Linux

Describe alternatives you've considered

Additional context

Below is what happens when attempting to set the terraform version on Linux.

$ set-TerraformVersion -TFVersion 1.4.6
WARNING: The Enterprise path /etc/xdg/xdg-cinnamon/powershell cannot be found
New-Item: Access to the path '/etc/xdg/xdg-cinnamon' is denied.
New-Item: Access to the path '/etc/xdg/xdg-cinnamon' is denied.

Confirm
Are you sure you want to perform this action?
Performing the operation "Setting TFVesion configuration version to 1.4.6" on target "/etc/xdg/xdg-cinnamon/powershell/Christian 
Pearce/Invoke-Terraform".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
WARNING: The Enterprise path /etc/xdg/xdg-cinnamon/powershell cannot be found
New-Item: Access to the path '/etc/xdg/xdg-cinnamon' is denied.
New-Item: Access to the path '/etc/xdg/xdg-cinnamon' is denied.
WARNING: The Enterprise path /etc/xdg/xdg-cinnamon/powershell cannot be found
New-Item: Access to the path '/etc/xdg/xdg-cinnamon' is denied.
New-Item: Access to the path '/etc/xdg/xdg-cinnamon' is denied.
Set-Content: Could not find a part of the path '/etc/xdg/xdg-cinnamon/powershell/Christian Pearce/Invoke-Terraform/Configuration.psd1'.

HI I have tests that install on MacOS, Windows and Linux. I have personally used this in pipelines that run on Linux. I just installed it on Linux via Azure Cloud Shell.

  • What distribution are you running?
  • What is in your $PSGetPath ?

Similar issue? Jaykul/PowerLine#39

Sorry for the delayed reply, and thank you for taking the time to respond.

I have personally used this in pipelines that run on Linux. I just installed it on Linux via Azure Cloud Shell.

I'm glad that my (apparently poor) guess of this not having Linux support was wrong! 😄

What distribution are you running?

Short answer: Linux Mint.
Long Answer:

/home/user> cat /etc/os-release                                   
NAME="Linux Mint"
VERSION="21.1 (Vera)"
ID=linuxmint
ID_LIKE="ubuntu debian"
PRETTY_NAME="Linux Mint 21.1"
VERSION_ID="21.1"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.linuxmint.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=vera
UBUNTU_CODENAME=jammy

What is in your $PSGetPath ?

/home/user> $PSGetPath

AllUsersModules    : /usr/local/share/powershell/Modules
AllUsersScripts    : /usr/local/share/powershell/Scripts
CurrentUserModules : /home/user/.local/share/powershell/Modules
CurrentUserScripts : /home/user/.local/share/powershell/Scripts

Similar issue? Jaykul/PowerLine#39

Hmm that is interesting; I think so! On my system, it appears that $Env:XDG_CONFIG_HOME is equal to $null. I'm not sure if this is specific to my distro of choice. (Curious: was it populated in AZ Cloud Shell?) The spec referenced in the issue you linked seems to indicate that it shouldn't matter if it is $null, since whatever relies on it should fall back to $HOME/.config/. However, I don't see XDG_CONFIG_HOME anywhere in your module so I don't think this is the problem, unless I'm mistaken.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.