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

Bug: Postrender args are not passed to binary in releases >= 2.15 #1503

Closed fullykubed closed 1 month ago

fullykubed commented 1 month ago

Terraform, Provider, Kubernetes and Helm Versions

Terraform version: 1.8
Provider version: >= 2.15
Kubernetes version: 1.29

Affected Resource(s)

Terraform Configuration Files

resource "helm_release" "redis" {
  namespace       = var.namespace
  name            = random_id.id.hex
  repository      = "oci://registry-1.docker.io/bitnamicharts"
  chart           = "redis"
  version         = var.helm_version
  recreate_pods   = false
  cleanup_on_fail = true
  wait            = true
  wait_for_jobs   = true
  timeout         = 60 * 15
  max_history     = 5

  values = [ ... ]
  postrender {
    binary_path = "${path.module}/kustomize/kustomize.sh"

    # These are broken:
    args = [
      "${random_id.id.hex}-node",
      "${var.namespace}.${random_id.id.hex}"
    ]
  }
}

Steps to Reproduce

Try to apply when using helm_release with a postrender block that has args. Notice that args are not passed to the binary at binary_path during execution.

Expected Behavior

args are passed.

Actual Behavior

args are not passed.

References

This commit appears to be the one that broke this functionality: https://github.com/hashicorp/terraform-provider-helm/commit/723cb76045ec2b38adee1ee3998fcdf36327169c

Community Note

Tom-Newton commented 1 month ago

Is this the same problem as https://github.com/hashicorp/terraform-provider-helm/issues/1472?

sheneska commented 1 month ago

Hi @fullykubed, I will be closing this issue as it looks like a duplicate of #1472.

fullykubed commented 1 month ago

@sheneska This is not the same issue.

1472 is talking about the data element. This is for the resource.

Moreover, postrender does run now and did run before. The only thing that broke in the linked commit was that the author removed the passing of args to the postrender binary. In the bugged versions, the postrender binary is executed, just with no arguments.

I would recommend keeping this open.

bluekeyes commented 1 month ago

I can second that this appears to be a regression in provider versions 2.15.0 and newer. Pinning the provider to version 2.14.1 resolved the problem in my project. The regression is not immediately obvious because it only happens when creating a new helm_release resource; updating an existing helm_release resource still correctly passes the arguments to the postrender script.

1477 looks like a proposed fix for this issue.

fullykubed commented 1 month ago

@sheneska As this is a bug that has broken semver for this provider, can you please re-open?

alenmeister commented 3 weeks ago

This bug report should most definitively not be closed! Major blocker for us when creating new GitLab runners for a new repository. We rely on a sed command with two args to substitute the tags used on GitLab's OCP images for runners. As @bluekeyes mentioned, works just fine on existing resources but now new ones.

Reasonably commented 2 days ago

@sheneska Please reopen the issue. It’s frustrating to see this dismissed as a duplicate without addressing the clear differences.

Do you truly think this is the same issue as #1472? This issue explicitly concerns helm_release, whereas #1472 is about helm_template. These are entirely different contexts, and conflating them is a disservice to the discussion.

Furthermore, I’ve already submitted a fix for this in PR #1477. Closing the issue without proper review undermines the effort contributors put into improving the project. At the very least, please revisit both the issue and the PR before dismissing this so hastily.