I am trying to create a redis helm chart via a module within a github workflow. The problem seems to be in the helm-values.yaml file in the module. It's an error converting YAML to JSON: yaml.
I have a workflow in github that executes a command that terraform apply a module that is in another github repo, in this module I have a helm-values.yaml that looks like this:
architecture: standalone
fullnameOverride: ${redis_deployment_name}
auth:
password: ${redis_admin_password}
# auth:
# existingSecret: redis
# existingSecretPasswordKey: redis-password
master:
${ indent(2, redis_affinity) }
${ indent(2, redis_nodeSelector) }
${ indent(2, redis_default_tolerations) }
persistence:
enabled: false
resources:
limits:
cpu: 350m
memory: 700Mi
requests:
cpu: 100m
memory: 256Mi
pdb:
enabled: true
# Explicit activation of Redis Stream
redisStreamEnabled: true
but I get this error:
Error: ---> error converting YAML to JSON: yaml: line 19: did not find expected key architecture: standalone
I changed the manifest file to look like this:
## @param architecture; architecture. Allowed: `standalone` or `replication`
##
architecture: standalone
fullnameOverride: ${redis_deployment_name}
auth:
password: ${redis_admin_password}
# auth:
# existingSecret: redis
# existingSecretPasswordKey: redis-password
master:
${ indent(2, redis_affinity) }
${ indent(2, redis_nodeSelector) }
${ indent(2, redis_default_tolerations) }
persistence:
enabled: false
resources:
limits:
cpu: 350m
memory: 700Mi
requests:
cpu: 100m
memory: 256Mi
pdb:
enabled: true
# Explicit activation of Redis Stream
redisStreamEnabled: true
But now i'm getting this error:
Error: ---> error converting YAML to JSON: yaml: line 21: did not find expected key ## @param architecture; architecture. Allowed: `standalone` or `replication`
So i changed one more time to this:
---
# Parameter info: architecture. Allowed values: `standalone` or `replication`
architecture: standalone
fullnameOverride: ${redis_deployment_name}
auth:
password: ${redis_admin_password}
# auth:
# existingSecret: redis
# existingSecretPasswordKey: redis-password
master:
${ indent(2, redis_affinity) }
${ indent(2, redis_nodeSelector) }
${ indent(2, redis_default_tolerations) }
persistence:
enabled: false
resources:
limits:
cpu: 350m
memory: 700Mi
requests:
cpu: 100m
memory: 256Mi
pdb:
enabled: true
# Explicit activation of Redis Stream
redisStreamEnabled: true
But now I get this error:
Error: ---> error converting YAML to JSON: yaml: line 22: did not find expected key ---
│ # Parameter info: architecture. Allowed values: `standalone` or `replication`
Every time I change the code, I get errors related to the first line even if it is a comment. I used **yamllint **to verify, the code works locally when i don't call it as a module, when i do a terraform apply directly in the root module. What seems to be the problem?
This is the code of the terraform module:
resource "helm_release" "redis" {
timeout = 240
name = "redis"
namespace = var.namespace
chart = "oci://registry-1.docker.io/bitnamicharts/redis"
version = var.helm_chart_version
values = [templatefile("${path.module}/manifests/redis-values.yaml", {
redis_deployment_name = var.redis_deployment_name
redis_affinity = var.redis_affinity
redis_nodeSelector = var.redis_nodeSelector
redis_default_tolerations = var.redis_default_tolerations
redis_admin_password = var.redis_admin_password
})]
}
and this is how I'm calling it:
module "redis" {
source = "git::https......"
namespace = var.namespace
redis_deployment_name = var.redis_deployment_name
redis_affinity = var.redis_affinity
redis_nodeSelector = var.redis_nodeSelector
redis_default_tolerations = var.redis_default_tolerations
redis_admin_password = "toto"
}
These are screenshots from the outout of the github workflow:
I had to remove all the commented code and use yamllint to validate the code.