-
Notifications
You must be signed in to change notification settings - Fork 103
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
Unable to Import "ED25519" key into resource "aws_key_pair" #197
Comments
Hi @jseiser - sorry about this issue. I think there is a disagreement between libraries used by this provider and the AWS one, in regards to the presence of newlines. First, the workaround is simple (example): resource "aws_key_pair" "key" {
key_name = "key"
public_key = trimspace(tls_private_key.bastion.public_key_openssh)
} This issue is unfortunately a duplicate of #163 (comment). We tend to rely on Can you give using Meanwhile I'll consider our options here. It might just be a matter of updating the provider doc to suggest using |
Small correction: it seems like it's the AWS APIs themselves that throw an error - AWS provider just returns it. I noticed it by looking at the debug output reported in this ticket. |
@detro any reason this works on RSA keys though? |
@jseiser that's why I looked at the output: if it was a behaviour internal to the AWS provider, I could see us collaborating with the But being it an API-returned error, that's a much harder thing to deal with: likely they have a slightly different logic on their end to deal with RSA vs ED25519. I think the only safe way to deal with this and try to help future practitioners facing this issue, is to add some documentation in this provider, to explain that the field is produced with an appended |
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. |
Terraform CLI and Provider Versions
Terraform Version: 1.1.8
Initializing provider plugins...
Terraform Configuration
Expected Behavior
The new ED25519 key should have been imported into AWS.
Actual Behavior
Error: error importing EC2 Key Pair (JLS-DEV): InvalidKey.Format: Key is not in valid OpenSSH public key format
status code: 400, request id: e9d5cfb0-d0c5-4ab1-90c6-4476526cb2ca
with aws_key_pair.generated_key,
on ssh.tf line 5, in resource "aws_key_pair" "generated_key":
5: resource "aws_key_pair" "generated_key" {
Steps to Reproduce
terraform apply
How much impact is this issue causing?
Medium
Logs
No response
Additional Information
The above code, is what we use currently, to generate keys for the dev environments. but instead of ED225519, we use RSA.
The docs show
public_key_openssh
should still be valid, and the AWS docs show this type of key is supported and that my provider version is new enough to support it.tls_private_key
resource: adding support for ED25519 key algorithm #151Code of Conduct
The text was updated successfully, but these errors were encountered: