Skip to content

cloudflare_workers_kv cannot set metadata #6353

@vanniszsu

Description

@vanniszsu

Confirmation

  • This is a bug with an existing resource and is not a feature request or enhancement. Feature requests should be submitted with Cloudflare Support or your account team.
  • I have searched the issue tracker and my issue isn't already found.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Terraform v1.8.5
on darwin_arm64

  • provider registry.terraform.io/cloudflare/cloudflare v5.11.0

Affected resource(s)

cloudflare_workers_kv

Terraform configuration files

resource "cloudflare_workers_kv" "test" {
  account_id   = var.cf_account_id
  namespace_id = "var.namespace"
  key_name     = "tf-test-key"
  value        = "tf-test-value"
  metadata     = jsonencode({"appname"="test"})
}

Link to debug output

https://gist.github.com/vanniszsu/788441d5f8aa83be104144bd5e047709

Panic output

No response

Expected output

After terraform apply
Postman GET https://api.cloudflare.com/client/v4/accounts/:account_id/storage/kv/namespaces/:namespace/metadata/tf-test-key should have response

{
    "result": {
        "appname": "test"
    },
    "success": true,
    "errors": [],
    "messages": []
}

Actual output

After terraform apply
Postman GET https://api.cloudflare.com/client/v4/accounts/:account_id/storage/kv/namespaces/:namespace/metadata/tf-test-key seeing no metadata is actually created for the KV

{
    "result": null,
    "success": true,
    "errors": [],
    "messages": []
}

Steps to reproduce

  1. use terraform with cloudflare provider 5.11.0 to create a cloudflare_workers_kv resoruce with metadata configured in the resource
  2. after terraform apply successfully, use Postman to check if the metadata is presented in the KV
    https://developers.cloudflare.com/api/go/resources/kv/subresources/namespaces/subresources/metadata/methods/get/

Additional factoids

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.version/5Categorizes issue or PR as related to version 5 of the provider.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions