-
Notifications
You must be signed in to change notification settings - Fork 373
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
Add functionality to set a list #92
Comments
This should work: set {
name = "controller.service.loadBalancerSourceRanges"
value = "{${join(",", var.internal_ip_addr_cidrs)}}"
} |
@sebastien-prudhomme tried this, get the following error key map "ran" has no value |
@aaronmell Can you dump the content of var.internal_ip_addr_cidrs? |
The following works for me:
|
@sebastien-prudhomme How I supposed to use this?
I got an error:
|
@BrunoQuaresma It works for simple list, not for map |
@sebastien-prudhomme Ok, but how can I work with a list of maps using the plugin? Is it possible? |
The plugin only accept string but with a "join" you can transform a list a string compatible with Helm list syntax. What is "Agent.volumes"? Which Helm chart are you using? |
I'm using Jenkins -> https://github.com/helm/charts/tree/master/stable/jenkins |
@BrunoQuaresma Ok i see, it will be hard to do it with the "set" attribute. Either wait for Terraform 0.12 which can build complex structure, or try to generate portions of files that you can import with the "values" attribute. |
@sebastien-prudhomme I didn't find anything about the "values" attributes in the docs -> https://github.com/mcuadros/terraform-provider-helm/blob/master/docs/README.md |
There https://github.com/mcuadros/terraform-provider-helm/blob/master/docs/release.md It's the same thing as using "helm install" with the "--values" option. |
Thanks. |
+1 for adding this to the provider |
+1 for this. It would be very useful. |
In case of external-dns chart, list can work as follows: resource "helm_release" "externaldns" {
name = "externaldns"
chart = "stable/external-dns"
set {
name = "sources"
value = "{service, ingress}"
}
set {
name = "domainFilters"
value = "{${local.dns_zone_name}}"
} Hope it works for others. I think it's for golang spec. |
@joanayma is it really "working"? Which versions are you running? I have the same issue with external-dns but when I use this syntax I get a comma separated list in the domain filter which does not work. It needs to be multiple |
It would be great if |
for anyone else that comes across this I ended up with
main.tf
|
Here's a work around I found for setting deeply nested values less painfully (tf 12+ only)
|
I've managed to solve the issue, but creating yaml file on the fly from local complex object:
|
When I set an array value for a
My TF Plan shows the value being passed like whats shown below:
Why I need the format to be like this? When the helm chart is installed manually from the command line using Helm Error: Fix: It works just fine when I specify Things I have tried: 1. Doesn't works:
Failue/Error : TF Plan parses the value as
2. Doesn't works:
Failue/Error : TF Plan parses the value as
|
any update on working with list of maps |
it works like below as well
|
I'd really like to set the set block take a list or map as it's |
I see that this has been marked as "breaking change". Terraform attempts to parse strings from the command line when the variable that the string defines is typed as As a bonus, a type of All cases would work properly, while a type of |
+1 |
1 similar comment
+1 |
any updates ?
|
I've done quite a bit of structure gymnastics to get the data that I need into the chart from Terraform. This really needs to be fixed. The yaml encoding that other comments have stated only works when the array values are not maps. |
Hi, I have a same problem as @Type1J
but I have a problem to define it with:
|
Maybe it can help you . })]
And the var.runners is :
to populate it in some main.tf just use a list of object :
Worked smoothly for me . I'm setting up the entire list of objects to my values .
|
Looks great, thanks. I'll test it out tomorrow. |
The workaround of using the values field is only usable if your values aren't sensitive. I need either this issue fixed or #546 - without one of them, I believe it's impossible to pass complex sensitive values to a helm chart (in my case I have a map of usernames to passwords I'm trying to pass). |
aren't u able to populate it as strings base64 ? |
I hit an issue with the golang spec if my value itself has a comma in it. locals {
tokens = [
"trusted_cluster:aaaa",
# orig value that works in helm `values` but shows up as sensitive if aaaa is token
"proxy,db,kube,app,node:aaaa",
# single quoted, fails to deploy
#"'proxy,db,kube,app,node':aaaa",
# escaped double quotes, fails to deploy
#"\"proxy,db,kube,app,node\":aaaa",
# tried escaping commas, fails to plan
#"proxy\,db\,kube\,app\,node:aaaa",
]
}
resource "helm_release" "default" {
# ...
set {
name = "tokens"
value = "{${local.tokens}}"
}
} Which results in this incorrect value + set {
+ name = "tokens"
+ type = "auto"
+ value = "{proxy,db,kube,app,node:aaaa,trusted_cluster:aaaa}"
} Not sure how to test this out in the golang playground. How does one insert a list item containing a comma in this format without it breaking? |
Nevermind. I got it to work by using double backslashes per comma. locals {
tokens = [
"trusted_cluster:aaaa",
"proxy\\,db\\,kube\\,app\\,node:aaaa",
]
} |
This is an example how you would add an ingress host: Given a server:
dev:
enabled: true
image:
repository: "vault"
tag: "1.9.3"
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
hosts:
- host: sampledomain.example.org We will:
resource "helm_release" "vault" {
name = "myreleasename"
create_namespace = true
namespace = "mynamespace"
repository = "https://helm.releases.hashicorp.com"
chart = "vault"
version = "0.9.1"
values = [
file("${path.module}/values.yaml"),
]
# overwrite first host
set {
name = "server.ingress.hosts[0].host"
value = "overwrittendomain.example.org"
}
# add another host
set {
name = "server.ingress.hosts[1].host"
value = "additionaldomain.example.org"
}
} Result yaml: spec:
rules:
- host: "overwrittendomain.example.org"
http:
paths:
....
- host: "additionaldomain.example.org"
http:
paths:
.... |
Thanks @weitzjdevk for your example, it helped me to solve another problem I was having installing and configuring istio in AKS. I was having trouble passing different values to the same value, but doing it a little differently worked!!! I didn't need to create a values.yaml file in my use case.
My Terraform version is 1.1.5 |
It would be nice if the set command could take a list as an input parameter and turn it into a list in configuration EX
set {
name = "controller.service.loadBalancerSourceRanges"
value = ["${var.internal_ip_addr_cidrs}"]
}
should turn into
loadBalancerSourceRanges:
This doesn't solve the problem when you need to build more complex lists though
The text was updated successfully, but these errors were encountered: