0

I'm trying to find directions on how to do a pretty simple thing in HCL. I have one block like this

resource "aws_elastic_beanstalk_environment" "qa" {
    name "qa1"
    #insert settings here        
}

And I want to insert a collection of settings where that comment is. But the config is not an array it should be something like

desired_block "settings" {
    setting {}
    setting {}
}

How would I inject something like desired block?

Vít Kotačka
  • 1,472
  • 1
  • 15
  • 40
4m1r
  • 12,234
  • 9
  • 46
  • 58
  • Unfortunately, HCL can't do that. You'd have to write some sort of wrapper that has the smarts to put the `*.tf` HCL together. – KJH Nov 21 '18 at 01:35

1 Answers1

1

Instead of creating multiple blocks you can put an array of settings and It would work. Like

resource "aws_elastic_beanstalk_environment" "qa" {
    name = "qa1"
    settings = ["${var.settings_array}"]
}

Here var.settings_array is an array of settings, like [<settings1>, <settings2>, ...].

Ram
  • 541
  • 2
  • 14