Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Error: 500 2.0/repositories/<team>/<repository>/src Something went wrong #193

Open
gelfandbein opened this issue Jan 1, 2024 · 5 comments

Comments

@gelfandbein
Copy link

gelfandbein commented Jan 1, 2024

Terraform 1.5.5
Bitbucket provider 2.38.0

Can't upload to branch small files (15-20 files), always got 500 error after second file, 1st file uploaded yo branch without problems

terraform.log:

2024-01-01T16:53:24.973+0200 [ERROR] provider.terraform-provider-bitbucket_v2.38.0: Response contains error diagnostic: tf_proto_version=5.4 tf_req_id=2da8da95-5d0a-da69-dbe7-8fc853ced63a @module=sdk.proto diagnostic_detail= diagnostic_severity=ERROR tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_summary="API Error: 500 2.0/repositories/<team>/<repository>/src Something went wrong" tf_provider_addr=DrFaust92/bitbucket tf_resource_type=bitbucket_commit_file timestamp=2024-01-01T16:53:24.973+0200
2024-01-01T16:53:24.976+0200 [ERROR] vertex "bitbucket_commit_file.web_conf" error: API Error: 500 2.0/repositories/<team>/<repository>/src Something went wrong

Terraform resource:

resource "bitbucket_commit_file" "startup_script" {
  filename       = "startup-script.sh"
  content        = data.template_file.startup_script.rendered
  repo_slug      = "config"
  workspace      = data.bitbucket_workspace.current_workspace.slug
  commit_author  = "John Doe <${var.admin1_email}>"
  branch         = "config"
  commit_message = "initial config"
}

Can I commit whole folder not by file?

@gelfandbein
Copy link
Author

And for the future I'd like to upload generated files (after 'terraform apply') not only from the repo source

@wuetz
Copy link

wuetz commented Oct 14, 2024

Hi i have the same issue, first file commit is working, then it crashes..

@KevinDeNotariis
Copy link

Did anyone figure out why is that? I'm facing the same issue

@wuetz
Copy link

wuetz commented Oct 17, 2024

Could you please show your workaround looks like?

@gelfandbein
Copy link
Author

gelfandbein commented Oct 18, 2024

Could you please show your workaround looks like?
In my approach, i'll create new branch for files and commit these:

resource "null_resource" "prepare_branch" {
provisioner "local-exec" {
interpreter = ["/bin/bash", "-c"]
working_dir = path.module
command = <<EOT
...
git config --global user.email "${var.cluster}@${var.project}"
git config --global user.name "Terraform: ${var.cluster} at ${var.project}"
git -C /tmp/${var.cluster}-se-configs add .
git -C /tmp/${var.cluster}-se-configs commit -m "Initial '${var.cluster}' cluster config at '${var.project}' project"
...
EOT
}

or you can zip files, commit it and use .git/hooks/pre-commit bash file to unpack and finally commit to branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants