Terraform output decrypt using keybase

Terraform version installed: terraform v0.15

Trying to decrypt outputs using keybase but getting error

terraform output admin1-user-password | base64 --decode --ignore-garbage | keybase pgp decrypt      
base64 : The term 'base64' 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.
At line:1 char:41
+ terraform output admin1-user-password | base64 --decode --ignore-garb ...
+                                         ~~~~~~
    + CategoryInfo          : ObjectNotFound: (base64:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Hi @tushar-bhavsar,

From this error it seems like you don’t have the base64 program installed on your system, and so PowerShell (I think?) returned an error after trying to run it as a cmdlet, a program, vand various other PowerShell-specific things.

One way to proceed here would be to install the base64 program so that PowerShell can run it. Unix systems often have base64 available as part of GNU CoreUtils, but if you are on Windows then you may need to install GNU CoreUtils or some similar set of utilities yourself.

Alternatively, you may be able to perform base64 encoding using PowerShell-specific features. I don’t know much about PowerShell, but Microsoft.PowerShell.TextUtility seems to have a ConvertFrom-Base64 cmdlet in it which might help.

One Terraform-specific feedback I have is that you can use the -raw option for terraform output to get just the raw string value of that output value, rather than the human-oriented presentation it produces by default:

terraform output -raw admin1-user-password

That’ll hopefully make it easier to decode base64 as a separate step, without needing to resort to --ignore-garbage or other similar functionality of a different base64-decoding mechanism.


Yes you are right the base64 utility was not present on my Windows. However i have installed both gnu and base64 utility. After that now i am getting the following error.

terraform output -raw admin1-user-password | base64 -d | keybase pgp decrypt

  • ERROR (code 1505)

Hi @tushar-bhavsar,

Unfortunately that seems to be a Keybase error code rather than a Terraform error code, so I can’t directly help with that part. It seems like someone else had a similar problem on Windows but I’m not sure if the discussion there actually found a cause:

It seems like 1505 is Keybase’s error code for StatusCode_SCStreamUnknown, but I don’t know enough about keybase to know what that actually represents. Perhaps you can ask Keybase for some more help on this.

I managed to decrypt using admin command “cmd” instead of PowerShell. Same command but executed from cmd worked for me. Thanks for your advise and support.

installed base64 utility using “chocolatey”

command I used

terraform output admin-user-password | base64 -d | keybase pgp decrypt.

1 Like