Skip to content

kubernetes_secret_v1 switch from data to data_wo does not delete data #2846

@matthiasreichinger-glitch

Description

kubernetes_secret_v1: I have moved my data fields (conaining secrets) to the data_wo fields. After plan and apply the data field is still populated with the old values.

Terraform Version, Provider Version and Kubernetes Version

Terraform version: 1.11
Kubernetes provider version: 3.0.1
Kubernetes version: 1.33.6

Affected Resource(s)

  • kubernetes_secret_v1

Terraform Configuration Files

resource "kubernetes_secret_v1" "minio_auth_secret" {
  metadata {
    name      = "minio-auth-secret"
    namespace = kubernetes_namespace_v1.minio.metadata[0].name
  }
  type = "Opaque"
  data_wo = {
    MINIO_ROOT_USER     = var.auth.root_user
    MINIO_ROOT_PASSWORD = var.auth.root_password
  }
  data_wo_revision = 1
}

Expected Behavior

data: null

Actual Behavior

plan was:

# module.minio.kubernetes_secret_v1.minio_auth_secret will be updated in-place
  ~ resource "kubernetes_secret_v1" "minio_auth_secret" {
      ~ binary_data_wo                 = (write-only attribute)
      ~ data_wo                        = (write-only attribute)
      + data_wo_revision               = 1
        id                             = "infrastructure-minio/minio-auth-secret"
        # (4 unchanged attributes hidden)
        # (1 unchanged block hidden)
    }

data is still populated:
(extract from the state file)

...
 "attributes": {
            "binary_data": null,
            "binary_data_wo": null,
            "binary_data_wo_revision": null,
            "data": {
              "MINIO_ROOT_PASSWORD": "asdf****",
              "MINIO_ROOT_USER": "admin"
            },
            "data_wo": null,
            "data_wo_revision": null,
            "id": "infrastructure-minio/minio-auth-secret",
            "immutable": false,
...

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

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