terraform-provider-docker icon indicating copy to clipboard operation
terraform-provider-docker copied to clipboard

`docker_regsitry_iamge` is not able to pull image metadata from a private registry

Open matifali opened this issue 7 months ago • 0 comments

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

Terraform: v1.5.7 Docker provider: 3.0.2

Affected Resource(s)

  • docker_regsitry_iamge

Terraform Configuration Files

provider "docker" {
  registry_auth {
    address = "https://my.jfrog.io"
    username = "USERNAME"
    password = "PASSWORD"
  }
}

data "docker_registry_image" "dogfood" {
  name = "my.jfrog.io/docker/codercom/oss-dogfood:latest"
}

resource "docker_image" "dogfood" {
  name = "my.jfrog.io/docker/codercom/oss-dogfood@${data.docker_registry_image.dogfood.sha256_digest}"
  pull_triggers = [data.docker_registry_image.dogfood.sha256_digest]
  keep_locally = true
}

Debug Output

2024-01-03T10:41:22.200Z [ERROR] provider.terraform-provider-docker_v3.0.2: Response contains error diagnostic: @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:55 diagnostic_detail= diagnostic_severity=ERROR diagnostic_summary="Got error when attempting to fetch image version docker/codercom/oss-dogfood:latest from registry: Got bad response from registry: 403 Forbidden" tf_data_source_type=docker_registry_image tf_proto_version=5.3 tf_provider_addr=provider @module=sdk.proto tf_req_id=ca24be13-3ceb-79e7-ac36-0405ca2ab950 tf_rpc=ReadDataSource timestamp=2024-01-03T10:41:22.200Z
2024-01-03T10:41:22.201Z [ERROR] vertex "data.docker_registry_image.dogfood" error: Got error when attempting to fetch image version docker/codercom/oss-dogfood:latest from registry: Got bad response from registry: 403 Forbidden
2024-01-03T10:41:22.201Z [ERROR] vertex "data.docker_registry_image.dogfood (expand)" error: Got error when attempting to fetch image version docker/codercom/oss-dogfood:latest from registry: Got bad response from registry: 403 Forbidden
2024-01-03T10:41:22.202Z [INFO]  backend/local: plan operation completed
2024-01-03T10:41:22.202Z [INFO]  backend/local: writing plan output to: /tmp/provisionerd3922510325/Sessionff4decd2-ad87-4158-aa3d-d78ec2fce40c/terraform.tfplan
Error: Got error when attempting to fetch image version docker/codercom/oss-dogfood:latest from registry: Got bad response from registry: 403 Forbidden
on main.tf line 225, in data "docker_registry_image" "dogfood":
  225: data "docker_registry_image" "dogfood" {
2024-01-03T10:41:22.212Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-01-03T10:41:22.214Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/kreuzwerker/docker/3.0.2/linux_amd64/terraform-provider-docker_v3.0.2 pid=164
2024-01-03T10:41:22.214Z [DEBUG] provider: plugin exited

Expected Behaviour

Terraform should be able to get the image metadata, including the SHA digest, from the private regsitry.

Actual Behaviour

Terraform fails with a 403 code

Steps to Reproduce

  1. terraform apply

References

  • #556

matifali avatar Jan 03 '24 10:01 matifali