Resource: aws_db_option_group

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

Example Usage

resource "aws_db_option_group" "example" {
  name                     = "option-group-test-terraform"
  option_group_description = "Terraform Option Group"
  engine_name              = "sqlserver-ee"
  major_engine_version     = "11.00"

  option {
    option_name = "Timezone"

    option_settings {
      name  = "TIME_ZONE"
      value = "UTC"
    }
  }

  option {
    option_name = "SQLSERVER_BACKUP_RESTORE"

    option_settings {
      name  = "IAM_ROLE_ARN"
      value = aws_iam_role.example.arn
    }
  }

  option {
    option_name = "TDE"
  }
}

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

This resource supports the following arguments:

option Block

The option blocks support the following arguments:

option_settings Block

The option_settings blocks support the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Timeouts

Configuration options:

Import

In Terraform v1.5.0 and later, use an import block to import DB option groups using the name. For example:

import {
  to = aws_db_option_group.example
  id = "mysql-option-group"
}

Using terraform import, import DB option groups using the name. For example:

% terraform import aws_db_option_group.example mysql-option-group