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

Cannot import resource ovh_ip_reverse with an IPv6 address #213

Closed
berbiche opened this issue Aug 23, 2021 · 2 comments
Closed

Cannot import resource ovh_ip_reverse with an IPv6 address #213

berbiche opened this issue Aug 23, 2021 · 2 comments

Comments

@berbiche
Copy link

berbiche commented Aug 23, 2021

In short, the format used to import an ip address will not work with ipv6 addresses.

$ terraform import 'ovh_ip_reverse.something["2607:5300::1"]' '2607:5300::1/128:2607:5300::1'
Error: calling /ip/2607/reverse/5300::1%2F128:2607:5300::1:
	 Error 400: "[ipReverse] Given data (5300::1/128:2607:5300::1) is not valid for type ip"

Faulty code (splitting on ":"):

func resourceIpReverseImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
givenId := d.Id()
splitId := strings.SplitN(givenId, ":", 2)
if len(splitId) != 2 {
return nil, fmt.Errorf("Import Id is not ip:ip_reverse formatted")
}
ip := splitId[0]
ipReverse := splitId[1]

Terraform Version

Terraform v0.14.11
+ provider registry.terraform.io/ovh/ovh v0.15.0

Affected Resource(s)

  • ovh_ip_reverse

Terraform Configuration Files

# Fictive ip used
resource "ovh_ip_reverse" "something" {
  ip = "2607:5300::1"
  ip_reverse = "2607:5300::1"
  reverse = "something.ovh."
}

Debug Output

$ terraform import 'ovh_ip_reverse.something["2607:5300::1"] '2607:5300::1/128:2607:5300::1'
Error: calling /ip/2607/reverse/5300::1%2F128:2607:5300::1:
	 Error 400: "[ipReverse] Given data (5300::1/128:2607:5300::1) is not valid for type ip"

Panic Output

N/A

Expected Behavior

Importing an IPv6 address should be possible

Actual Behavior

API error

Steps to Reproduce

  1. terraform import 'ovh_ip_reverse.something["any ipv6 address"]' 'ipv6/128:ipv6'

Important Factoids

N/A

References

@berbiche berbiche changed the title Cannot import ressource ovh_ip_reverse with an IPv6 address Cannot import resource ovh_ip_reverse with an IPv6 address Aug 29, 2021
@tminard
Copy link

tminard commented Oct 20, 2023

I cant seem to create this resource with an ipv6 address. Reviewing the API docs, the docs indicate the IP should be ipv4. Not sure if this is a typo on the API, or an inconsistency with the terraform provider.

The error I get:

OVHcloud API error (status code 400): "Cannot check if [service name redacted]. resolves to [IPv6 redacted]" (X-OVH-Query-Id: US.ext-[req ID])

https://api.us.ovhcloud.com/console-preview/?section=%2Fip&branch=v1#post-/ip/-ip-/reverse

@yomovh
Copy link
Contributor

yomovh commented Nov 28, 2023

Hello,

This issue (which was on import not on creation) mentionned in this thread was fixed in version 0.29.

Can I ask you to open a new issue and provide all the details (terraform version, provider version, log).

Thanks

@yomovh yomovh closed this as completed Nov 28, 2023
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

3 participants