terraform-provider-docker
terraform-provider-docker copied to clipboard
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
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
terraform apply