Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add scoped user role resource #154

Merged

Conversation

evan-cleary
Copy link

@evan-cleary evan-cleary commented Apr 7, 2021

Scoped User Role

User Roles can be defined on either the team resource, or managed as separate resource.

When used in combination any additional scoped user roles assigned to a team that are not defined within the team def would be removed upon apply. If roles are going to be modified from a non central location, the individual resource method should be utilized.

New resource: octopusdeploy_scoped_user_role
Modify Resource: octopusdeploy_team add block property "user_role"

Known Issues

Due to the necessity of including the "computed" attribute on the team user_role attribute, there is a standing bug when removing all user roles from a team. If all entries are removed at once, none will be deleted. If all but 1 are removed from the config, all those removed will be properly deleted. This can, of course, be manually cleaned up at a later point.

This bug stems from the inability to detect if a value is coming from the config or if it's computed. If we had the ability to determine if contents were coming through as computed, these could be compared against previous state and properly cleared.

Progress

  • Scoped user role schema defined
  • Individual octopusdeploy_scoped_used_role resource created
  • User role block added to octopusdeploy_team resource
  • Documentation updated
  • Tests written

Depends On: OctopusDeploy/go-octopusdeploy#52
Closes #150

Type: schema.TypeSet,
},
"user_role_id": {
Type: schema.TypeString,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In UI we can add multiple roles in team, here we are are giving access to single user role id.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "user_role" property of the team is a Set. Terraform for it would look like

resource "octopusdeploy_team" "this" {
  name = "Example"

  user_role {
    user_role_id = "userrole-1"
    space_id     = "Spaces-1"
  }
  user_role {
    user_role_id = "userrole-2"
    space_id     = "Spaces-1"
  }
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this will be available?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajaychoudhary-bcg I'll try to have this PR ready for review by the end of the week. I've been doing these changes in my free time. Everything is merged on the api library side so I need to rebase with upstream and write tests.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evan-cleary Please merge and create new version so that we can use it.

@evan-cleary evan-cleary force-pushed the feat-scoped-user-role-resource branch from 2acba2d to 9f0b4cd Compare April 20, 2021 01:29
@evan-cleary evan-cleary marked this pull request as ready for review April 20, 2021 01:52
@evan-cleary evan-cleary force-pushed the feat-scoped-user-role-resource branch 3 times, most recently from fee8743 to 4b2b7e8 Compare April 21, 2021 00:08
@evan-cleary evan-cleary force-pushed the feat-scoped-user-role-resource branch from 4b2b7e8 to 6726f22 Compare April 21, 2021 01:06
@evan-cleary
Copy link
Author

@jbristowe this PR is ready for review

@ajaychoudhary-bcg
Copy link

@jbristowe this PR is ready for review

Any Update on this?

@ajaychoudhary-bcg
Copy link

@jbristowe this PR is ready for review

Any Update on this?

Any update, we are waiting for this to be available from few weeks.

@ajaychoudhary-bcg
Copy link

@jbristowe @evan-cleary Any update on this?

Copy link

@ajaychoudhary-bcg ajaychoudhary-bcg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please merge and provide new version

@evan-cleary
Copy link
Author

@jbristowe Should be good to go now for the data object

@jbristowe jbristowe merged commit 5f85d49 into OctopusDeployLabs:master Aug 10, 2021
@jbristowe
Copy link
Contributor

🎉 Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User Role in team resource
3 participants