terragrunt: .terragrunt-source-manifest breaks terraform helm_release resource

Similar to #829

The file .terragrunt-source-manifest breaks a terraform helm_release resource with the error YAML parse error on .../.terragrunt-source-manifest: error converting YAML to JSON: yaml: invalid leading UTF-8 octet. Makes sense because the manifest is a binary file.

Now because terragrunt excludes dotfiles during the copy adding .terragrunt-source-manifest to a .helmignore doesn’t work; the .helmignore doesn’t exist in the terragrunt cache dir.

Working around this requires manually copying the .helmignore file into the terragrunt cache after a failed apply.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 24
  • Comments: 16 (3 by maintainers)

Most upvoted comments

if it helps anyone, It can be solved using terragrunt generator block like this:

generate "helmignore" {
  path      = "charts/fluentd/.helmignore"
  if_exists = "overwrite_terragrunt"
  contents  = <<EOF
.terragrunt-source-manifest*
  EOF
}

another workaround we found ugly but works is by copying the .helmignore file during apply and add a dependency to the helm_release resource, eg:

resource "helm_release" "access_control" {
  depends_on = [
    local_file.ns_helmignore
  ]
xxxx
}

resource local_file ns_helmignore {
  content     = file("./helmignore")
  filename = "./chart/.helmignore"
  file_permission = "0644"
}

We’re setting TERRAGRUNT_SOURCE to a directory containing a terraform module with multiple helm charts.