New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem to provision ssh keys on resource azurerm_linux_virtual_machine #6044
Comments
I can confirm this is not working in v2.1.0. To further add, here's my public key:
And its a 2048-key as you can see from ssh-keygen:
Looking at the code, there are two paths that return the same error message, which makes troubleshooting quite impossible:
Can those be changed to show the exact problem with the key? like, I was expecting X but got Y. After further debugging, the problem lies in this branch ( I believe that branch needs to be changed to something alike: rsaPubKey, ok := pubKey.(ssh.CryptoPublicKey).CryptoPublicKey().(*rsa.PublicKey)
if !ok {
log.Fatalf("ops")
}
rsaPubKeyBits := rsaPubKey.Size() * 8
log.Fatalf("RSA pub key bits is %d", rsaPubKeyBits) which outputs what do you think? can I submit PR with this change? |
I am getting the same issue while creating a scale set using azurerm_linux_virtual_machine_scale_set terraform version is 0.12.24 |
Any updates on this ? |
Can confirm the same issue, at this point creating Azure Virtual Machines with preset ssh keys appear to be blocked unless there's a known workaround? terraform version is 0.12.24 |
@tombuildsstuff can you look into this? Should I submit a pr for this? |
I'm getting a similar error.. Creating vms using the old azurerm_virtual_machine worked fine so I know my ssh key is 2048 bit. terraform version is 0.12.17 |
I have the same. Isn't solved with the current version of Terraform/Azure |
I used the Putty key generator, but the error is not displaying when I use ssh-keygen on Linux. That will be a work around for y'all. |
using ssh-keygen on windows also worked for me, whereas PuttyGen didn't (same PC) |
@rgl - happy to accept a pr making the error messages more clear! |
This has been released in version 2.12.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.12.0"
}
# ... other configuration ... |
…of the rsa ssh `public_key` property (hashicorp#7061) Fixes hashicorp#6044
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
This issue was originally opened by @gcontrer87 as hashicorp/terraform#24323. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
Terraform Configuration Files
Debug Output
Crash Output
Expected Behavior
Public key should be aprovisioned correctly, since it follows the convention requested on the documentation:
"public_key - (Required) The Public Key which should be used for authentication, which needs to be at least 2048-bit and in ssh-rsa format. Changing this forces a new resource to be created."
Actual Behavior
When terraform plan is run, the following error appears:
terraform plan
2020/03/08 15:19:27 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.
Use TF_LOG=TRACE to see Terraform's internal logs.
2020/03/08 15:19:28 [ERROR] : eval: *terraform.EvalSequence, err: Error decoding "admin_ssh_key.0.public_key" for public key data
Error: Error decoding "admin_ssh_key.0.public_key" for public key data
on vm.tf line 86, in resource "azurerm_linux_virtual_machine" "vm1":
86: resource "azurerm_linux_virtual_machine" "vm1" {
Steps to Reproduce
Additional Context
It didn't work either with format ---- BEGIN SSH2 PUBLIC KEY ---- (old resource type azurerm_virtual_machine used to work with this format)
References
The text was updated successfully, but these errors were encountered: