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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during pushing image to GCP Artifact Registry, Unable to create image, image not found: unable to get digest: Got bad response from registry: 405 Method Not Allowed #621

Open
antoniomazzeo opened this issue May 27, 2024 · 0 comments

Comments

@antoniomazzeo
Copy link

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and docker Provider) Version

Tested with Terraform version 1.8.4
Docker provider at version v3.0.2

Affected Resource(s)

  • docker_registry_image

Terraform Configuration Files

resource "docker_image" "lib-check" {
  name = "${var.region}-docker.pkg.dev/${var.project_id}/${var.project_id}-docker-registry/lib-check:latest"
  build {
    context = "./cicd"
    dockerfile = "lib-check-Dockerfile"
  }
  triggers = {
    dir_sha1 = sha1(join("", [for f in fileset(path.module, "cicd/lib-check-Dockerfile") : filesha1(f)]))
  }
  depends_on = [
    google_artifact_registry_repository.docker-registry
  ]
}

resource "docker_registry_image" "lib-check-image" {
  name          = docker_image.lib-check.name
  keep_remotely = true
}

Debug Output

(https://gist.github.com/antoniomazzeo/3066b66c381b660765eef0819bad224c)

Expected Behaviour

Docker image should be pushed without errors

Actual Behaviour

The Docker image is correctly pushed to the GCP Artifact Registry, but the terraform provider gives the error "Unable to create image, image not found: unable to get digest: Got bad response from registry: 405 Method Not Allowed" trying to get image digest.
Seems like GCP Artifact Registry is rejecting the HEAD http verb while getting the image digest (data_source_docker_registry_image.go), changing it to GET, everything works as expected, but I don't know if it still works for other registries as well.

Steps to Reproduce

  1. terraform apply
@antoniomazzeo antoniomazzeo changed the title Unable to push image to GCP Artifact Registry, Unable to create image, image not found: unable to get digest: Got bad response from registry: 405 Method Not Allowed Error during pushing image to GCP Artifact Registry, Unable to create image, image not found: unable to get digest: Got bad response from registry: 405 Method Not Allowed May 27, 2024
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

1 participant