Terraform: How to add multiple option_settings to option, in option group?

Viewed 33

I'm trying to create an option group that requires an option with option settings that add multiple values.

See the following, scrubbed for sensitivity:

option {
    option_name = "VALID_OPTION_NAME"
    option_settings = [
      {
        name  = "foobar1"
        value = "foobar1"
      },
      {
        name  = "foobar2"
        value = "foobar2"
      },
      {
        name  = "foobar3"
        value = "foobar3"
      },
      {
        name  = "foobar4"
        value = "foobar4"
      },
      {
        name  = "foobar5"
        value = "foobar5"
      }
    ]
  }

terraform validate gives the following error:

[0m  on rds.tf line 112, in resource "aws_db_option_group" "rds-option-group":
 112:     [4moption_settings[0m = [
[0m
An argument named "option_settings" is not expected here. Did you mean to
define a block of type "option_settings"?

I've tried numerous variations of this syntax to no avail. AWS in the GUI has the option by default to include multiple option settings, so there should be a way to do it in Terraform as well.

The Option Group docs for Terraform unfortunately don't include an example where one option has multiple settings.

Among other things, I also checked out this thread which didn't help me, I believe because I'm not using that module.

Any recommendations?


Answer, for any future viewers:

option {
    option_name = "xx"
    option_settings {
      name  = "xx"
      value = "xx"
    }
    option_settings {
      name  = "xx"
      value = "xx"
    }
    option_settings {
      name  = "xx"
      value = "xx"
    }
    option_settings {
      name  = "xx"
      value = "xx"
    }
  }
0 Answers
Related