Cidaas / terraform-provider-cidaas

This provider helps you managing your cidaas instances in an automated way. It enables you to configure and maintain apps and registration fields as part of a Terraform deployment. Secure – Fast – And unrivaled Swabian.
https://registry.terraform.io/providers/Cidaas/cidaas/latest/docs
MIT License
3 stars 4 forks source link

Cannot update cidaas_user_group #15

Closed joschug closed 2 months ago

joschug commented 4 months ago

I'm unable to update the description of an existing user group. Creating and deleting the group works, updating fails with status code 405.

We're using OpenTofu 1.7.1 with provider version 2.5.6.

Example group:

resource "cidaas_user_groups" "testgroup" {
  custom_fields                  = {}
  description                    = "Terraform-Testgroup"
  group_id                       = "tftest"
  group_name                     = "tftest"
  group_type                     = "tftest"
  make_first_user_admin          = false
  member_profile_visibility      = "public"
  none_member_profile_visibility = "public"
  parent_id                      = "root"
}

=> tofu apply succeeds

After changing the description, tofu apply fails:

resource "cidaas_user_groups" "testgroup" {
  custom_fields                  = {}
  description                    = "Terraform-Testgroup X"
  group_id                       = "tftest"
  group_name                     = "tftest"
  group_type                     = "tftest"
  make_first_user_admin          = false
  member_profile_visibility      = "public"
  none_member_profile_visibility = "public"
  parent_id                      = "root"
}
cidaas_user_groups.testgroup: Modifying... [id=tftest]
╷
│ Error: failed to update user group tftest
│
│   with cidaas_user_groups.testgroup,
│   on roles.tf line 62, in resource "cidaas_user_groups" "testgroup":
│   62: resource "cidaas_user_groups" "testgroup" {
│
│ status code not 20X. found 405, response body:
rgewidas commented 4 months ago

Hey @joschug,

thanks for opening this ticket regarding our terraform provider.

I did a quick check trying to reproduce from my side, but was successfully creating, updating and deleting the group object. Could you please tell us the tenantkey of your cidaas instance, the version and if possible the client_id of the non-interactive client used? This would help us a lot tracking the issue down.

Best Regards, Raphael

joschug commented 4 months ago

@rgewidas Thank you for your reply!

The tenantkey is cidaas-mediserv-test, the client_id should be fdd9806b-cdc1-4e32-996a-30f0d8c3472a.

I'm using OpenTofu 1.7.1 with provider version 2.5.6.

rgewidas commented 3 months ago

Hey @joschug,

thank you for sharing those details.

Let me explain, why this issue is occurring for you. Right now in the mentioned terraform version is trying to do a PUT call in old Node service API structure, which still supports PUT. The cidaas API has been migrated in the meantime to Golang where the create and update operations were merged into a single POST endpoint, removing the previous PUT endpoint for updating user groups.

To resolve this, the Terraform provider needs to be updated from our side to use the new POST endpoint for both creating and updating user groups as per the Go service API.

Currently we are planning to do a bigger release version (3.0.x) for the terraform plugin in the next few days where this issue will be fixed.

joschug commented 3 months ago

@rgewidas Excellent, thank you for troubleshooting the issue. I'm looking forward to the 3.x release. I'll give it a try as soon as it's available and report back.

joschug commented 2 months ago

3.0.0 resolved this issue. Thanks!