stackitcloud / terraform-provider-stackit

The official Terraform provider for STACKIT
https://registry.terraform.io/providers/stackitcloud/stackit
Apache License 2.0
35 stars 13 forks source link

Error: Provider can't apply new stackit_network ressource in v0.18.1 #378

Closed Slaizer007 closed 2 months ago

Slaizer007 commented 4 months ago

After trying the new stackit_network ressource I get a error during the apply.

I can cleanly reproduce the issue with following config:

terraform {
  required_version = "~>1.5"
  required_providers {
    stackit = {
      source  = "stackitcloud/stackit"
      version = "0.18.1"
    }
  }
}

provider stackit {
  region = "eu01"
  resourcemanager_custom_endpoint = "https://resource-manager.api.stg.stackit.cloud"
  objectstorage_custom_endpoint   = "https://object-storage.api.eu01.stg.stackit.cloud"
  ske_custom_endpoint             = "https://ske.api.eu01.stg.stackit.cloud"
  service_account_token = var.service_account_token
}

resource "stackit_network" "my-network" {
  project_id         = "<redacted>"
  name               = "my-network"
  nameservers        = ["1.1.1.1", "8.8.8.8", "9.9.9.9"]
  ipv4_prefix_length = 24
}

Output of terraform apply:

Error: Error creating network
│ 
│   with stackit_network.my-network,
│   on ske.tf line 23, in resource "stackit_network" "my-network":
│   23: resource "stackit_network" "my-network" {
│ 
│ Calling API: undefined response type, status code 401, Body: Jwks doesn't
│ have key to match kid or alg from Jwt
│ 
╵
ERROR: Terraform apply failed.
vicentepinto98 commented 4 months ago

Hi @Slaizer007, are you using a project in QA? If yes, you need to set the field iaas_custom_endpoint to the QA url of the IaaS API.

This seems like a problem with the authentication, so please also double check your project_id and service_account_token.

Slaizer007 commented 4 months ago

Hey @vicentepinto98,

you are right we are deploying to STACKIT QA Portal. We added the correct iaas_custom_endpoint now and receive a new error:


│ Error: Error creating network
│
│   with stackit_network.hansp-k8s-network,
│   on ske.tf line 23, in resource "stackit_network" "hansp-k8s-network":
│   23: resource "stackit_network" "hansp-k8s-network" {
│
│ Calling API: undefined response type, status code 404, Body:
│ {"status":404,"message":"Not found"}
│
╵
vicentepinto98 commented 4 months ago

I just tested in QA and everything is working fine. Which url are you using? The correct one is https://iaas-qa.api.eu01.stg.stackit.cloud

joaopalet commented 2 months ago

Hey @Slaizer007, I'll close this issue due to inactivity. Please feel free to re-open it if you still have doubts!