Skip to content

IPv6 unsupported #107

@mickare

Description

@mickare

Hello,
it seems that plain IPv6 in the host field is unsupported currently.

TL;DR: There is a workaround.

The problem is how the connection address is parsed in connectio.go#L129.

The SSH address for for the go ssh module must be in the format [ipv6]:port with the brackets.

Terraform Version

# terraform -v
Terraform v1.2.6
on linux_amd64
+ provider registry.terraform.io/hashicorp/local v2.2.3
+ provider registry.terraform.io/tenstad/remote v0.1.0

Affected Resource(s)

  • remote_file

Terraform Configuration Files

data "remote_file" "config" {
  conn {
    host        = "::1"
    port        = 22
    user        = "root"
    private_key = local.ssh.private_key
  }
  path = "/somefile.txt"
}

Debug Output

data.remote_file.config: Reading...
╷
│ Error: unable to open remote client: couldn't establish a connection to the remote server: dial tcp: address ::1:22700: too many colons in address
│ 
│   with data.remote_file.config,
│   on test.tf line 1, in data "remote_file" "config":
│    1: data "remote_file" "config" {
│ 
╵

Expected Behavior

IPv6 without brackets.

Actual Behavior

The "host" connection string is used to add the port number which leads to that error in go's ssh module (see connectio.go#L129)

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Workaround

Add the brackets [ ] to the host IPv6 address.

data "remote_file" "config" {
  conn {
    host        = "[::1]"
    port        = 22
    user        = "root"
    private_key = local.ssh.private_key
  }
  path = "/somefile.txt"
}

References

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