Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

terraform for loop json

locals {
    json_files = fileset("../ses_templates/*.JSON")   
    json_data  = [ for f in local.json_files : jsondecode(file("${path.module}/${f}")) ]  
}

resource "aws_ses_template" "template" {
    for_each = { for f in local.json_data : f.name => f }
    name     = each.value.name
    subject  = each.value.subject
    html     = each.value.html
    text     = each.value.text
}
Source by www.reddit.com #
 
PREVIOUS NEXT
Tagged: #terraform #loop #json
ADD COMMENT
Topic
Name
5+9 =