Skip to content

Commit

Permalink
Use type for variables (#25)
Browse files Browse the repository at this point in the history
When working with Terragrunt we encountered an issue with variables that have no type set and are being used in a for-each loop. 

See here for the error:

│ Error: Invalid dynamic for_each value
│ 
│   on main.tf line 27, in resource "helm_release" "cert_manager":
│   27:     for_each = var.additional_set
│     ├────────────────
│     │ var.additional_set is "{\"serviceAccount\":{\"name\":\"serviceAccount.annotations.eks\\\\.amazonaws\\\\.com/role-arn\",\"value\":\"arn:aws:iam::XXXXXXX:role/some-role\"}}"
│ 
│ Cannot use a string value in for_each. An iterable collection is required.
  • Loading branch information
tobimichael96 authored Oct 5, 2023
1 parent ad0c203 commit 5a43408
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ variable "cluster_issuer_yaml" {
}

variable "additional_set" {
type = list(any)
description = "Additional sets to Helm"
default = []
}

variable "solvers" {
description = "List of Cert manager solvers. For a complex example please look at the Readme"
type = any
type = list(any)
default = [{
http01 = {
ingress = {
Expand Down

0 comments on commit 5a43408

Please sign in to comment.