terraform-provider-bitbucket icon indicating copy to clipboard operation
terraform-provider-bitbucket copied to clipboard

bitbucket_branch_restriction users must not use username as it is deprecated and not obtainable

Open ChristianAnke opened this issue 1 year ago • 3 comments

Terraform Version

v1.5.5

Affected Resource(s)

  • bitbucket_branch_restriction

Terraform Configuration Files


resource "bitbucket_branch_restriction" "push" {
  branch_match_kind = "glob"
  branch_type       = null
  kind              = "push"
  owner             = "me"
  pattern           = "main"
  repository        = "repo-name"
  users             = [ "user_name" ]
  value             = 0
}

Expected Behavior

Instead of user_name the UUID or Atlassian ID schould be used

Actual Behavior

The users username can not be obtained other than the user itself. There is no API endpoint providing this information anymore.

Steps to Reproduce

  1. terraform apply

References

https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-changes-gdpr/#removal-of-usernames-from-user-referencing-apis

ChristianAnke avatar Aug 23 '23 07:08 ChristianAnke

Due to this issue there is no other way to configure the allowed user on the branch restriction rather then just hardcode the username. Could we get some attention to this ?

TizianoPerrucci avatar Apr 12 '24 10:04 TizianoPerrucci

The API does not seem to support account_id (Atlassian ID) as this is not part of the API account schema, which is weird considering the reference posted. To support this, it would be best to communicate this with Atlassian.

uuid is supported through the API. I am only not sure how to represent this in HCL.

Nkmol avatar May 01 '24 18:05 Nkmol

A small update, contacted Atlassian about this matter:

  1. username is now officially deprecated from this endpoint, and has been removed from the OpenAPI definition (see https://community.atlassian.com/t5/Bitbucket-questions/Feat-Swagger-V3-Update-account-schema/qaq-p/2694518#U2702105)
  2. A request has been filled to support account_id (Atlassian ID) for this endpoint https://jira.atlassian.com/browse/BCLOUD-23240 (see https://community.atlassian.com/t5/Bitbucket-questions/Feat-REST-allow-Account-ID-to-be-used-to-update-users-in-branch/qaq-p/2694527#U2702107). It will help to vote for the issue if this is something you'd want.

To keep this backwards compatible, and as the API still support post requests with username, I want to try to support both these syntaxes. But strongly advise using the uuid as remote changes cannot be checked with username.

Nkmol avatar May 18 '24 09:05 Nkmol