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

failure using IPv6 controller address. #582

Closed
hmlanigan opened this issue Sep 19, 2024 · 3 comments · Fixed by #649
Closed

failure using IPv6 controller address. #582

hmlanigan opened this issue Sep 19, 2024 · 3 comments · Fixed by #649
Labels
area/client kind/bug indicates a bug in the project

Comments

@hmlanigan
Copy link
Member

Description

Seen in acceptance tests and locally. When the first controller ip address provided is IPv6, the following error occurs. Even if the 2nd address provided is IPv4. Swapping the order of the ip address list or removing the IPv6 address resolves the issue.

=== NAME TestAcc_ResourceIntegrationWithMultipleConsumers
resource_integration_test.go:222: Step 3/3 error: Error running post-apply refresh plan: exit status 1

    Error: Client Error
    
      with juju_offer.a,
      on terraform_plugin_test.tf line 26, in resource "juju_offer" "a":
      26: resource "juju_offer" "a" {
    
    host addresses: cannot parse "10.25.111.110:17070,[fd42:ad8:5d38:946a:216:"
    as address:port: address 10.25.111.110:17070,[fd42:ad8:5d38:946a:216:: too
    many colons in address not valid
    
    Error: Not Found
    
      with juju_application.b1,
      on terraform_plugin_test.tf line 36, in resource "juju_application" "b1":
      36: resource "juju_application" "b1" {
    
    host addresses: cannot parse "10.25.111.110:17070,[fd42:ad8:5d38:946a:216:"
    as address:port: address 10.25.111.110:17070,[fd42:ad8:5d38:946a:216:: too
    many colons in address not valid

--- FAIL: TestAcc_ResourceIntegrationWithMultipleConsumers (332.27s)

Urgency

Annoying bug in our test suite

Terraform Juju Provider version

0.13.0, 0.14.0

Terraform version

1.9.x

Juju version

3.5.x

Terraform Configuration(s)

Check the controller ip addresses with `juju show-controller`, E.g.
['[fd42:13c3:1760:6d89:216:3eff:feb6:d595]:17070', '10.41.184.52:17070']

Or change the value of JUJU_CONTROLLER_ADDRESSES to put the IPv6 address first.

Reproduce / Test

terraform {
  required_providers {
    juju = {
      version = ">= 0.14.0"
      source  = "juju/juju"
    }
  }
}

provider "juju" {}

resource "juju_model" "testmodel" {
  name = "machinetest"
}

Debug/Panic Output

No response

Notes & References

No response

@hmlanigan hmlanigan added kind/bug indicates a bug in the project area/client labels Sep 19, 2024
@hmlanigan
Copy link
Member Author

Take a look at using net.JoinHostPort.

@alesstimec
Copy link
Member

could not reproduce with 0.15.1. tried the following plan

terraform {
  required_providers {
    juju = {
      version = "0.15.1"
      source  = "juju/juju"
    }
  }
}

provider "juju" {
  controller_addresses = "[fd42:fa9f:5992:a53e:216:3eff:fe3b:d196]:17070"
  username = "admin"
  password = *redacted*
  ca_certificate = *redacted*
}

resource "juju_model" "development" {
  name = "dev"

  cloud {
    name   = "localhost"
  }
}

resource "juju_application" "postgresql" {
  name = "postgresql"

  model = juju_model.development.name

  charm {
    name = "postgresql"
  }

  units = 1
}

which was successfully applied.

SimoneDutto added a commit to SimoneDutto/terraform-provider-juju that referenced this issue Dec 16, 2024
… in makefile to enable ipv6

The previuos shell command to extract the ipv6 from the show-controller was removing the '[' from
the ipv6. The new command removed only the surrounding '[', making it possible to work with ipv6

fix juju#582
SimoneDutto added a commit to SimoneDutto/terraform-provider-juju that referenced this issue Dec 16, 2024
… in makefile to enable ipv6

The previuos shell command to extract the ipv6 from the show-controller was removing the '[' from
the ipv6. The new command removed only the surrounding '[', making it possible to work with ipv6

fix juju#582
SimoneDutto added a commit to SimoneDutto/terraform-provider-juju that referenced this issue Dec 17, 2024
… in makefile to enable ipv6

The previuos shell command to extract the ipv6 from the show-controller was removing the '[' from
the ipv6. The new command removed only the surrounding '[', making it possible to work with ipv6

fix juju#582
SimoneDutto added a commit to SimoneDutto/terraform-provider-juju that referenced this issue Dec 17, 2024
… in makefile to enable ipv6

The previuos shell command to extract the ipv6 from the show-controller was removing the '[' from
the ipv6. The new command removed only the surrounding '[', making it possible to work with ipv6

fix juju#582
SimoneDutto added a commit to SimoneDutto/terraform-provider-juju that referenced this issue Dec 17, 2024
… in makefile to enable ipv6

The previuos shell command to extract the ipv6 from the show-controller was removing the '[' from
the ipv6. The new command removed only the surrounding '[', making it possible to work with ipv6

fix juju#582
@SimoneDutto
Copy link
Contributor

I have also tested two other scenarios:

  • ipv6 from $JUJU_CONTROLLER_ADDRESSES env var: All fine.
export JUJU_CONTROLLER_ADDRESSES="ipv6,ipv4"
---- main.tf
provider "juju" {
  username = "admin"
  password = "<redacted>"

  ca_certificate = file("ca.crt")
}
  • controller-self-discovery (unsetting the env var): all fine
unset  JUJU_CONTROLLER_ADDRESSES
---- main.tf
provider "juju" {
  username = "admin"
  password = "<redacted>"

  ca_certificate = file("ca.crt")
}

SimoneDutto added a commit to SimoneDutto/terraform-provider-juju that referenced this issue Dec 18, 2024
… in makefile to enable ipv6

The previuos shell command to extract the ipv6 from the show-controller was removing the '[' from
the ipv6. The new command removed only the surrounding '[', making it possible to work with ipv6

fix juju#582
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/client kind/bug indicates a bug in the project
Projects
None yet
3 participants