ZITADELZZITADEL
Powered by
SpankyS
ZITADEL•5mo ago•
15 replies
Spanky

Terraform: InvalidArgument desc = Project member is invalid (PROJECT-3m9d)

I've got all of my Terraform set up and working well, but I"m running into an error I can't figure out.

I'm creating a
zitadel_project_role
zitadel_project_role
like so, and it's creating the Project Role just fine:

resource "zitadel_project_role" "this" {
  project_id   = var.project_id
  org_id       = var.org_id
  role_key     = "super-user"
  display_name = "Administrator"
}
resource "zitadel_project_role" "this" {
  project_id   = var.project_id
  org_id       = var.org_id
  role_key     = "super-user"
  display_name = "Administrator"
}


Then I try to give this role to my user:

resource "zitadel_project_member" "this" {
  for_each = { for k, v in var.users : k => v if length(v.roles.project) > 0 }

  org_id     = var.org_id
  project_id = var.project_id
  roles      = each.value.roles.project
  user_id    = zitadel_human_user.this[each.key].id

  depends_on = [zitadel_project_role.this]
}
resource "zitadel_project_member" "this" {
  for_each = { for k, v in var.users : k => v if length(v.roles.project) > 0 }

  org_id     = var.org_id
  project_id = var.project_id
  roles      = each.value.roles.project
  user_id    = zitadel_human_user.this[each.key].id

  depends_on = [zitadel_project_role.this]
}


(Don't stress over the for_each and values, I've hardcoded them with the same results)

When I put my role into the
roles
roles
list, I get the error:

│ Error: failed to update projectmember: rpc error: code = InvalidArgument desc = Project member is invalid (PROJECT-3m9d)

When I go to the Console and perform the same action, it works. If I change the role to a built-in role, like
PROJECT_OWNER
PROJECT_OWNER
, the Terraform works.

I've verified the Org, Project and User ID are correct. I've also verified the role is present in the Console. No matter what I do, I continue to get this error.

Any help is appreciated!
ZITADEL banner
ZITADELJoin
ZITADEL - Identity infrastructure, simplified for you.
4,374Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Project grant is invalid (PROJECT-ckUpbvboAH)
Amr FekryAAmr Fekry / questions-help-bugs
6d ago
Project grant is invalid (PROJECT-ckUpbvboAH)
VantomLPVVantomLP / questions-help-bugs
5mo ago
terraform
kashishKkashish / questions-help-bugs
3mo ago