ionos-cloud/terraform-provider-ionoscloud

Unable to manage IONOS domains

Closed this issue · 2 comments

Hello there \o

Description

I'm managing a domain name bought on IONOS (account accessible through https://my.ionos.fr/) and I'm trying to use your terraform provider (thanks for that possibility !).
Problem is: the provider documentation talks about a Token vs the IONOS Api documentation talks about an API-Key.

Regarding HTTP Request the provider is using Authorization Bearer $TOKEN vs the API which uses X-API-Key: publicprefix.secret.

I'm wondering here what I'm misunderstanding 🤔 It looks like the provider is not for the IONOS product I'm using...
Maybe I'm not using "IONOS Cloud" but only a sub-part of IONOS product to manage domains/DNS zones ?

I'm sorry if I'm missing something obvious but I would be pleased to manage my domain name with TF 😄

Expected behavior

To be able to use the IONOS Cloud provider with IONOS Domains product

Environment

Terraform version:

❯ terraform version
Terraform v1.4.5
on linux_amd64
+ provider registry.terraform.io/ionos-cloud/ionoscloud v6.4.10

OS:

❯ cat /etc/issue.net 
Ubuntu 20.04.6 LTS

Configuration Files

IONOS_TOKEN=*******
IONOS_LOG_LEVEL=trace

How to Reproduce

Above environment variables and the following terraform file:

terraform {
  required_providers {
    ionoscloud = {
      source  = "ionos-cloud/ionoscloud"
      version = "= 6.4.10"
    }
  }
}

provider "ionoscloud" {}

resource "ionoscloud_dns_zone" "this" {
  name        = "example.com"
  description = "description"
  enabled     = true
}

Error and Debug Output

Relevant part of the terraform import command

TF_LOG=TRACE terraform import ionoscloud_dns_zone.this 11111111-aaaa-bbbb-ccccc-222222222222
....
IONOSLOG 2023/12/07 12:24:32  DumpRequestOut : GET /zones/11111111-aaaa-bbbb-ccccc-222222222222 HTTP/1.1
Host: dns.de-fra.ionos.com
User-Agent: terraform-provider/6.1.9_ionos-cloud-sdk-go-dns/v1.1.1_hashicorp-terraform/1.4.5_terraform-plugin-sdk/2.10.1_os/linux_arch/amd64
Accept: application/json
Authorization: Bearer *******
Accept-Encoding: gzip


IONOSLOG 2023/12/07 12:24:32 
 try no: 1"
2023-12-07T12:24:32.613+0100 [DEBUG] provider.terraform-provider-ionoscloud_v6.4.10: Request time : 438.926489ms for operation : ZonesFindById: timestamp=2023-12-07T12:24:32.612+0100
2023-12-07T12:24:32.613+0100 [WARN]  unexpected data: registry.terraform.io/ionos-cloud/ionoscloud:stderr="IONOSLOG 2023/12/07 12:24:32 
 DumpResponse : HTTP/1.1 401 Unauthorized
Connection: close
Content-Length: 139
Content-Type: application/json; charset=utf-8
Date: Thu, 07 Dec 2023 11:24:32 GMT
Ionos-Request-Id: ******
Strict-Transport-Security: max-age=15724800; includeSubDomains
Vary: Origin
X-Content-Type-Options: nosniff
X-Frame-Options: DENY

{"httpStatus":401,"messages":[{"errorCode":"paas-auth-1","message":"Unauthorized, wrong or no api key provided to process this request"}]}"
...

Note that I'm able to use the API as documented using:

❯ curl -X GET "https://api.hosting.ionos.com/dns/v1/zones" -H "X-API-Key: *****.*****"
[{"name":"example.com","id":"11111111-aaaa-bbbb-ccccc-222222222222","type":"NATIVE"}]

Thank you for your answer !

Hello! For the DNS hosting API, you can use a different provider: IONOS developer.
Our provider is designed specifically for users with an IONOS Cloud account created from here.
Could you please review the other provider and confirm if it meets your requirements?
Thank you!

Hello! For the DNS hosting API, you can use a different provider: IONOS developer. Our provider is designed specifically for users with an IONOS Cloud account created from here. Could you please review the other provider and confirm if it meets your requirements? Thank you!

I'll have a look to the other provider,

Thank you very much 🙏