Skip to content

digitalocean_container_registry data source always returns empty data #1535

Description

@corewidedevops

Bug Report


The digitalocean_container_registry data source doesn't work as expected since the provider version 2.71.0

Describe the bug

Since the provider version 2.71.0 all the attributes of the digitalocean_container_registry data source have null instead of relevant values.
Conditional usage of digitalocean_container_registry resource and data source(s) in the TF stack is crucial for the multi-workspace setups, when the registry is managed in one Terraform workspace, and all other workspaces rely on the same data from the data source.

Affected Resource(s)

  • digitalocean_container_registry data source

Expected Behavior

The data source fetches registry data by name and stores the state. Expected output from the console:

> data.digitalocean_container_registry.registry
{
  "created_at" = "2026-05-13 09:33:40 +0000 UTC"
  "endpoint" = "registry.digitalocean.com/my-registry"
  "id" = "my-registry"
  "name" = "my-registry"
  "region" = "fra1"
  "server_url" = "registry.digitalocean.com"
  "storage_usage_bytes" = 0
  "subscription_tier_slug" = "basic"
}
>

Actual Behavior

All the attributes are null. Output from the console

> data.digitalocean_container_registry.registry
{
  "created_at" = tostring(null)
  "endpoint" = tostring(null)
  "id" = tostring(null)
  "name" = tostring(null)
  "region" = tostring(null)
  "server_url" = tostring(null)
  "storage_usage_bytes" = tonumber(null)
  "subscription_tier_slug" = tostring(null)
}
>

Steps to Reproduce

  1. Define the digitalocean_container_registry data source
  2. Apply the code

Terraform Configuration Files

data "digitalocean_container_registry" "registry" {
  name = "my-registry"
}

output "registry" {
  value = data.digitalocean_container_registry.registry
}

DigitalOcean Terraform Provider version

  • 2.71.0
  • 2.73.0
  • 2.75.0
  • 2.80.0
  • 2.81.0
  • 2.84.0
  • 2.85.1

Terraform version

  • 1.11.4
  • 1.15.3

Debug Output

Panic Output

Additional context

The same TF code but with older provider versions fetches data. Works with provider versions:

  • 2.16.0
  • 2.34.0
  • 2.43.0
  • 2.50.0
  • 2.70.0

Important Factoids

It looks like the content of the name argument is required by the data source validation, but actually doesn't have any effect. For example, with any of the mentioned provider versions, the data source result is always the same with any straight value (string, boolean, or number), supplied instead of the actual created registry name.

For the checked versions from 2.16.0 to 2.70.0 the result shows data about the existing registry, even if the name argument supplies an irrelevant value.

For the checked versions from 2.71.0 to 2.85.1 the result shows all attributes as null, even if the name argument supplies an irrelevant value.

But, the data source documentation states that the error should be triggered:

An error is triggered if the provided container registry name does not exist.

One more interesting point. There is an available digitalocean_container_registries data source for the 2.85.1 provider version. But it's not stated in the provider documentation. The only available argument is name, which also allows any straight input, and the result also contains null for all attributes.

Terraform code:

data "digitalocean_container_registries" "registries" {
  name = "all"
}

output "registries" {
  value = data.digitalocean_container_registries.registries
}

Console output:

> data.digitalocean_container_registries.registries
{
  "created_at" = tostring(null)
  "endpoint" = tostring(null)
  "id" = tostring(null)
  "name" = tostring(null)
  "region" = tostring(null)
  "server_url" = tostring(null)
  "storage_usage_bytes" = tonumber(null)
  "subscription_tier_slug" = tostring(null)
}
>

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions