OctopusDeployLabs / terraform-provider-octopusdeploy

Terraform Provider for Octopus Deploy :octopus:
https://registry.terraform.io/providers/OctopusDeployLabs/octopusdeploy
Mozilla Public License 2.0
83 stars 67 forks source link

Create a team with only system permissions user role #330

Open chathsuom opened 2 years ago

chathsuom commented 2 years ago

Current Team User Roles and Scoped User Roles, only supported roles with space permissions. We would like to use user roles only with system permissions.

chathsuom commented 2 years ago

It actually works with providing "" for space_id.

resource "octopusdeploy_scoped_user_role" "system_admin" {  
    space_id     = ""  
    team_id      = module.teams["system_admin"].id  
    user_role_id = data.octopusdeploy_user_roles.system_admin.user_roles[0].id  
}
johnsimons commented 2 years ago

This does not feel very nice @jbristowe @slewis74 It would be nice to maybe have specific resources for system vs space, thoughts?

cdhunt commented 2 years ago

I'm having a similar problem but the other way around. I'm trying to assign a Space-scoped user role with the team inline data block.

  user_role {
    space_id     = data.octopusdeploy_space.space.id
    user_role_id = "userroles-spacemanager"
  }

I get the following error.

Error: error creating user role for team Teams-208: octopus deploy api returned an error on endpoint /api/scopeduserroles - [You cannot use a role without any Space level permissions at the Space level.

Clare-Octopus commented 2 months ago

Another user seeing this issue (internal link) - https://octopus.zendesk.com/agent/tickets/200034

The workaround that @chathsuom posted up helped resolve the issue for them so thank you for posting that up so it helps others who have run into this!