Skip to content

imported SSH keys contain newlines "\r\n" #646

@needleshaped

Description

@needleshaped

Problem:

terraform plan
Error: parsing "admin_ssh_key.0.public_key" as a public key object
or
Error: decoding "public_key" for public key data

main.aztfexport.tf contains \r\n multiple times inside public key

resource "azurerm_ssh_public_key" "res-4" {
  location            = "eastus"
  name                = "vm_key"
  public_key          = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDg6i01BFp7R6i1xImXnOsR3OzT\r\nfBsk.....ZV\r\nSO.....5oLpk= generated-by-azure\r\n

Workaround:

sed -i 's|\\r\\n||g' main.aztfexport.tf

Info:

  • Windows, Bash
  • aztfexport version v0.18.0(c787766)

After fix, terraform plan shows newline-ed SSH key block, that it will replace with a singleline string.
So this may very well be the way Azure saved key itself - the edge case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions