Closed cmllr closed 1 week ago
Was not able to reproduce with token stored in file. If you store token in IONOS_TOKEN env variable, does this reproduce? Another way to debug is to enable TF_LOG=debug and IONOS_LOG_LEVE=trace. This way you can actually see your token in the http request and see if maybe some garbage chars were added while in the file. Also you can try to use the same token with ionosctl or postman and see if you still get the same error, just to make sure it's not terraform related.
Was not able to reproduce with token stored in file. If you store token in IONOS_TOKEN env variable, does this reproduce? Another way to debug is to enable TF_LOG=debug and IONOS_LOG_LEVE=trace. This way you can actually see your token in the http request and see if maybe some garbage chars were added while in the file. Also you can try to use the same token with ionosctl or postman and see if you still get the same error, just to make sure it's not terraform related.
Thank you for the hint with the IONOS_LOG_LEVEL
flag! I did another test and saw in the now more verbose log that there were unexpected HTTP 401
errors present. I created another token directly from the DCD (and downloaded the token file instead of copying it from the text box), which resulted in the terraform
calls to be working again!
Thank you for your help! And sorry for the time waste, as this seems to be an user or client error on my side here.
Description
terraform apply/ plan
calls getting aborted due to│ Error: an error occurred while fetching a LAN 7: Get "https://api.ionos.com/cloudapi/v6/<resource>?depth=0&pretty=true": net/http: invalid header field value for "Authorization"
.Expected behavior
The resources should be refreshed/ applied without errors.
Environment
Terraform version:
Provider version: initally discovered appeared in
6.4.13
, also persisting after upgrade to6.5.0
OS:
Configuration Files
We are reading the token from an file (
ionos_auth_file
). I already replaced the token with a fresh one (generated from DCD). The file has only the plain token, without any kind of (Bearer-)Prefix.We are using a modular approach, having a submodule which also uses the
ionoscloud
-provider. These modules have also been updated to6.5.0
and are using the same file contents for authentification.How to Reproduce
Unfortunately, I cannot provide the entire configuration due to cooperate restrictions here. But for example, having a terraform-created
ionoscloud_lan
within a VDC will cause the process to fail.terraform apply
within a tenant having any kind of IONOS-managed ressource (VDC, LAN)Error and Debug Output
Example for
terraform apply
on a existing VDC with multiple managed kubernetes instances, multiple LAN's and other resources. The VDC also has virtual machines, but they are not touched by a change of theterraform apply
.Additional Notes
We've seen this error while refreshing the state of LAN's, VDC or any kind of IONOS-managed resource. When applying only to managed Kubernetes, the apply works, but when IONOS-managed ressources, like a LAN are referred, the process will fail.
References