hashicorp / terraform-provider-helm

Terraform Helm provider
https://www.terraform.io/docs/providers/helm/
Mozilla Public License 2.0
1.01k stars 371 forks source link

helm_template create_namespace option does not create namespace manifest #1538

Closed chrxmvtik closed 4 days ago

chrxmvtik commented 6 days ago

Terraform, Provider, Kubernetes and Helm Versions

Terraform version: 1.9.8
Provider version: 2.16.1
Kubernetes version: 1.31.1

Affected Resource(s)

Terraform Configuration Files

data "helm_template" "ceph_csi_cephfs" {
  name       = "ceph-csi-cephfs"
  namespace  = "ceph-csi-cephfs"
  repository = "https://ceph.github.io/csi-charts/"

  chart   = "ceph-csi-cephfs"
  version = "3.12.2"

  create_namespace = true
}

Debug Output

NOTE: In addition to Terraform debugging, please set HELM_DEBUG=1 to enable debugging info from helm.

Panic Output

Steps to Reproduce

  1. terraform apply

Expected Behavior

helm_template should include namespace manifest in manifests list

Actual Behavior

There is no namespace manifest, so can't apply manifest.

Important Factoids

References

Community Note

sheneska commented 5 days ago

Hi @chrxmvtik, I have tried your example and it seems to work on my end - output "test" { value = data.helm_template.ceph_csi_cephfs.namespace }. Also the helm_template is a data source & will not create anything but instead just render charts.

chrxmvtik commented 5 days ago

Hi @chrxmvtik, I have tried your example and it seems to work on my end - output "test" { value = data.helm_template.ceph_csi_cephfs.namespace }. Also the helm_template is a data source & will not create anything but instead just render charts.

Hi, thanks for response, however..

Provided output simply returns a namespace field which you set using namespace = "ceph-csi-cephfs".

My question is what does create_namespace parameter do when using helm_template data source?

Should it render additional namespace manifest and add it to manifests list, shouldn't it? Or it is just useless parameter?

sheneska commented 4 days ago

Helm renders only resources that are defined in the templates. This specific field does nothing in the context of this resource, it is present there because it is also in the corresponding helm template subcommand.