hashicorp / terraform-provider-bitbucket

This Terraform provider is archived per our provider archiving process: https://terraform.io/docs/internals/archiving.html
https://registry.terraform.io
Mozilla Public License 2.0
32 stars 105 forks source link

Add bitbucket_group resource #6

Closed pdecat closed 6 years ago

pdecat commented 7 years ago

This PR adds a bitbucket_group resource with support for managing members:

resource "bitbucket_group" "test_group" {
  accountname = "myaccount"
  name = "mygroup"
  auto_add = true
  permission = "write"

  members = [
    "someuser1",
    "someuser2",
  ]
}

TODO:

Notes:

References:

m3gg3r commented 6 years ago

Some news on this pull-request?

cwood commented 6 years ago

Can you split this into two PRs. one looks like a new resource the other looks like a faux client. Im also trying not support both 2.0/1.0 API's since the 1.0 API's arnt supported as well as the 2.0

pdecat commented 6 years ago

Hi @cwood, as stated in original description of the PR, the 1.0 API is used because 2.0 API does not support group resources.

1.0 API for groups: https://confluence.atlassian.com/bitbucket/groups-endpoint-296093143.html

No equivalent in 2.0 API: https://developer.atlassian.com/bitbucket/api/2/reference/resource/

pdecat commented 6 years ago

Partly resolves #8

cwood commented 6 years ago

Ill talk to the team about this. But there is teams https://developer.atlassian.com/bitbucket/api/2/reference/resource/teams/%7Busername%7D/members which is groups.

pdecat commented 6 years ago

Hmm, our team contains tens of groups which I cannot manage to see through the 2.0 teams API. Also, the teams API only seems to be read-only and does not address permissions.

Just to be sure we are talking about the same thing, this PR allows to manage groups, their members and their permissions as can be done through the web UI at the following URL: https://bitbucket.org/account/user/<team-id>/groups/<group-id>

PS: I've been waiting on the outcome of this PR before starting work on other PRs for adding bitbucket_group_privileges and bitbucket_privileges resources and bitbucket_repositories and bitbucket_team_members datasources.

cwood commented 6 years ago

Sorry to have negative information. But essentially we are gonna be removing all of the 1.0 API's soon(can't give specifics - watch for a blog post). It has become a philosophical discussion to not allow add-ons to manage users/groups since it can lead to credentials with access to a user/team account that can be hard to track down when access to an account is revoked. This is out of my hands since this has been more of a product decision.

For gathering team members. Your better off using the 2.0 API to fetch and use them as data resources than trying to manage them via the API.