Skip to content
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

IPv6 unsupported #107

Open
mickare opened this issue Aug 14, 2022 · 1 comment
Open

IPv6 unsupported #107

mickare opened this issue Aug 14, 2022 · 1 comment

Comments

@mickare
Copy link

mickare commented Aug 14, 2022

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

@jensens
Copy link

jensens commented Oct 27, 2023

I just ran into the problem. While in other places with "connection" provided, brackets are not necessary, here it is.
I would consider this a bug, even if it is a minor one, thanks to the workaround provided here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants