ionos-cloud/terraform-provider-ionoscloud

ionoscloud_group not working "user_ids" is not expected here.

Closed this issue · 3 comments

Description

I just copied the user / group example from the docs at https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/group and adapted it a little bit.

Expected behavior

Working terraform code.

Environment

Terraform version:

Terraform v1.0.10

Provider version:

    ionoscloud = {
      source = "ionos-cloud/ionoscloud"
      version = "= 6.0.0-alpha.3"
    }

Configuration Files

provider "ionoscloud" {}
variable "users" {
  type    = list(map(string))
  default = []
}
resource "ionoscloud_user" "user" {
  for_each       = var.users
  administrator  = false
  force_sec_auth = false
  first_name     = each.value.first_name
  last_name      = each.value.last_name
  email          = each.value.email
  password       = each.value.password
}
resource "ionoscloud_group" "group" {
  name                           = "group"
  user_ids                       = [ionoscloud_user.user.*.id]
}

How to Reproduce

  1. create the tf file
  2. run terraform init
  3. run terraform plan

Error and Debug Output

│ Error: Unsupported argument
│ 
│   on main.tf line 33, in resource "ionoscloud_group" "group":
│   33:   user_ids                       = [ionoscloud_user.user.*.id]
│ 
│ An argument named "user_ids" is not expected here. Did you mean "user_id"?
╵

https://github.com/ionos-cloud/terraform-provider-ionoscloud/blob/master/ionoscloud/resource_group.go#L77

Hi @firecyberice,

This is happening because user_ids has been introduced in version 6.2.0, and you are using 6.0.0-alpha.3, in which the argument was named user_id, not having the possibility of adding multiple users into a group.

We would recommend updating your provider to the latest version, since there are more fixes done in the meantime.

Oh ok but I just copied everything from the docs page. https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs#example-usage
So there is maybe an update on the docs needed.

Thank you for responding so fast.
Feel free to close this ticket.

@firecyberice,

Thank you a lot for pointing this out! Indeed, we did not update the version in this file. We will do this asap.