Open tdmalone opened 4 years ago
Just ran into this. Appears to be an issue with the bitbucket API, not the terraform provider?
Initial API response using /2.0/repositories/{workspace}/{repo_slug}/pipelines_config
[0]:
{
"type": "error",
"error": {
"message": "Resource not found",
"detail": "There is no API hosted at this URL.\n\nFor information about our API's, please refer to the documentation at: https://developer.atlassian.com/bitbucket/api/2/reference/"
}
}
After manually enabling pipelines:
{
"repository": {
"name": "My Repo",
"type": "repository",
"full_name": "ownerofrepo/this-is-my-repo",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/ownerofrepo/this-is-my-repo"
},
"html": {
"href": "https://bitbucket.org/ownerofrepo/this-is-my-repo"
},
"avatar": {
"href": "https://google.com/lol.jpg"
}
},
"uuid": "{exxxxxa5-e062-4xxc-axx7-346xxxxxxe78}"
},
"enabled": true,
"type": "repository_pipelines_configuration"
}
After manually disabling pipelines:
{
"repository": {
"name": "My Repo",
"type": "repository",
"full_name": "ownerofrepo/this-is-my-repo",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/ownerofrepo/this-is-my-repo"
},
"html": {
"href": "https://bitbucket.org/ownerofrepo/this-is-my-repo"
},
"avatar": {
"href": "https://google.com/lol.jpg"
}
},
"uuid": "{exxxxxa5-e062-4xxc-axx7-346xxxxxxe78}"
},
"enabled": false,
"type": "repository_pipelines_configuration"
}
It appears the API simply returns a 404
until the pipeline setting is first used.
Appears to be an issue with the bitbucket API, not the terraform provider?
Possibly, but it's essentially a bug in the Terraform provider as it breaks importing - so needs a workaround to possibly ignore the error when pipelines aren't enabled.
Just encountered the same error when renaming a repository which has no pipeline and I guess the same will happen if you change any other attribute. This makes this provider unusable if you don't use pipelines.
Temporary fix is to pin the provider to 1.1, then everything works fine but you'll be missing a few features (see change log for more info).
I'm not familiar with go but it looks like that the provider should capture the 404 error and treat it as that the pipelines are disabled.
Terraform Version
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Expected Behavior
Terraform should have imported
my-repo
without errors.Actual Behavior
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform import bitbucket_repository.my_repo my-team/my-repo
Important Factoids