Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_sensitive Breaks Manifest Display, Showing a Wall of (sensitive value 46b9dd2b0ba88d13) #1539

Open
vidbregar opened this issue Nov 20, 2024 · 1 comment
Assignees
Labels

Comments

@vidbregar
Copy link

vidbregar commented Nov 20, 2024

Terraform, Provider, Kubernetes and Helm Versions

Terraform version: v1.9.3
Provider version: 2.16.1
Kubernetes version: 1.31.1-gke.1678000

Affected Resource(s)

  • helm_release

Terraform Configuration Files

variable "api_keys" {
  type      = list(string)
  sensitive = true
  default   = []
}

variable "gcp_project_name" {
  type    = string
  default = "example"
}

resource "helm_release" "example" {
  name             = "example"
  repository       = "https://helm.github.io/examples"
  chart            = "hello-world"
  namespace        = "example"
  create_namespace = true
  atomic           = true
  wait             = true
  force_update     = false

  set_sensitive {
    name  = "example"
    value = join("\\,", var.api_keys)
  }
}

terraform {
  required_providers {
    helm = {
      source  = "hashicorp/helm"
      version = "2.16.1"
    }
  }
}

provider "helm" {
  debug = false
  kubernetes {
    host                   = "https://${data.google_container_cluster.gke.endpoint}"
    token                  = data.google_client_config.provider.access_token
    cluster_ca_certificate = base64decode(data.google_container_cluster.gke.master_auth.0.cluster_ca_certificate)
  }
  experiments {
    manifest = true
  }
}

data "google_container_cluster" "gke" {
  name     = "example"
  project  = var.gcp_project_name
  location = "example"
}

data "google_client_config" "provider" {}

Debug Output

https://gist.github.com/vidbregar/0c80f4c003b585d165829a8ac592657c

Steps to Reproduce

  1. api_keys variable must be set to []
  2. terraform plan

Expected Behavior

Plan should display the manifest.

Actual Behavior

Each character of the displayed manifest is surrounded with (sensitive value 46b9dd2b0ba88d13).

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
@vidbregar
Copy link
Author

vidbregar commented Nov 20, 2024

Workaround:
Replace set_sensitive with:

dynamic "set_sensitive" {
  for_each = nonsensitive(length(var.api_keys)) > 0 ? [1] : []
  content {
    name  = "example"
    value = join("\\,", var.api_keys)
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants