Skip to content

Resource: awsDbOptionGroup

Provides an RDS DB option group resource. Documentation of the available options for various RDS engines can be found at:

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dbOptionGroup.DbOptionGroup(this, "example", {
  engineName: "sqlserver-ee",
  majorEngineVersion: "11.00",
  name: "option-group-test-terraform",
  option: [
    {
      optionName: "Timezone",
      optionSettings: [
        {
          name: "TIME_ZONE",
          value: "UTC",
        },
      ],
    },
    {
      optionName: "SQLSERVER_BACKUP_RESTORE",
      optionSettings: [
        {
          name: "IAM_ROLE_ARN",
          value: "${aws_iam_role.example.arn}",
        },
      ],
    },
    {
      optionName: "TDE",
    },
  ],
  optionGroupDescription: "Terraform Option Group",
});

\~> Note: Any modifications to the awsDbOptionGroup are set to happen immediately as we default to applying immediately.

\~> WARNING: You can perform a destroy on a awsDbOptionGroup, as long as it is not associated with any Amazon RDS resource. An option group can be associated with a DB instance, a manual DB snapshot, or an automated DB snapshot.

If you try to delete an option group that is associated with an Amazon RDS resource, an error similar to the following is returned:

An error occurred (InvalidOptionGroupStateFault) when calling the DeleteOptionGroup operation: The option group 'optionGroupName' cannot be deleted because it is in use.

More information about this can be found here.

Argument Reference

The following arguments are supported:

  • name - (Optional, Forces new resource) The name of the option group. If omitted, Terraform will assign a random, unique name. Must be lowercase, to match as it is stored in AWS.
  • namePrefix - (Optional, Forces new resource) Creates a unique name beginning with the specified prefix. Conflicts with name. Must be lowercase, to match as it is stored in AWS.
  • optionGroupDescription - (Optional) The description of the option group. Defaults to "Managed by Terraform".
  • engineName - (Required) Specifies the name of the engine that this option group should be associated with.
  • majorEngineVersion - (Required) Specifies the major version of the engine that this option group should be associated with.
  • option - (Optional) A list of Options to apply.
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Option blocks support the following:

  • optionName - (Required) The Name of the Option (e.g., MEMCACHED).
  • optionSettings - (Optional) A list of option settings to apply.
  • port - (Optional) The Port number when connecting to the Option (e.g., 11211).
  • version - (Optional) The version of the option (e.g., 13.1.0.0).
  • dbSecurityGroupMemberships - (Optional) A list of DB Security Groups for which the option is enabled.
  • vpcSecurityGroupMemberships - (Optional) A list of VPC Security Groups for which the option is enabled.

Option Settings blocks support the following:

  • name - (Optional) The Name of the setting.
  • value - (Optional) The Value of the setting.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The db option group name.
  • arn - The ARN of the db option group.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Timeouts

Configuration options:

  • delete - (Default 15M)

Import

DB Option groups can be imported using the name, e.g.,

$ terraform import aws_db_option_group.example mysql-option-group