Use a map as a block

Hi there,

I’m trying to find a way to use a variable as a block.

I’m working on an OpsWorks module for my organization and I’m stuck with the custom_cookbooks_source block of aws_opsworks_stack.

My idea goes like this.

resource "aws_opsworks_stack" "stack" {
  custom_cookbooks_source {
      >>>> dump my map variable somehow

The reason why I wanna do that is that I would like to be able to pass a map variable to my module and use it as key = val in my block.

Since I don’t know if it’s going to git or something else, user/pass or ssh key… I don’t know how to deal with this.

Any idea?


The docs aren’t great for that attribute. If you look at the go code for the resource you can see what it expects:

resource "aws_opsworks_stack" "stack" {
    custom_cookbooks_source {[
        type": "required string",
        url: "required string",
        username: "optional string",
        password: "optional string",
        revision: "optional string",
        ssh_key: "optional string,

Hopefully this helps you.