terraform-provider-bitbucket
terraform-provider-bitbucket copied to clipboard
bitbucket_branch_restriction users must not use username as it is deprecated and not obtainable
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
-
terraform apply
References
https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-changes-gdpr/#removal-of-usernames-from-user-referencing-apis
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 ?
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.
A small update, contacted Atlassian about this matter:
-
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) - 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
.