Skip to content

🐝 Trim wrapping whitespace on ssh key #76

@oscarhermoso

Description

@oscarhermoso

Steps to reproduce

  1. ssh-keygen -t ed25519 -C [email protected]
  2. Define terraform:
resource "binarylane_ssh_key" "test" {
  name = "test-ssh-key"

  public_key = file("~/.id_ed25519.pub")
}

resource "binarylane_server" "test" {
  region            = "per"
  image             = "ubuntu-24.04"
  size              = "std-min"
  public_ipv4_count = 1
  ssh_keys          = [binarylane_ssh_key.test.id]
}
  1. terraform apply
  2. terraform apply again

Expected Result

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are
needed.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Actual Result

  # binarylane_server.test will be updated in-place
  ~ resource "binarylane_server" "test" {
      ~ advanced_features         = {
          ~ cloud_init       = true -> (known after apply)
          ~ driver_disk      = false -> (known after apply)
          ~ emulated_devices = false -> (known after apply)
          ~ emulated_hyperv  = false -> (known after apply)
          ~ emulated_tpm     = false -> (known after apply)
          ~ local_rtc        = false -> (known after apply)
          ~ nested_virt      = false -> (known after apply)
          ~ qemu_guest_agent = false -> (known after apply)
          ~ uefi_boot        = false -> (known after apply)
          ~ unset_uuid       = false -> (known after apply)
        } -> (known after apply)
        id                        = 461033
      ~ ssh_keys                  = [
          ~ 5979 -> (known after apply),
        ]
        # (12 unchanged attributes hidden)
    }

  # binarylane_ssh_key.test must be replaced
-/+ resource "binarylane_ssh_key" "test" {
      ~ fingerprint = "3a:8d:be:ca:8a:47:8e:8a:ec:43:b1:04:03:1a:24:58" -> (known after apply)
      ~ id          = 5979 -> (known after apply)
        name        = "test"
      ~ public_key  = <<-EOT # forces replacement
            ssh-ed25519 AAAACSoMePublicKeyiHereOd7GBEt email@example.com
        EOT
        # (1 unchanged attribute hidden)
    }

Plan: 1 to add, 1 to change, 1 to destroy.
╷
│ Warning: Server Rebuild Required
│ 
│   with binarylane_server.test,
│   on main.tf line 19, in resource "binarylane_server" "test":19: resource "binarylane_server" "test" {
│ 
│ Server 461033 will lose all data if this Terraform plan is applied, because of modified attribute(s): ssh_keys
╵

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions