Closed ZaxR closed 10 months ago
Hitting the BB API directly (see command below), I get the following error instead of what tf is returning:
{"type": "error", "error": {"message": "Token is invalid or not supported for this endpoint."}}%
That seems to suggest one or both of:
Since the docs show a token being supported for the endpoint.
curl --request POST \
--url 'https://api.bitbucket.org/2.0/repositories/<workspace>/<repo name>' \
--header 'Authorization: Bearer $BITBUCKET_OAUTH_TOKEN' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"project": {
"key": "<project key>"
}'
I tried switching to username and password instead, and am still hitting the same issue, though now the equivalent curl works.
I set BITBUCKET_USERNAME
and BITBUCKET_PASSWORD
(which is an app password) and unset BITBUCKET_OAUTH_TOKEN
.
I still get Error: This endpoint does not support token-based authentication
But the following works:
curl --request POST \
--url 'https://api.bitbucket.org/2.0/repositories/<workspace>/<repo name>' \
--user ${BITBUCKET_USERNAME}:${BITBUCKET_PASSWORD} \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"project": {
"key": "<project key>"
},
"is_private": true
}'
What am I doing wrong?
Working now. Not sure exactly what changed, but either some issue with cached values or additional arguments I added:
resource "bitbucket_repository" "repo" {
owner = var.repo_owner
name = var.repo_name
slug = var.repo_slug
scm = "git"
is_private = true
project_key = var.project_key
pipelines_enabled = true
inherit_default_merge_strategy = false
inherit_branching_model = false
}
Hi there,
Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.
Terraform Version
Run
terraform -v
to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.Affected Resource(s)
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
Debug Output
Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist. debug output
Panic Output
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the
crash.log
.Expected Behavior
What should have happened? A new bitbucket repository should have been created
Actual Behavior
What actually happened? │ Error: This endpoint does not support token-based authentication │ │ with module.ds-cc-creation-test.bitbucket_repository.repo, │ on ../../../modules/repo/main.tf line 21, in resource "bitbucket_repository" "repo": │ 21: resource "bitbucket_repository" "repo" { │
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply