From 9fa95207a0cc2f6253ac9c539f815e1e2ec27878 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Tue, 2 May 2023 11:15:35 -0400 Subject: [PATCH 1/5] rds/cluster: engine becomes required --- internal/service/rds/cluster.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/service/rds/cluster.go b/internal/service/rds/cluster.go index 08c69671df3..97996cdad98 100644 --- a/internal/service/rds/cluster.go +++ b/internal/service/rds/cluster.go @@ -174,9 +174,8 @@ func ResourceCluster() *schema.Resource { }, "engine": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, - Default: ClusterEngineAurora, ValidateFunc: validClusterEngine(), }, "engine_mode": { From 6a8cd3022c37a256e185e36cdb2e77986a74d994 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Tue, 2 May 2023 11:26:55 -0400 Subject: [PATCH 2/5] Add changelog, update docs --- .changelog/31112.txt | 7 +++++++ website/docs/r/rds_cluster.html.markdown | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changelog/31112.txt diff --git a/.changelog/31112.txt b/.changelog/31112.txt new file mode 100644 index 00000000000..ac4081490dc --- /dev/null +++ b/.changelog/31112.txt @@ -0,0 +1,7 @@ +```release-note:breaking-change +resource/aws_rds_cluster: The `engine` argument is now required and has no default +``` + +```release-note:note +data-source/aws_rds_cluster: Configurations not including the `engine` argument must be updated to include the specific engine you want. Previously, not including `engine` was equivalent to `engine = "aurora"` and created a MySQL-5.6-compatible cluster +``` \ No newline at end of file diff --git a/website/docs/r/rds_cluster.html.markdown b/website/docs/r/rds_cluster.html.markdown index 35907deeeb9..54a462bc193 100644 --- a/website/docs/r/rds_cluster.html.markdown +++ b/website/docs/r/rds_cluster.html.markdown @@ -235,7 +235,7 @@ The following arguments are supported: * `deletion_protection` - (Optional) If the DB instance should have deletion protection enabled. The database can't be deleted when this value is set to `true`. The default is `false`. * `enable_http_endpoint` - (Optional) Enable HTTP endpoint (data API). Only valid when `engine_mode` is set to `serverless`. * `enabled_cloudwatch_logs_exports` - (Optional) Set of log types to export to cloudwatch. If omitted, no logs will be exported. The following log types are supported: `audit`, `error`, `general`, `slowquery`, `postgresql` (PostgreSQL). -* `engine` - (Optional) The name of the database engine to be used for this DB cluster. Defaults to `aurora`. Valid Values: `aurora`, `aurora-mysql`, `aurora-postgresql`, `mysql`, `postgres`. (Note that `mysql` and `postgres` are Multi-AZ RDS clusters). +* `engine` - (Required) Name of the database engine to be used for this DB cluster. Valid Values: `aurora`, `aurora-mysql`, `aurora-postgresql`, `mysql`, `postgres`. (Note that `mysql` and `postgres` are Multi-AZ RDS clusters). * `engine_mode` - (Optional) The database engine mode. Valid values: `global` (only valid for Aurora MySQL 1.21 and earlier), `multimaster`, `parallelquery`, `provisioned`, `serverless`. Defaults to: `provisioned`. See the [RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/aurora-serverless.html) for limitations when using `serverless`. * `engine_version` - (Optional) The database engine version. Updating this argument results in an outage. See the [Aurora MySQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Updates.html) and [Aurora Postgres](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Updates.html) documentation for your configured engine to determine this value, or by running `aws rds describe-db-engine-versions`. For example with Aurora MySQL 2, a potential value for this argument is `5.7.mysql_aurora.2.03.2`. The value can contain a partial version where supported by the API. The actual engine version used is returned in the attribute `engine_version_actual`, , see [Attributes Reference](#attributes-reference) below. * `db_cluster_instance_class` - (Optional) The compute and memory capacity of each DB instance in the Multi-AZ DB cluster, for example db.m6g.xlarge. Not all DB instance classes are available in all AWS Regions, or for all database engines. For the full list of DB instance classes and availability for your engine, see [DB instance class](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html) in the Amazon RDS User Guide. (This setting is required to create a Multi-AZ DB cluster). From 116564bfb926bbfef854b877af0a0c1f1acf181d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Wed, 3 May 2023 10:47:33 -0400 Subject: [PATCH 3/5] Update cluster instance --- internal/service/rds/cluster_instance.go | 3 +- internal/service/rds/cluster_instance_test.go | 415 ++++++------------ internal/service/rds/consts.go | 2 - 3 files changed, 127 insertions(+), 293 deletions(-) diff --git a/internal/service/rds/cluster_instance.go b/internal/service/rds/cluster_instance.go index 4db8568f8f8..3279cf06608 100644 --- a/internal/service/rds/cluster_instance.go +++ b/internal/service/rds/cluster_instance.go @@ -99,9 +99,8 @@ func ResourceClusterInstance() *schema.Resource { }, "engine": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, - Default: ClusterEngineAurora, ValidateFunc: validClusterEngine(), }, "engine_version": { diff --git a/internal/service/rds/cluster_instance_test.go b/internal/service/rds/cluster_instance_test.go index 83458b96fe9..f3548329e92 100644 --- a/internal/service/rds/cluster_instance_test.go +++ b/internal/service/rds/cluster_instance_test.go @@ -45,7 +45,7 @@ func TestAccRDSClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "cluster_identifier", rName), resource.TestCheckResourceAttr(resourceName, "copy_tags_to_snapshot", "false"), resource.TestCheckResourceAttrSet(resourceName, "dbi_resource_id"), - resource.TestCheckResourceAttr(resourceName, "engine", "aurora"), + resource.TestCheckResourceAttr(resourceName, "engine", "aurora-mysql"), resource.TestCheckResourceAttrSet(resourceName, "engine_version"), resource.TestCheckResourceAttr(resourceName, "network_type", "IPV4"), resource.TestCheckResourceAttrSet(resourceName, "preferred_backup_window"), @@ -669,7 +669,7 @@ func TestAccRDSClusterInstance_PerformanceInsightsEnabled_auroraMySQL1(t *testin var v rds.DBInstance resourceName := "aws_rds_cluster_instance.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - engine := "aurora" + engine := "aurora-mysql" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t); testAccPerformanceInsightsDefaultVersionPreCheck(ctx, t, engine) }, @@ -697,44 +697,6 @@ func TestAccRDSClusterInstance_PerformanceInsightsEnabled_auroraMySQL1(t *testin }) } -func TestAccRDSClusterInstance_PerformanceInsightsEnabled_auroraMySQL2(t *testing.T) { - ctx := acctest.Context(t) - if testing.Short() { - t.Skip("skipping long-running test in short mode") - } - - var v rds.DBInstance - resourceName := "aws_rds_cluster_instance.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - engine := "aurora-mysql" - engineVersion := "5.7.mysql_aurora.2.04.2" - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(ctx, t); testAccPerformanceInsightsPreCheck(ctx, t, engine, engineVersion) }, - ErrorCheck: acctest.ErrorCheck(t, rds.EndpointsID), - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckClusterInstanceDestroy(ctx), - Steps: []resource.TestStep{ - { - Config: testAccClusterInstanceConfig_performanceInsightsEnabledAuroraMySQL2(rName, engine, engineVersion), - Check: resource.ComposeTestCheckFunc( - testAccCheckClusterInstanceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "performance_insights_enabled", "true"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{ - "apply_immediately", - "identifier_prefix", - }, - }, - }, - }) -} - func TestAccRDSClusterInstance_PerformanceInsightsEnabled_auroraPostgresql(t *testing.T) { ctx := acctest.Context(t) if testing.Short() { @@ -782,7 +744,7 @@ func TestAccRDSClusterInstance_PerformanceInsightsKMSKeyID_auroraMySQL1(t *testi kmsKeyResourceName := "aws_kms_key.test" resourceName := "aws_rds_cluster_instance.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - engine := "aurora" + engine := "aurora-mysql" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t); testAccPerformanceInsightsDefaultVersionPreCheck(ctx, t, engine) }, @@ -820,7 +782,7 @@ func TestAccRDSClusterInstance_PerformanceInsightsKMSKeyIDAuroraMySQL1_defaultKe var v rds.DBInstance resourceName := "aws_rds_cluster_instance.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - engine := "aurora" + engine := "aurora-mysql" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t); testAccPerformanceInsightsDefaultVersionPreCheck(ctx, t, engine) }, @@ -852,88 +814,6 @@ func TestAccRDSClusterInstance_PerformanceInsightsKMSKeyIDAuroraMySQL1_defaultKe }) } -func TestAccRDSClusterInstance_PerformanceInsightsKMSKeyID_auroraMySQL2(t *testing.T) { - ctx := acctest.Context(t) - if testing.Short() { - t.Skip("skipping long-running test in short mode") - } - - var v rds.DBInstance - kmsKeyResourceName := "aws_kms_key.test" - resourceName := "aws_rds_cluster_instance.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - engine := "aurora-mysql" - engineVersion := "5.7.mysql_aurora.2.04.2" - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(ctx, t); testAccPerformanceInsightsPreCheck(ctx, t, engine, engineVersion) }, - ErrorCheck: acctest.ErrorCheck(t, rds.EndpointsID), - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckClusterInstanceDestroy(ctx), - Steps: []resource.TestStep{ - { - Config: testAccClusterInstanceConfig_performanceInsightsKMSKeyIDAuroraMySQL2(rName, engine, engineVersion), - Check: resource.ComposeTestCheckFunc( - testAccCheckClusterInstanceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "performance_insights_enabled", "true"), - resource.TestCheckResourceAttrPair(resourceName, "performance_insights_kms_key_id", kmsKeyResourceName, "arn"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{ - "apply_immediately", - "identifier_prefix", - }, - }, - }, - }) -} - -func TestAccRDSClusterInstance_PerformanceInsightsKMSKeyIDAuroraMySQL2_defaultKeyToCustomKey(t *testing.T) { - ctx := acctest.Context(t) - if testing.Short() { - t.Skip("skipping long-running test in short mode") - } - - var v rds.DBInstance - resourceName := "aws_rds_cluster_instance.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - engine := "aurora-mysql" - engineVersion := "5.7.mysql_aurora.2.04.2" - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(ctx, t); testAccPerformanceInsightsPreCheck(ctx, t, engine, engineVersion) }, - ErrorCheck: acctest.ErrorCheck(t, rds.EndpointsID), - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckClusterInstanceDestroy(ctx), - Steps: []resource.TestStep{ - { - Config: testAccClusterInstanceConfig_performanceInsightsEnabledAuroraMySQL2(rName, engine, engineVersion), - Check: resource.ComposeTestCheckFunc( - testAccCheckClusterInstanceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "performance_insights_enabled", "true"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{ - "apply_immediately", - "identifier_prefix", - }, - }, - { - Config: testAccClusterInstanceConfig_performanceInsightsKMSKeyIDAuroraMySQL2(rName, engine, engineVersion), - ExpectError: regexp.MustCompile(`InvalidParameterCombination: You .* change your Performance Insights KMS key`), - }, - }, - }) -} - func TestAccRDSClusterInstance_performanceInsightsRetentionPeriod(t *testing.T) { ctx := acctest.Context(t) if testing.Short() { @@ -945,7 +825,10 @@ func TestAccRDSClusterInstance_performanceInsightsRetentionPeriod(t *testing.T) rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(ctx, t); testAccPerformanceInsightsDefaultVersionPreCheck(ctx, t, "aurora") }, + PreCheck: func() { + acctest.PreCheck(ctx, t) + testAccPerformanceInsightsDefaultVersionPreCheck(ctx, t, "aurora-mysql") + }, ErrorCheck: acctest.ErrorCheck(t, rds.EndpointsID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, CheckDestroy: testAccCheckClusterDestroy(ctx), @@ -1173,33 +1056,62 @@ func testAccCheckClusterInstanceDestroy(ctx context.Context) resource.TestCheckF } } -func testAccClusterInstanceConfig_base(rName string) string { - return acctest.ConfigCompose(acctest.ConfigAvailableAZsNoOptIn(), fmt.Sprintf(` +func testAccClusterInstanceConfig_orderableEngineBase(engine string, performanceInsights bool) string { + if performanceInsights { + return fmt.Sprintf(` +data "aws_rds_engine_version" "default" { + engine = %[1]q +} + +data "aws_rds_orderable_db_instance" "test" { + engine = aws_rds_cluster.test.engine + engine_version = aws_rds_cluster.test.engine_version + supports_performance_insights = true + preferred_instance_classes = ["db.t3.medium", "db.r5.large", "db.r4.large"] +} +`, engine) + } + + return fmt.Sprintf(` +data "aws_rds_engine_version" "default" { + engine = %[1]q +} + data "aws_rds_orderable_db_instance" "test" { - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version + engine = data.aws_rds_engine_version.default.engine + engine_version = data.aws_rds_engine_version.default.version preferred_instance_classes = ["db.t3.small", "db.t2.small", "db.t3.medium"] } +`, engine) +} +func testAccClusterInstanceConfig_base(rName, engine string) string { + return acctest.ConfigCompose( + acctest.ConfigAvailableAZsNoOptIn(), + testAccClusterInstanceConfig_orderableEngineBase(engine, false), + fmt.Sprintf(` resource "aws_rds_cluster" "test" { - cluster_identifier = %[1]q + cluster_identifier = %[2]q availability_zones = [ data.aws_availability_zones.available.names[0], data.aws_availability_zones.available.names[1], data.aws_availability_zones.available.names[2] ] + engine = data.aws_rds_engine_version.default.engine + engine_version = data.aws_rds_engine_version.default.version database_name = "mydb" master_username = "foo" master_password = "mustbeeightcharacters" skip_final_snapshot = true } -`, rName)) +`, engine, rName)) } func testAccClusterInstanceConfig_basic(rName string) string { - return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName), fmt.Sprintf(` + return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName, "aurora-mysql"), fmt.Sprintf(` resource "aws_rds_cluster_instance" "test" { identifier = %[1]q + engine = data.aws_rds_engine_version.default.engine cluster_identifier = aws_rds_cluster.test.id instance_class = data.aws_rds_orderable_db_instance.test.instance_class db_parameter_group_name = aws_db_parameter_group.test.name @@ -1208,7 +1120,7 @@ resource "aws_rds_cluster_instance" "test" { resource "aws_db_parameter_group" "test" { name = %[1]q - family = "aurora5.6" + family = data.aws_rds_engine_version.default.parameter_group_family parameter { name = "back_log" @@ -1220,9 +1132,10 @@ resource "aws_db_parameter_group" "test" { } func testAccClusterInstanceConfig_modified(rName string) string { - return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName), fmt.Sprintf(` + return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName, "aurora-mysql"), fmt.Sprintf(` resource "aws_rds_cluster_instance" "test" { identifier = %[1]q + engine = data.aws_rds_engine_version.default.engine cluster_identifier = aws_rds_cluster.test.id instance_class = data.aws_rds_orderable_db_instance.test.instance_class db_parameter_group_name = aws_db_parameter_group.test.name @@ -1232,7 +1145,7 @@ resource "aws_rds_cluster_instance" "test" { resource "aws_db_parameter_group" "test" { name = %[1]q - family = "aurora5.6" + family = data.aws_rds_engine_version.default.parameter_group_family parameter { name = "back_log" @@ -1244,9 +1157,10 @@ resource "aws_db_parameter_group" "test" { } func testAccClusterInstanceConfig_tags1(rName, tagKey1, tagValue1 string) string { - return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName), fmt.Sprintf(` + return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName, "aurora-mysql"), fmt.Sprintf(` resource "aws_rds_cluster_instance" "test" { identifier = %[1]q + engine = data.aws_rds_engine_version.default.engine cluster_identifier = aws_rds_cluster.test.id instance_class = data.aws_rds_orderable_db_instance.test.instance_class db_parameter_group_name = aws_db_parameter_group.test.name @@ -1259,7 +1173,7 @@ resource "aws_rds_cluster_instance" "test" { resource "aws_db_parameter_group" "test" { name = %[1]q - family = "aurora5.6" + family = data.aws_rds_engine_version.default.parameter_group_family parameter { name = "back_log" @@ -1271,9 +1185,10 @@ resource "aws_db_parameter_group" "test" { } func testAccClusterInstanceConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { - return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName), fmt.Sprintf(` + return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName, "aurora-mysql"), fmt.Sprintf(` resource "aws_rds_cluster_instance" "test" { identifier = %[1]q + engine = data.aws_rds_engine_version.default.engine cluster_identifier = aws_rds_cluster.test.id instance_class = data.aws_rds_orderable_db_instance.test.instance_class db_parameter_group_name = aws_db_parameter_group.test.name @@ -1287,7 +1202,7 @@ resource "aws_rds_cluster_instance" "test" { resource "aws_db_parameter_group" "test" { name = %[1]q - family = "aurora5.6" + family = data.aws_rds_engine_version.default.parameter_group_family parameter { name = "back_log" @@ -1299,9 +1214,10 @@ resource "aws_db_parameter_group" "test" { } func testAccClusterInstanceConfig_az(rName string) string { - return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName), fmt.Sprintf(` + return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName, "aurora-mysql"), fmt.Sprintf(` resource "aws_rds_cluster_instance" "test" { identifier = %[1]q + engine = data.aws_rds_engine_version.default.engine cluster_identifier = aws_rds_cluster.test.id instance_class = data.aws_rds_orderable_db_instance.test.instance_class db_parameter_group_name = aws_db_parameter_group.test.name @@ -1311,7 +1227,7 @@ resource "aws_rds_cluster_instance" "test" { resource "aws_db_parameter_group" "test" { name = %[1]q - family = "aurora5.6" + family = data.aws_rds_engine_version.default.parameter_group_family parameter { name = "back_log" @@ -1323,23 +1239,23 @@ resource "aws_db_parameter_group" "test" { } func testAccClusterInstanceConfig_identifierPrefix(rName, identifierPrefix string) string { - return acctest.ConfigCompose(acctest.ConfigVPCWithSubnets(rName, 2), fmt.Sprintf(` -data "aws_rds_orderable_db_instance" "test" { - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version - preferred_instance_classes = ["db.t3.small", "db.t2.small", "db.t3.medium"] -} - + return acctest.ConfigCompose( + acctest.ConfigVPCWithSubnets(rName, 2), + testAccClusterInstanceConfig_orderableEngineBase("aurora-mysql", false), + fmt.Sprintf(` resource "aws_rds_cluster" "test" { cluster_identifier = %[1]q - master_username = "root" - master_password = "password" db_subnet_group_name = aws_db_subnet_group.test.name + engine = data.aws_rds_engine_version.default.engine + engine_version = data.aws_rds_engine_version.default.version + master_password = "password" + master_username = "root" skip_final_snapshot = true } resource "aws_rds_cluster_instance" "test" { identifier_prefix = %[2]q + engine = data.aws_rds_engine_version.default.engine cluster_identifier = aws_rds_cluster.test.id instance_class = data.aws_rds_orderable_db_instance.test.instance_class } @@ -1352,23 +1268,23 @@ resource "aws_db_subnet_group" "test" { } func testAccClusterInstanceConfig_identifierGenerated(rName string) string { - return acctest.ConfigCompose(acctest.ConfigVPCWithSubnets(rName, 2), fmt.Sprintf(` -data "aws_rds_orderable_db_instance" "test" { - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version - preferred_instance_classes = ["db.t3.small", "db.t2.small", "db.t3.medium"] -} - + return acctest.ConfigCompose( + acctest.ConfigVPCWithSubnets(rName, 2), + testAccClusterInstanceConfig_orderableEngineBase("aurora-mysql", false), + fmt.Sprintf(` resource "aws_rds_cluster" "test" { cluster_identifier = %[1]q master_username = "root" master_password = "password" db_subnet_group_name = aws_db_subnet_group.test.name skip_final_snapshot = true + engine = data.aws_rds_engine_version.default.engine + engine_version = data.aws_rds_engine_version.default.version } resource "aws_rds_cluster_instance" "test" { cluster_identifier = aws_rds_cluster.test.id + engine = data.aws_rds_engine_version.default.engine instance_class = data.aws_rds_orderable_db_instance.test.instance_class } @@ -1380,7 +1296,10 @@ resource "aws_db_subnet_group" "test" { } func testAccClusterInstanceConfig_kmsKey(rName string) string { - return acctest.ConfigCompose(acctest.ConfigAvailableAZsNoOptIn(), fmt.Sprintf(` + return acctest.ConfigCompose( + acctest.ConfigAvailableAZsNoOptIn(), + testAccClusterInstanceConfig_orderableEngineBase("aurora-mysql", false), + fmt.Sprintf(` resource "aws_kms_key" "test" { description = %[1]q @@ -1411,6 +1330,8 @@ resource "aws_rds_cluster" "test" { data.aws_availability_zones.available.names[2] ] database_name = "mydb" + engine = data.aws_rds_engine_version.default.engine + engine_version = data.aws_rds_engine_version.default.version master_username = "foo" master_password = "mustbeeightcharacters" storage_encrypted = true @@ -1418,22 +1339,17 @@ resource "aws_rds_cluster" "test" { skip_final_snapshot = true } -data "aws_rds_orderable_db_instance" "test" { - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version - preferred_instance_classes = ["db.t3.small", "db.t2.small", "db.t3.medium"] -} - resource "aws_rds_cluster_instance" "test" { identifier = %[1]q cluster_identifier = aws_rds_cluster.test.id instance_class = data.aws_rds_orderable_db_instance.test.instance_class db_parameter_group_name = aws_db_parameter_group.test.name + engine = data.aws_rds_engine_version.default.engine } resource "aws_db_parameter_group" "test" { name = %[1]q - family = "aurora5.6" + family = data.aws_rds_engine_version.default.parameter_group_family parameter { name = "back_log" @@ -1445,9 +1361,10 @@ resource "aws_db_parameter_group" "test" { } func testAccClusterInstanceConfig_publiclyAccessible(rName string, publiclyAccessible bool) string { - return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName), fmt.Sprintf(` + return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName, "aurora-mysql"), fmt.Sprintf(` resource "aws_rds_cluster_instance" "test" { apply_immediately = true + engine = data.aws_rds_engine_version.default.engine cluster_identifier = aws_rds_cluster.test.id identifier = %[1]q instance_class = data.aws_rds_orderable_db_instance.test.instance_class @@ -1457,9 +1374,10 @@ resource "aws_rds_cluster_instance" "test" { } func testAccClusterInstanceConfig_copyTagsToSnapshot(rName string, copy bool) string { - return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName), fmt.Sprintf(` + return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName, "aurora-mysql"), fmt.Sprintf(` resource "aws_rds_cluster_instance" "test" { identifier = %[1]q + engine = data.aws_rds_engine_version.default.engine cluster_identifier = aws_rds_cluster.test.id instance_class = data.aws_rds_orderable_db_instance.test.instance_class promotion_tier = "3" @@ -1469,7 +1387,7 @@ resource "aws_rds_cluster_instance" "test" { } func testAccClusterInstanceConfig_caCertificateID(rName string) string { - return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName), fmt.Sprintf(` + return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName, "aurora-mysql"), fmt.Sprintf(` data "aws_rds_certificate" "latest" { latest_valid_till = true } @@ -1477,6 +1395,7 @@ data "aws_rds_certificate" "latest" { resource "aws_rds_cluster_instance" "test" { apply_immediately = true cluster_identifier = aws_rds_cluster.test.id + engine = data.aws_rds_engine_version.default.engine identifier = %[1]q instance_class = data.aws_rds_orderable_db_instance.test.instance_class ca_cert_identifier = data.aws_rds_certificate.latest.id @@ -1485,7 +1404,7 @@ resource "aws_rds_cluster_instance" "test" { } func testAccClusterInstanceConfig_monitoringInterval(rName string, monitoringInterval int) string { - return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName), fmt.Sprintf(` + return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName, "aurora-mysql"), fmt.Sprintf(` data "aws_partition" "current" {} resource "aws_iam_role" "test" { @@ -1517,6 +1436,7 @@ resource "aws_rds_cluster_instance" "test" { depends_on = [aws_iam_role_policy_attachment.test] cluster_identifier = aws_rds_cluster.test.id + engine = data.aws_rds_engine_version.default.engine identifier = %[1]q instance_class = data.aws_rds_orderable_db_instance.test.instance_class monitoring_interval = %[2]d @@ -1526,9 +1446,10 @@ resource "aws_rds_cluster_instance" "test" { } func testAccClusterInstanceConfig_monitoringRoleARNRemoved(rName string) string { - return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName), fmt.Sprintf(` + return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName, "aurora-mysql"), fmt.Sprintf(` resource "aws_rds_cluster_instance" "test" { cluster_identifier = aws_rds_cluster.test.id + engine = data.aws_rds_engine_version.default.engine identifier = %[1]q instance_class = data.aws_rds_orderable_db_instance.test.instance_class } @@ -1536,7 +1457,7 @@ resource "aws_rds_cluster_instance" "test" { } func testAccClusterInstanceConfig_monitoringRoleARN(rName string) string { - return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName), fmt.Sprintf(` + return acctest.ConfigCompose(testAccClusterInstanceConfig_base(rName, "aurora-mysql"), fmt.Sprintf(` data "aws_partition" "current" {} resource "aws_iam_role" "test" { @@ -1565,93 +1486,56 @@ resource "aws_iam_role_policy_attachment" "test" { } resource "aws_rds_cluster_instance" "test" { - depends_on = [aws_iam_role_policy_attachment.test] - + engine = data.aws_rds_engine_version.default.engine cluster_identifier = aws_rds_cluster.test.id identifier = %[1]q instance_class = data.aws_rds_orderable_db_instance.test.instance_class monitoring_interval = 5 monitoring_role_arn = aws_iam_role.test.arn + + depends_on = [aws_iam_role_policy_attachment.test] } `, rName)) } func testAccClusterInstanceConfig_performanceInsightsEnabledAuroraMySQL1(rName, engine string) string { - return fmt.Sprintf(` -resource "aws_rds_cluster" "test" { - cluster_identifier = %[1]q - database_name = "mydb" - engine = %[2]q - master_password = "mustbeeightcharacters" - master_username = "foo" - skip_final_snapshot = true -} - -data "aws_rds_orderable_db_instance" "test" { - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version - supports_performance_insights = true - preferred_instance_classes = ["db.t3.medium", "db.r5.large", "db.r4.large"] -} - -resource "aws_rds_cluster_instance" "test" { - cluster_identifier = aws_rds_cluster.test.id - engine = aws_rds_cluster.test.engine - identifier = %[1]q - instance_class = data.aws_rds_orderable_db_instance.test.instance_class - performance_insights_enabled = true -} -`, rName, engine) -} - -func testAccClusterInstanceConfig_performanceInsightsEnabledAuroraMySQL2(rName, engine, engineVersion string) string { - return fmt.Sprintf(` + return acctest.ConfigCompose( + testAccClusterInstanceConfig_orderableEngineBase(engine, true), + fmt.Sprintf(` resource "aws_rds_cluster" "test" { cluster_identifier = %[1]q database_name = "mydb" - engine = %[2]q - engine_version = %[3]q + engine = data.aws_rds_engine_version.default.engine + engine_version = data.aws_rds_engine_version.default.version master_password = "mustbeeightcharacters" master_username = "foo" skip_final_snapshot = true } -data "aws_rds_orderable_db_instance" "test" { - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version - supports_performance_insights = true - preferred_instance_classes = ["db.t3.medium", "db.r5.large", "db.r4.large"] -} - resource "aws_rds_cluster_instance" "test" { cluster_identifier = aws_rds_cluster.test.id - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version + engine = data.aws_rds_engine_version.default.engine identifier = %[1]q instance_class = data.aws_rds_orderable_db_instance.test.instance_class performance_insights_enabled = true } -`, rName, engine, engineVersion) +`, rName)) } func testAccClusterInstanceConfig_performanceInsightsEnabledAuroraPostgresql(rName, engine string) string { - return fmt.Sprintf(` + return acctest.ConfigCompose( + testAccClusterInstanceConfig_orderableEngineBase(engine, true), + fmt.Sprintf(` resource "aws_rds_cluster" "test" { cluster_identifier = %[1]q database_name = "mydb" - engine = %[2]q + engine = data.aws_rds_engine_version.default.engine + engine_version = data.aws_rds_engine_version.default.version master_password = "mustbeeightcharacters" master_username = "foo" skip_final_snapshot = true } -data "aws_rds_orderable_db_instance" "test" { - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version - supports_performance_insights = true - preferred_instance_classes = ["db.t3.medium", "db.r5.large", "db.r4.large"] -} - resource "aws_rds_cluster_instance" "test" { cluster_identifier = aws_rds_cluster.test.id engine = aws_rds_cluster.test.engine @@ -1659,11 +1543,13 @@ resource "aws_rds_cluster_instance" "test" { instance_class = data.aws_rds_orderable_db_instance.test.instance_class performance_insights_enabled = true } -`, rName, engine) +`, rName)) } func testAccClusterInstanceConfig_performanceInsightsKMSKeyIDAuroraMySQL1(rName, engine string) string { - return fmt.Sprintf(` + return acctest.ConfigCompose( + testAccClusterInstanceConfig_orderableEngineBase(engine, true), + fmt.Sprintf(` resource "aws_kms_key" "test" { deletion_window_in_days = 7 } @@ -1671,19 +1557,13 @@ resource "aws_kms_key" "test" { resource "aws_rds_cluster" "test" { cluster_identifier = %[1]q database_name = "mydb" - engine = %[2]q + engine = data.aws_rds_engine_version.default.engine + engine_version = data.aws_rds_engine_version.default.version master_password = "mustbeeightcharacters" master_username = "foo" skip_final_snapshot = true } -data "aws_rds_orderable_db_instance" "test" { - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version - supports_performance_insights = true - preferred_instance_classes = ["db.t3.medium", "db.r5.large", "db.r4.large"] -} - resource "aws_rds_cluster_instance" "test" { cluster_identifier = aws_rds_cluster.test.id engine = aws_rds_cluster.test.engine @@ -1692,46 +1572,13 @@ resource "aws_rds_cluster_instance" "test" { performance_insights_enabled = true performance_insights_kms_key_id = aws_kms_key.test.arn } -`, rName, engine) -} - -func testAccClusterInstanceConfig_performanceInsightsKMSKeyIDAuroraMySQL2(rName, engine, engineVersion string) string { - return fmt.Sprintf(` -resource "aws_kms_key" "test" { - deletion_window_in_days = 7 -} - -resource "aws_rds_cluster" "test" { - cluster_identifier = %[1]q - database_name = "mydb" - engine = %[2]q - engine_version = %[3]q - master_password = "mustbeeightcharacters" - master_username = "foo" - skip_final_snapshot = true -} - -data "aws_rds_orderable_db_instance" "test" { - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version - supports_performance_insights = true - preferred_instance_classes = ["db.t3.medium", "db.r5.large", "db.r4.large"] -} - -resource "aws_rds_cluster_instance" "test" { - cluster_identifier = aws_rds_cluster.test.id - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version - identifier = %[1]q - instance_class = data.aws_rds_orderable_db_instance.test.instance_class - performance_insights_enabled = true - performance_insights_kms_key_id = aws_kms_key.test.arn -} -`, rName, engine, engineVersion) +`, rName)) } func testAccClusterInstanceConfig_performanceInsightsKMSKeyIDAuroraPostgresql(rName, engine string) string { - return fmt.Sprintf(` + return acctest.ConfigCompose( + testAccClusterInstanceConfig_orderableEngineBase(engine, true), + fmt.Sprintf(` resource "aws_kms_key" "test" { deletion_window_in_days = 7 } @@ -1739,19 +1586,13 @@ resource "aws_kms_key" "test" { resource "aws_rds_cluster" "test" { cluster_identifier = %[1]q database_name = "mydb" - engine = %[2]q + engine = data.aws_rds_engine_version.default.engine + engine_version = data.aws_rds_engine_version.default.version master_password = "mustbeeightcharacters" master_username = "foo" skip_final_snapshot = true } -data "aws_rds_orderable_db_instance" "test" { - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version - supports_performance_insights = true - preferred_instance_classes = ["db.t3.medium", "db.r5.large", "db.r4.large"] -} - resource "aws_rds_cluster_instance" "test" { cluster_identifier = aws_rds_cluster.test.id engine = aws_rds_cluster.test.engine @@ -1760,27 +1601,23 @@ resource "aws_rds_cluster_instance" "test" { performance_insights_enabled = true performance_insights_kms_key_id = aws_kms_key.test.arn } -`, rName, engine) +`, rName)) } func testAccClusterInstanceConfig_performanceInsightsRetentionPeriod(rName string, performanceInsightsRetentionPeriod int) string { - return fmt.Sprintf(` + return acctest.ConfigCompose( + testAccClusterInstanceConfig_orderableEngineBase("aurora-mysql", true), + fmt.Sprintf(` resource "aws_rds_cluster" "test" { cluster_identifier = %[1]q database_name = "mydb" - engine = "aurora" + engine = data.aws_rds_engine_version.default.engine + engine_version = data.aws_rds_engine_version.default.version master_password = "mustbeeightcharacters" master_username = "foo" skip_final_snapshot = true } -data "aws_rds_orderable_db_instance" "test" { - engine = aws_rds_cluster.test.engine - engine_version = aws_rds_cluster.test.engine_version - supports_performance_insights = true - preferred_instance_classes = ["db.t3.medium", "db.r5.large", "db.r4.large"] -} - resource "aws_rds_cluster_instance" "test" { cluster_identifier = aws_rds_cluster.test.id engine = aws_rds_cluster.test.engine @@ -1789,5 +1626,5 @@ resource "aws_rds_cluster_instance" "test" { performance_insights_enabled = true performance_insights_retention_period = %[2]d } -`, rName, performanceInsightsRetentionPeriod) +`, rName, performanceInsightsRetentionPeriod)) } diff --git a/internal/service/rds/consts.go b/internal/service/rds/consts.go index ec1663363a4..e0775deb8cb 100644 --- a/internal/service/rds/consts.go +++ b/internal/service/rds/consts.go @@ -107,7 +107,6 @@ const ( ) const ( - ClusterEngineAurora = "aurora" ClusterEngineAuroraMySQL = "aurora-mysql" ClusterEngineAuroraPostgreSQL = "aurora-postgresql" ClusterEngineMySQL = "mysql" @@ -116,7 +115,6 @@ const ( func ClusterEngine_Values() []string { return []string{ - ClusterEngineAurora, ClusterEngineAuroraMySQL, ClusterEngineAuroraPostgreSQL, ClusterEngineMySQL, From f601406041b192ad06adbf43f5d6f80b4b731f34 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Wed, 3 May 2023 11:08:13 -0400 Subject: [PATCH 4/5] Update docs, changelog --- .changelog/31112.txt | 10 +- website/docs/r/rds_cluster.html.markdown | 96 +++++++++---------- .../docs/r/rds_cluster_instance.html.markdown | 56 +++++------ 3 files changed, 86 insertions(+), 76 deletions(-) diff --git a/.changelog/31112.txt b/.changelog/31112.txt index ac4081490dc..70c2393db94 100644 --- a/.changelog/31112.txt +++ b/.changelog/31112.txt @@ -3,5 +3,13 @@ resource/aws_rds_cluster: The `engine` argument is now required and has no defau ``` ```release-note:note -data-source/aws_rds_cluster: Configurations not including the `engine` argument must be updated to include the specific engine you want. Previously, not including `engine` was equivalent to `engine = "aurora"` and created a MySQL-5.6-compatible cluster +resource/aws_rds_cluster: Configurations not including the `engine` argument must be updated to include `engine` as it is now required. Previously, not including `engine` was equivalent to `engine = "aurora"` and created a MySQL-5.6-compatible cluster +``` + +```release-note:breaking-change +resource/aws_rds_cluster_instance: The `engine` argument is now required and has no default +``` + +```release-note:note +resource/aws_rds_cluster_instance: Configurations not including the `engine` argument must be updated to include `engine` as it is now required. Previously, not including `engine` was equivalent to `engine = "aurora"` and created a MySQL-5.6-compatible cluster instance ``` \ No newline at end of file diff --git a/website/docs/r/rds_cluster.html.markdown b/website/docs/r/rds_cluster.html.markdown index 54a462bc193..6ca852b5709 100644 --- a/website/docs/r/rds_cluster.html.markdown +++ b/website/docs/r/rds_cluster.html.markdown @@ -223,48 +223,48 @@ The following arguments are supported: * `allow_major_version_upgrade` - (Optional) Enable to allow major engine version upgrades when changing engine versions. Defaults to `false`. * `apply_immediately` - (Optional) Specifies whether any cluster modifications are applied immediately, or during the next maintenance window. Default is `false`. See [Amazon RDS Documentation for more information.](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html) * `availability_zones` - (Optional) List of EC2 Availability Zones for the DB cluster storage where DB cluster instances can be created. RDS automatically assigns 3 AZs if less than 3 AZs are configured, which will show as a difference requiring resource recreation next Terraform apply. We recommend specifying 3 AZs or using [the `lifecycle` configuration block `ignore_changes` argument](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) if necessary. A maximum of 3 AZs can be configured. -* `backtrack_window` - (Optional) The target backtrack window, in seconds. Only available for `aurora` and `aurora-mysql` engines currently. To disable backtracking, set this value to `0`. Defaults to `0`. Must be between `0` and `259200` (72 hours) -* `backup_retention_period` - (Optional) The days to retain backups for. Default `1` +* `backtrack_window` - (Optional) Target backtrack window, in seconds. Only available for `aurora` and `aurora-mysql` engines currently. To disable backtracking, set this value to `0`. Defaults to `0`. Must be between `0` and `259200` (72 hours) +* `backup_retention_period` - (Optional) Days to retain backups for. Default `1` * `cluster_identifier_prefix` - (Optional, Forces new resource) Creates a unique cluster identifier beginning with the specified prefix. Conflicts with `cluster_identifier`. * `cluster_identifier` - (Optional, Forces new resources) The cluster identifier. If omitted, Terraform will assign a random, unique identifier. * `copy_tags_to_snapshot` – (Optional, boolean) Copy all Cluster `tags` to snapshots. Default is `false`. * `database_name` - (Optional) Name for an automatically created database on cluster creation. There are different naming restrictions per database engine: [RDS Naming Constraints][5] -* `db_cluster_parameter_group_name` - (Optional) A cluster parameter group to associate with the cluster. +* `db_cluster_parameter_group_name` - (Optional) Cluster parameter group to associate with the cluster. * `db_instance_parameter_group_name` - (Optional) Instance parameter group to associate with all instances of the DB cluster. The `db_instance_parameter_group_name` parameter is only valid in combination with the `allow_major_version_upgrade` parameter. -* `db_subnet_group_name` - (Optional) A DB subnet group to associate with this DB instance. **NOTE:** This must match the `db_subnet_group_name` specified on every [`aws_rds_cluster_instance`](/docs/providers/aws/r/rds_cluster_instance.html) in the cluster. +* `db_subnet_group_name` - (Optional) DB subnet group to associate with this DB instance. **NOTE:** This must match the `db_subnet_group_name` specified on every [`aws_rds_cluster_instance`](/docs/providers/aws/r/rds_cluster_instance.html) in the cluster. * `deletion_protection` - (Optional) If the DB instance should have deletion protection enabled. The database can't be deleted when this value is set to `true`. The default is `false`. * `enable_http_endpoint` - (Optional) Enable HTTP endpoint (data API). Only valid when `engine_mode` is set to `serverless`. * `enabled_cloudwatch_logs_exports` - (Optional) Set of log types to export to cloudwatch. If omitted, no logs will be exported. The following log types are supported: `audit`, `error`, `general`, `slowquery`, `postgresql` (PostgreSQL). * `engine` - (Required) Name of the database engine to be used for this DB cluster. Valid Values: `aurora`, `aurora-mysql`, `aurora-postgresql`, `mysql`, `postgres`. (Note that `mysql` and `postgres` are Multi-AZ RDS clusters). -* `engine_mode` - (Optional) The database engine mode. Valid values: `global` (only valid for Aurora MySQL 1.21 and earlier), `multimaster`, `parallelquery`, `provisioned`, `serverless`. Defaults to: `provisioned`. See the [RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/aurora-serverless.html) for limitations when using `serverless`. -* `engine_version` - (Optional) The database engine version. Updating this argument results in an outage. See the [Aurora MySQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Updates.html) and [Aurora Postgres](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Updates.html) documentation for your configured engine to determine this value, or by running `aws rds describe-db-engine-versions`. For example with Aurora MySQL 2, a potential value for this argument is `5.7.mysql_aurora.2.03.2`. The value can contain a partial version where supported by the API. The actual engine version used is returned in the attribute `engine_version_actual`, , see [Attributes Reference](#attributes-reference) below. -* `db_cluster_instance_class` - (Optional) The compute and memory capacity of each DB instance in the Multi-AZ DB cluster, for example db.m6g.xlarge. Not all DB instance classes are available in all AWS Regions, or for all database engines. For the full list of DB instance classes and availability for your engine, see [DB instance class](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html) in the Amazon RDS User Guide. (This setting is required to create a Multi-AZ DB cluster). -* `final_snapshot_identifier` - (Optional) The name of your final DB snapshot when this DB cluster is deleted. If omitted, no final snapshot will be made. -* `global_cluster_identifier` - (Optional) The global cluster identifier specified on [`aws_rds_global_cluster`](/docs/providers/aws/r/rds_global_cluster.html). +* `engine_mode` - (Optional) Database engine mode. Valid values: `global` (only valid for Aurora MySQL 1.21 and earlier), `multimaster`, `parallelquery`, `provisioned`, `serverless`. Defaults to: `provisioned`. See the [RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/aurora-serverless.html) for limitations when using `serverless`. +* `engine_version` - (Optional) Database engine version. Updating this argument results in an outage. See the [Aurora MySQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Updates.html) and [Aurora Postgres](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Updates.html) documentation for your configured engine to determine this value, or by running `aws rds describe-db-engine-versions`. For example with Aurora MySQL 2, a potential value for this argument is `5.7.mysql_aurora.2.03.2`. The value can contain a partial version where supported by the API. The actual engine version used is returned in the attribute `engine_version_actual`, , see [Attributes Reference](#attributes-reference) below. +* `db_cluster_instance_class` - (Optional) Compute and memory capacity of each DB instance in the Multi-AZ DB cluster, for example db.m6g.xlarge. Not all DB instance classes are available in all AWS Regions, or for all database engines. For the full list of DB instance classes and availability for your engine, see [DB instance class](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html) in the Amazon RDS User Guide. (This setting is required to create a Multi-AZ DB cluster). +* `final_snapshot_identifier` - (Optional) Name of your final DB snapshot when this DB cluster is deleted. If omitted, no final snapshot will be made. +* `global_cluster_identifier` - (Optional) Global cluster identifier specified on [`aws_rds_global_cluster`](/docs/providers/aws/r/rds_global_cluster.html). * `enable_global_write_forwarding` - (Optional) Whether cluster should forward writes to an associated global cluster. Applied to secondary clusters to enable them to forward writes to an [`aws_rds_global_cluster`](/docs/providers/aws/r/rds_global_cluster.html)'s primary cluster. See the [Aurora Userguide documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database-write-forwarding.html) for more information. * `iam_database_authentication_enabled` - (Optional) Specifies whether or not mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled. Please see [AWS Documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.IAMDBAuth.html) for availability and limitations. -* `iam_roles` - (Optional) A List of ARNs for the IAM roles to associate to the RDS Cluster. -* `kms_key_id` - (Optional) The ARN for the KMS encryption key. When specifying `kms_key_id`, `storage_encrypted` needs to be set to true. +* `iam_roles` - (Optional) List of ARNs for the IAM roles to associate to the RDS Cluster. +* `kms_key_id` - (Optional) ARN for the KMS encryption key. When specifying `kms_key_id`, `storage_encrypted` needs to be set to true. * `manage_master_user_password` - (Optional) Set to true to allow RDS to manage the master user password in Secrets Manager. Cannot be set if `master_password` is provided. -* `master_user_secret_kms_key_id` - (Optional) The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN. If not specified, the default KMS key for your Amazon Web Services account is used. +* `master_user_secret_kms_key_id` - (Optional) Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN. If not specified, the default KMS key for your Amazon Web Services account is used. * `master_password` - (Required unless `manage_master_user_password` is set to true or unless a `snapshot_identifier` or `replication_source_identifier` is provided or unless a `global_cluster_identifier` is provided when the cluster is the "secondary" cluster of a global database) Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file. Please refer to the [RDS Naming Constraints][5]. Cannot be set if `manage_master_user_password` is set to `true`. * `master_username` - (Required unless a `snapshot_identifier` or `replication_source_identifier` is provided or unless a `global_cluster_identifier` is provided when the cluster is the "secondary" cluster of a global database) Username for the master DB user. Please refer to the [RDS Naming Constraints][5]. This argument does not support in-place updates and cannot be changed during a restore from snapshot. -* `port` - (Optional) The port on which the DB accepts connections -* `preferred_backup_window` - (Optional) The daily time range during which automated backups are created if automated backups are enabled using the BackupRetentionPeriod parameter.Time in UTC. Default: A 30-minute window selected at random from an 8-hour block of time per regionE.g., 04:00-09:00 -* `preferred_maintenance_window` - (Optional) The weekly time range during which system maintenance can occur, in (UTC) e.g., wed:04:00-wed:04:30 +* `port` - (Optional) Port on which the DB accepts connections +* `preferred_backup_window` - (Optional) Daily time range during which automated backups are created if automated backups are enabled using the BackupRetentionPeriod parameter.Time in UTC. Default: A 30-minute window selected at random from an 8-hour block of time per regionE.g., 04:00-09:00 +* `preferred_maintenance_window` - (Optional) Weekly time range during which system maintenance can occur, in (UTC) e.g., wed:04:00-wed:04:30 * `replication_source_identifier` - (Optional) ARN of a source DB cluster or DB instance if this DB cluster is to be created as a Read Replica. If DB Cluster is part of a Global Cluster, use the [`lifecycle` configuration block `ignore_changes` argument](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to prevent Terraform from showing differences for this argument instead of configuring this value. -* `network_type` - (Optional) The network type of the cluster. Valid values: `IPV4`, `DUAL`. +* `network_type` - (Optional) Network type of the cluster. Valid values: `IPV4`, `DUAL`. * `restore_to_point_in_time` - (Optional) Nested attribute for [point in time restore](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PIT.html). More details below. * `scaling_configuration` - (Optional) Nested attribute with scaling properties. Only valid when `engine_mode` is set to `serverless`. More details below. * `serverlessv2_scaling_configuration`- (Optional) Nested attribute with scaling properties for ServerlessV2. Only valid when `engine_mode` is set to `provisioned`. More details below. * `skip_final_snapshot` - (Optional) Determines whether a final DB snapshot is created before the DB cluster is deleted. If true is specified, no DB snapshot is created. If false is specified, a DB snapshot is created before the DB cluster is deleted, using the value from `final_snapshot_identifier`. Default is `false`. * `snapshot_identifier` - (Optional) Specifies whether or not to create this cluster from a snapshot. You can use either the name or ARN when specifying a DB cluster snapshot, or the ARN when specifying a DB snapshot. Automated snapshots **should not** be used for this attribute, unless from a different cluster. Automated snapshots are deleted as part of cluster destruction when the resource is replaced. Conflicts with `global_cluster_identifier`. Clusters cannot be restored from snapshot **and** joined to an existing global cluster in a single operation. See the [AWS documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database-getting-started.html#aurora-global-database.use-snapshot) or the [Global Cluster Restored From Snapshot example](#global-cluster-restored-from-snapshot) for instructions on building a global cluster starting with a snapshot. -* `source_region` - (Optional) The source region for an encrypted replica DB cluster. -* `allocated_storage` - (Optional) The amount of storage in gibibytes (GiB) to allocate to each DB instance in the Multi-AZ DB cluster. (This setting is required to create a Multi-AZ DB cluster). +* `source_region` - (Optional) Source region for an encrypted replica DB cluster. +* `allocated_storage` - (Optional) Amount of storage in gibibytes (GiB) to allocate to each DB instance in the Multi-AZ DB cluster. (This setting is required to create a Multi-AZ DB cluster). * `storage_type` - (Optional) Specifies the storage type to be associated with the DB cluster. (This setting is required to create a Multi-AZ DB cluster). Valid values: `io1`, Default: `io1`. -* `iops` - (Optional) The amount of Provisioned IOPS (input/output operations per second) to be initially allocated for each DB instance in the Multi-AZ DB cluster. For information about valid Iops values, see [Amazon RDS Provisioned IOPS storage to improve performance](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS) in the Amazon RDS User Guide. (This setting is required to create a Multi-AZ DB cluster). Must be a multiple between .5 and 50 of the storage amount for the DB cluster. +* `iops` - (Optional) Amount of Provisioned IOPS (input/output operations per second) to be initially allocated for each DB instance in the Multi-AZ DB cluster. For information about valid Iops values, see [Amazon RDS Provisioned IOPS storage to improve performance](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS) in the Amazon RDS User Guide. (This setting is required to create a Multi-AZ DB cluster). Must be a multiple between .5 and 50 of the storage amount for the DB cluster. * `storage_encrypted` - (Optional) Specifies whether the DB cluster is encrypted. The default is `false` for `provisioned` `engine_mode` and `true` for `serverless` `engine_mode`. When restoring an unencrypted `snapshot_identifier`, the `kms_key_id` argument must be provided to encrypt the restored cluster. Terraform will only perform drift detection if a configuration value is provided. -* `tags` - (Optional) A map of tags to assign to the DB cluster. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. +* `tags` - (Optional) Map of tags to assign to the DB cluster. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. * `vpc_security_group_ids` - (Optional) List of VPC security groups to associate with the Cluster ### S3 Import Options @@ -287,7 +287,7 @@ resource "aws_rds_cluster" "db" { } ``` -* `bucket_name` - (Required) The bucket name where your backup is stored +* `bucket_name` - (Required) Bucket name where your backup is stored * `bucket_prefix` - (Optional) Can be blank, but is the path to your backup * `ingestion_role` - (Required) Role applied to load the data. * `source_engine` - (Required) Source engine for the backup @@ -313,7 +313,7 @@ resource "aws_rds_cluster" "example-clone" { } ``` -* `source_cluster_identifier` - (Required) The identifier of the source database cluster from which to restore. +* `source_cluster_identifier` - (Required) Identifier of the source database cluster from which to restore. * `restore_type` - (Optional) Type of restore to be performed. Valid options are `full-copy` (default) and `copy-on-write`. * `use_latest_restorable_time` - (Optional) Set to true to restore the database cluster to the latest restorable backup time. Defaults to false. Conflicts with `restore_to_time`. @@ -342,10 +342,10 @@ resource "aws_rds_cluster" "example" { ``` * `auto_pause` - (Optional) Whether to enable automatic pause. A DB cluster can be paused only when it's idle (it has no connections). If a DB cluster is paused for more than seven days, the DB cluster might be backed up with a snapshot. In this case, the DB cluster is restored when there is a request to connect to it. Defaults to `true`. -* `max_capacity` - (Optional) The maximum capacity for an Aurora DB cluster in `serverless` DB engine mode. The maximum capacity must be greater than or equal to the minimum capacity. Valid Aurora MySQL capacity values are `1`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, `256`. Valid Aurora PostgreSQL capacity values are (`2`, `4`, `8`, `16`, `32`, `64`, `192`, and `384`). Defaults to `16`. -* `min_capacity` - (Optional) The minimum capacity for an Aurora DB cluster in `serverless` DB engine mode. The minimum capacity must be lesser than or equal to the maximum capacity. Valid Aurora MySQL capacity values are `1`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, `256`. Valid Aurora PostgreSQL capacity values are (`2`, `4`, `8`, `16`, `32`, `64`, `192`, and `384`). Defaults to `1`. -* `seconds_until_auto_pause` - (Optional) The time, in seconds, before an Aurora DB cluster in serverless mode is paused. Valid values are `300` through `86400`. Defaults to `300`. -* `timeout_action` - (Optional) The action to take when the timeout is reached. Valid values: `ForceApplyCapacityChange`, `RollbackCapacityChange`. Defaults to `RollbackCapacityChange`. See [documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.how-it-works.html#aurora-serverless.how-it-works.timeout-action). +* `max_capacity` - (Optional) Maximum capacity for an Aurora DB cluster in `serverless` DB engine mode. The maximum capacity must be greater than or equal to the minimum capacity. Valid Aurora MySQL capacity values are `1`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, `256`. Valid Aurora PostgreSQL capacity values are (`2`, `4`, `8`, `16`, `32`, `64`, `192`, and `384`). Defaults to `16`. +* `min_capacity` - (Optional) Minimum capacity for an Aurora DB cluster in `serverless` DB engine mode. The minimum capacity must be lesser than or equal to the maximum capacity. Valid Aurora MySQL capacity values are `1`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, `256`. Valid Aurora PostgreSQL capacity values are (`2`, `4`, `8`, `16`, `32`, `64`, `192`, and `384`). Defaults to `1`. +* `seconds_until_auto_pause` - (Optional) Time, in seconds, before an Aurora DB cluster in serverless mode is paused. Valid values are `300` through `86400`. Defaults to `300`. +* `timeout_action` - (Optional) Action to take when the timeout is reached. Valid values: `ForceApplyCapacityChange`, `RollbackCapacityChange`. Defaults to `RollbackCapacityChange`. See [documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.how-it-works.html#aurora-serverless.how-it-works.timeout-action). ### serverlessv2_scaling_configuration Argument Reference @@ -364,35 +364,35 @@ resource "aws_rds_cluster" "example" { } ``` -* `max_capacity` - (Required) The maximum capacity for an Aurora DB cluster in `provisioned` DB engine mode. The maximum capacity must be greater than or equal to the minimum capacity. Valid capacity values are in a range of `0.5` up to `128` in steps of `0.5`. -* `min_capacity` - (Required) The minimum capacity for an Aurora DB cluster in `provisioned` DB engine mode. The minimum capacity must be lesser than or equal to the maximum capacity. Valid capacity values are in a range of `0.5` up to `128` in steps of `0.5`. +* `max_capacity` - (Required) Maximum capacity for an Aurora DB cluster in `provisioned` DB engine mode. The maximum capacity must be greater than or equal to the minimum capacity. Valid capacity values are in a range of `0.5` up to `128` in steps of `0.5`. +* `min_capacity` - (Required) Minimum capacity for an Aurora DB cluster in `provisioned` DB engine mode. The minimum capacity must be lesser than or equal to the maximum capacity. Valid capacity values are in a range of `0.5` up to `128` in steps of `0.5`. ## Attributes Reference In addition to all arguments above, the following attributes are exported: * `arn` - Amazon Resource Name (ARN) of cluster -* `id` - The RDS Cluster Identifier -* `cluster_identifier` - The RDS Cluster Identifier -* `cluster_resource_id` - The RDS Cluster Resource ID +* `id` - RDS Cluster Identifier +* `cluster_identifier` - RDS Cluster Identifier +* `cluster_resource_id` - RDS Cluster Resource ID * `cluster_members` – List of RDS Instances that are a part of this cluster -* `availability_zones` - The availability zone of the instance -* `backup_retention_period` - The backup retention period -* `preferred_backup_window` - The daily time range during which the backups happen -* `preferred_maintenance_window` - The maintenance window -* `endpoint` - The DNS address of the RDS instance -* `reader_endpoint` - A read-only endpoint for the Aurora cluster, automatically +* `availability_zones` - Availability zone of the instance +* `backup_retention_period` - Backup retention period +* `preferred_backup_window` - Daily time range during which the backups happen +* `preferred_maintenance_window` - Maintenance window +* `endpoint` - DNS address of the RDS instance +* `reader_endpoint` - Read-only endpoint for the Aurora cluster, automatically load-balanced across replicas -* `engine` - The database engine -* `engine_version_actual` - The running version of the database. -* `database_name` - The database name -* `port` - The database port -* `master_username` - The master username for the database -* `master_user_secret` - A block that specifies the master user secret. Only available when `manage_master_user_password` is set to true. [Documented below](#master_user_secret). +* `engine` - Database engine +* `engine_version_actual` - Running version of the database. +* `database_name` - Database name +* `port` - Database port +* `master_username` - Master username for the database +* `master_user_secret` - Block that specifies the master user secret. Only available when `manage_master_user_password` is set to true. [Documented below](#master_user_secret). * `storage_encrypted` - Specifies whether the DB cluster is encrypted * `replication_source_identifier` - ARN of the source DB cluster or DB instance if this DB cluster is created as a Read Replica. -* `hosted_zone_id` - The Route53 Hosted Zone ID of the endpoint -* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). +* `hosted_zone_id` - Route53 Hosted Zone ID of the endpoint +* `tags_all` - Map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). [1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Replication.html [2]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Aurora.html @@ -404,9 +404,9 @@ load-balanced across replicas The `master_user_secret` configuration block supports the following attributes: -* `kms_key_id` - The Amazon Web Services KMS key identifier that is used to encrypt the secret. -* `secret_arn` - The Amazon Resource Name (ARN) of the secret. -* `secret_status` - The status of the secret. Valid Values: `creating` | `active` | `rotating` | `impaired`. +* `kms_key_id` - Amazon Web Services KMS key identifier that is used to encrypt the secret. +* `secret_arn` - Amazon Resource Name (ARN) of the secret. +* `secret_status` - Status of the secret. Valid Values: `creating` | `active` | `rotating` | `impaired`. ## Timeouts diff --git a/website/docs/r/rds_cluster_instance.html.markdown b/website/docs/r/rds_cluster_instance.html.markdown index 38fa945a96b..56cdabc842c 100644 --- a/website/docs/r/rds_cluster_instance.html.markdown +++ b/website/docs/r/rds_cluster_instance.html.markdown @@ -23,6 +23,8 @@ For more information on Amazon Aurora, see [Aurora on Amazon RDS][2] in the Amaz ~> **NOTE:** Deletion Protection from the RDS service can only be enabled at the cluster level, not for individual cluster instances. You can still add the [`prevent_destroy` lifecycle behavior](https://www.terraform.io/language/meta-arguments/lifecycle#prevent_destroy) to your Terraform resource configuration if you desire protection from accidental deletion. +~> **NOTE:** `aurora` is no longer a valid `engine` because of [Amazon Aurora's MySQL-Compatible Edition version 1 end of life](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.MySQL56.EOL.html). + ## Example Usage ```terraform @@ -51,61 +53,61 @@ the [AWS official documentation](https://docs.aws.amazon.com/cli/latest/referenc The following arguments are supported: -* `identifier` - (Optional, Forces new resource) The identifier for the RDS instance, if omitted, Terraform will assign a random, unique identifier. +* `identifier` - (Optional, Forces new resource) Identifier for the RDS instance, if omitted, Terraform will assign a random, unique identifier. * `identifier_prefix` - (Optional, Forces new resource) Creates a unique identifier beginning with the specified prefix. Conflicts with `identifier`. -* `cluster_identifier` - (Required, Forces new resource) The identifier of the [`aws_rds_cluster`](/docs/providers/aws/r/rds_cluster.html) in which to launch this instance. -* `engine` - (Optional, Forces new resource) The name of the database engine to be used for the RDS instance. Defaults to `aurora`. Valid Values: `aurora`, `aurora-mysql`, `aurora-postgresql`. +* `cluster_identifier` - (Required, Forces new resource) Identifier of the [`aws_rds_cluster`](/docs/providers/aws/r/rds_cluster.html) in which to launch this instance. +* `engine` - (Required, Forces new resource) Name of the database engine to be used for the RDS instance. Valid Values: `aurora-mysql`, `aurora-postgresql`, `mysql`, `postgres`. For information on the difference between the available Aurora MySQL engines see [Comparison between Aurora MySQL 1 and Aurora MySQL 2](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/AuroraMySQL.Updates.20180206.html) in the Amazon RDS User Guide. -* `engine_version` - (Optional) The database engine version. -* `instance_class` - (Required) The instance class to use. For details on CPU +* `engine_version` - (Optional) Database engine version. +* `instance_class` - (Required) Instance class to use. For details on CPU and memory, see [Scaling Aurora DB Instances][4]. Aurora uses `db.*` instance classes/types. Please see [AWS Documentation][7] for currently available instance classes and complete details. * `publicly_accessible` - (Optional) Bool to control if instance is publicly accessible. Default `false`. See the documentation on [Creating DB Instances][6] for more details on controlling this property. -* `db_subnet_group_name` - (Required if `publicly_accessible = false`, Optional otherwise, Forces new resource) A DB subnet group to associate with this DB instance. **NOTE:** This must match the `db_subnet_group_name` of the attached [`aws_rds_cluster`](/docs/providers/aws/r/rds_cluster.html). -* `db_parameter_group_name` - (Optional) The name of the DB parameter group to associate with this instance. +* `db_subnet_group_name` - (Required if `publicly_accessible = false`, Optional otherwise, Forces new resource) DB subnet group to associate with this DB instance. **NOTE:** This must match the `db_subnet_group_name` of the attached [`aws_rds_cluster`](/docs/providers/aws/r/rds_cluster.html). +* `db_parameter_group_name` - (Optional) Name of the DB parameter group to associate with this instance. * `apply_immediately` - (Optional) Specifies whether any database modifications are applied immediately, or during the next maintenance window. Default is`false`. -* `monitoring_role_arn` - (Optional) The ARN for the IAM role that permits RDS to send +* `monitoring_role_arn` - (Optional) ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. You can find more information on the [AWS Documentation](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.html) what IAM permissions are needed to allow Enhanced Monitoring for RDS Instances. -* `monitoring_interval` - (Optional) The interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60. +* `monitoring_interval` - (Optional) Interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60. * `promotion_tier` - (Optional) Default 0. Failover Priority setting on instance level. The reader who has lower tier has higher priority to get promoted to writer. -* `availability_zone` - (Optional, Computed, Forces new resource) The EC2 Availability Zone that the DB instance is created in. See [docs](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html) about the details. -* `preferred_backup_window` - (Optional) The daily time range during which automated backups are created if automated backups are enabled. Eg: "04:00-09:00". **NOTE:** If `preferred_backup_window` is set at the cluster level, this argument **must** be omitted. -* `preferred_maintenance_window` - (Optional) The window to perform maintenance in. +* `availability_zone` - (Optional, Computed, Forces new resource) EC2 Availability Zone that the DB instance is created in. See [docs](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html) about the details. +* `preferred_backup_window` - (Optional) Daily time range during which automated backups are created if automated backups are enabled. Eg: "04:00-09:00". **NOTE:** If `preferred_backup_window` is set at the cluster level, this argument **must** be omitted. +* `preferred_maintenance_window` - (Optional) Window to perform maintenance in. Syntax: "ddd:hh24:mi-ddd:hh24:mi". Eg: "Mon:00:00-Mon:03:00". * `auto_minor_version_upgrade` - (Optional) Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window. Default `true`. * `performance_insights_enabled` - (Optional) Specifies whether Performance Insights is enabled or not. * `performance_insights_kms_key_id` - (Optional) ARN for the KMS key to encrypt Performance Insights data. When specifying `performance_insights_kms_key_id`, `performance_insights_enabled` needs to be set to true. * `performance_insights_retention_period` - (Optional) Amount of time in days to retain Performance Insights data. Valid values are `7`, `731` (2 years) or a multiple of `31`. When specifying `performance_insights_retention_period`, `performance_insights_enabled` needs to be set to true. Defaults to '7'. * `copy_tags_to_snapshot` – (Optional, boolean) Indicates whether to copy all of the user-defined tags from the DB instance to snapshots of the DB instance. Default `false`. -* `ca_cert_identifier` - (Optional) The identifier of the CA certificate for the DB instance. -* `tags` - (Optional) A map of tags to assign to the instance. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. +* `ca_cert_identifier` - (Optional) Identifier of the CA certificate for the DB instance. +* `tags` - (Optional) Map of tags to assign to the instance. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference In addition to all arguments above, the following attributes are exported: * `arn` - Amazon Resource Name (ARN) of cluster instance -* `cluster_identifier` - The RDS Cluster Identifier -* `identifier` - The Instance identifier -* `id` - The Instance identifier +* `cluster_identifier` - RDS Cluster Identifier +* `identifier` - Instance identifier +* `id` - Instance identifier * `writer` – Boolean indicating if this instance is writable. `False` indicates this instance is a read replica. -* `availability_zone` - The availability zone of the instance -* `endpoint` - The DNS address for this instance. May not be writable -* `engine` - The database engine -* `engine_version_actual` - The database engine version -* `port` - The database port +* `availability_zone` - Availability zone of the instance +* `endpoint` - DNS address for this instance. May not be writable +* `engine` - Database engine +* `engine_version_actual` - Database engine version +* `port` - Database port * `storage_encrypted` - Specifies whether the DB cluster is encrypted. -* `kms_key_id` - The ARN for the KMS encryption key if one is set to the cluster. -* `network_type` - The network type of the DB instance. -* `dbi_resource_id` - The region-unique, immutable identifier for the DB instance. +* `kms_key_id` - ARN for the KMS encryption key if one is set to the cluster. +* `network_type` - Network type of the DB instance. +* `dbi_resource_id` - Region-unique, immutable identifier for the DB instance. * `performance_insights_enabled` - Specifies whether Performance Insights is enabled or not. -* `performance_insights_kms_key_id` - The ARN for the KMS encryption key used by Performance Insights. -* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). +* `performance_insights_kms_key_id` - ARN for the KMS encryption key used by Performance Insights. +* `tags_all` - Map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). [2]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Aurora.html [3]: /docs/providers/aws/r/rds_cluster.html From 8110085de7beb3305895de4e3c9ea24d8d075280 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Wed, 3 May 2023 11:20:57 -0400 Subject: [PATCH 5/5] Update docs --- website/docs/r/rds_cluster.html.markdown | 16 +++---- .../docs/r/rds_cluster_instance.html.markdown | 42 +++++++------------ 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/website/docs/r/rds_cluster.html.markdown b/website/docs/r/rds_cluster.html.markdown index 6ca852b5709..e5a829bb0d2 100644 --- a/website/docs/r/rds_cluster.html.markdown +++ b/website/docs/r/rds_cluster.html.markdown @@ -220,6 +220,7 @@ the AWS official documentation : The following arguments are supported: +* `allocated_storage` - (Optional) Amount of storage in gibibytes (GiB) to allocate to each DB instance in the Multi-AZ DB cluster. (This setting is required to create a Multi-AZ DB cluster). * `allow_major_version_upgrade` - (Optional) Enable to allow major engine version upgrades when changing engine versions. Defaults to `false`. * `apply_immediately` - (Optional) Specifies whether any cluster modifications are applied immediately, or during the next maintenance window. Default is `false`. See [Amazon RDS Documentation for more information.](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html) * `availability_zones` - (Optional) List of EC2 Availability Zones for the DB cluster storage where DB cluster instances can be created. RDS automatically assigns 3 AZs if less than 3 AZs are configured, which will show as a difference requiring resource recreation next Terraform apply. We recommend specifying 3 AZs or using [the `lifecycle` configuration block `ignore_changes` argument](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) if necessary. A maximum of 3 AZs can be configured. @@ -229,41 +230,40 @@ The following arguments are supported: * `cluster_identifier` - (Optional, Forces new resources) The cluster identifier. If omitted, Terraform will assign a random, unique identifier. * `copy_tags_to_snapshot` – (Optional, boolean) Copy all Cluster `tags` to snapshots. Default is `false`. * `database_name` - (Optional) Name for an automatically created database on cluster creation. There are different naming restrictions per database engine: [RDS Naming Constraints][5] +* `db_cluster_instance_class` - (Optional) Compute and memory capacity of each DB instance in the Multi-AZ DB cluster, for example db.m6g.xlarge. Not all DB instance classes are available in all AWS Regions, or for all database engines. For the full list of DB instance classes and availability for your engine, see [DB instance class](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html) in the Amazon RDS User Guide. (This setting is required to create a Multi-AZ DB cluster). * `db_cluster_parameter_group_name` - (Optional) Cluster parameter group to associate with the cluster. * `db_instance_parameter_group_name` - (Optional) Instance parameter group to associate with all instances of the DB cluster. The `db_instance_parameter_group_name` parameter is only valid in combination with the `allow_major_version_upgrade` parameter. * `db_subnet_group_name` - (Optional) DB subnet group to associate with this DB instance. **NOTE:** This must match the `db_subnet_group_name` specified on every [`aws_rds_cluster_instance`](/docs/providers/aws/r/rds_cluster_instance.html) in the cluster. * `deletion_protection` - (Optional) If the DB instance should have deletion protection enabled. The database can't be deleted when this value is set to `true`. The default is `false`. +* `enable_global_write_forwarding` - (Optional) Whether cluster should forward writes to an associated global cluster. Applied to secondary clusters to enable them to forward writes to an [`aws_rds_global_cluster`](/docs/providers/aws/r/rds_global_cluster.html)'s primary cluster. See the [Aurora Userguide documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database-write-forwarding.html) for more information. * `enable_http_endpoint` - (Optional) Enable HTTP endpoint (data API). Only valid when `engine_mode` is set to `serverless`. * `enabled_cloudwatch_logs_exports` - (Optional) Set of log types to export to cloudwatch. If omitted, no logs will be exported. The following log types are supported: `audit`, `error`, `general`, `slowquery`, `postgresql` (PostgreSQL). -* `engine` - (Required) Name of the database engine to be used for this DB cluster. Valid Values: `aurora`, `aurora-mysql`, `aurora-postgresql`, `mysql`, `postgres`. (Note that `mysql` and `postgres` are Multi-AZ RDS clusters). * `engine_mode` - (Optional) Database engine mode. Valid values: `global` (only valid for Aurora MySQL 1.21 and earlier), `multimaster`, `parallelquery`, `provisioned`, `serverless`. Defaults to: `provisioned`. See the [RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/aurora-serverless.html) for limitations when using `serverless`. * `engine_version` - (Optional) Database engine version. Updating this argument results in an outage. See the [Aurora MySQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Updates.html) and [Aurora Postgres](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Updates.html) documentation for your configured engine to determine this value, or by running `aws rds describe-db-engine-versions`. For example with Aurora MySQL 2, a potential value for this argument is `5.7.mysql_aurora.2.03.2`. The value can contain a partial version where supported by the API. The actual engine version used is returned in the attribute `engine_version_actual`, , see [Attributes Reference](#attributes-reference) below. -* `db_cluster_instance_class` - (Optional) Compute and memory capacity of each DB instance in the Multi-AZ DB cluster, for example db.m6g.xlarge. Not all DB instance classes are available in all AWS Regions, or for all database engines. For the full list of DB instance classes and availability for your engine, see [DB instance class](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html) in the Amazon RDS User Guide. (This setting is required to create a Multi-AZ DB cluster). +* `engine` - (Required) Name of the database engine to be used for this DB cluster. Valid Values: `aurora-mysql`, `aurora-postgresql`, `mysql`, `postgres`. (Note that `mysql` and `postgres` are Multi-AZ RDS clusters). * `final_snapshot_identifier` - (Optional) Name of your final DB snapshot when this DB cluster is deleted. If omitted, no final snapshot will be made. * `global_cluster_identifier` - (Optional) Global cluster identifier specified on [`aws_rds_global_cluster`](/docs/providers/aws/r/rds_global_cluster.html). -* `enable_global_write_forwarding` - (Optional) Whether cluster should forward writes to an associated global cluster. Applied to secondary clusters to enable them to forward writes to an [`aws_rds_global_cluster`](/docs/providers/aws/r/rds_global_cluster.html)'s primary cluster. See the [Aurora Userguide documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database-write-forwarding.html) for more information. * `iam_database_authentication_enabled` - (Optional) Specifies whether or not mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled. Please see [AWS Documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.IAMDBAuth.html) for availability and limitations. * `iam_roles` - (Optional) List of ARNs for the IAM roles to associate to the RDS Cluster. +* `iops` - (Optional) Amount of Provisioned IOPS (input/output operations per second) to be initially allocated for each DB instance in the Multi-AZ DB cluster. For information about valid Iops values, see [Amazon RDS Provisioned IOPS storage to improve performance](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS) in the Amazon RDS User Guide. (This setting is required to create a Multi-AZ DB cluster). Must be a multiple between .5 and 50 of the storage amount for the DB cluster. * `kms_key_id` - (Optional) ARN for the KMS encryption key. When specifying `kms_key_id`, `storage_encrypted` needs to be set to true. * `manage_master_user_password` - (Optional) Set to true to allow RDS to manage the master user password in Secrets Manager. Cannot be set if `master_password` is provided. -* `master_user_secret_kms_key_id` - (Optional) Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN. If not specified, the default KMS key for your Amazon Web Services account is used. * `master_password` - (Required unless `manage_master_user_password` is set to true or unless a `snapshot_identifier` or `replication_source_identifier` is provided or unless a `global_cluster_identifier` is provided when the cluster is the "secondary" cluster of a global database) Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file. Please refer to the [RDS Naming Constraints][5]. Cannot be set if `manage_master_user_password` is set to `true`. +* `master_user_secret_kms_key_id` - (Optional) Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN. If not specified, the default KMS key for your Amazon Web Services account is used. * `master_username` - (Required unless a `snapshot_identifier` or `replication_source_identifier` is provided or unless a `global_cluster_identifier` is provided when the cluster is the "secondary" cluster of a global database) Username for the master DB user. Please refer to the [RDS Naming Constraints][5]. This argument does not support in-place updates and cannot be changed during a restore from snapshot. +* `network_type` - (Optional) Network type of the cluster. Valid values: `IPV4`, `DUAL`. * `port` - (Optional) Port on which the DB accepts connections * `preferred_backup_window` - (Optional) Daily time range during which automated backups are created if automated backups are enabled using the BackupRetentionPeriod parameter.Time in UTC. Default: A 30-minute window selected at random from an 8-hour block of time per regionE.g., 04:00-09:00 * `preferred_maintenance_window` - (Optional) Weekly time range during which system maintenance can occur, in (UTC) e.g., wed:04:00-wed:04:30 * `replication_source_identifier` - (Optional) ARN of a source DB cluster or DB instance if this DB cluster is to be created as a Read Replica. If DB Cluster is part of a Global Cluster, use the [`lifecycle` configuration block `ignore_changes` argument](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to prevent Terraform from showing differences for this argument instead of configuring this value. -* `network_type` - (Optional) Network type of the cluster. Valid values: `IPV4`, `DUAL`. * `restore_to_point_in_time` - (Optional) Nested attribute for [point in time restore](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PIT.html). More details below. * `scaling_configuration` - (Optional) Nested attribute with scaling properties. Only valid when `engine_mode` is set to `serverless`. More details below. * `serverlessv2_scaling_configuration`- (Optional) Nested attribute with scaling properties for ServerlessV2. Only valid when `engine_mode` is set to `provisioned`. More details below. * `skip_final_snapshot` - (Optional) Determines whether a final DB snapshot is created before the DB cluster is deleted. If true is specified, no DB snapshot is created. If false is specified, a DB snapshot is created before the DB cluster is deleted, using the value from `final_snapshot_identifier`. Default is `false`. * `snapshot_identifier` - (Optional) Specifies whether or not to create this cluster from a snapshot. You can use either the name or ARN when specifying a DB cluster snapshot, or the ARN when specifying a DB snapshot. Automated snapshots **should not** be used for this attribute, unless from a different cluster. Automated snapshots are deleted as part of cluster destruction when the resource is replaced. Conflicts with `global_cluster_identifier`. Clusters cannot be restored from snapshot **and** joined to an existing global cluster in a single operation. See the [AWS documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database-getting-started.html#aurora-global-database.use-snapshot) or the [Global Cluster Restored From Snapshot example](#global-cluster-restored-from-snapshot) for instructions on building a global cluster starting with a snapshot. * `source_region` - (Optional) Source region for an encrypted replica DB cluster. -* `allocated_storage` - (Optional) Amount of storage in gibibytes (GiB) to allocate to each DB instance in the Multi-AZ DB cluster. (This setting is required to create a Multi-AZ DB cluster). -* `storage_type` - (Optional) Specifies the storage type to be associated with the DB cluster. (This setting is required to create a Multi-AZ DB cluster). Valid values: `io1`, Default: `io1`. -* `iops` - (Optional) Amount of Provisioned IOPS (input/output operations per second) to be initially allocated for each DB instance in the Multi-AZ DB cluster. For information about valid Iops values, see [Amazon RDS Provisioned IOPS storage to improve performance](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS) in the Amazon RDS User Guide. (This setting is required to create a Multi-AZ DB cluster). Must be a multiple between .5 and 50 of the storage amount for the DB cluster. * `storage_encrypted` - (Optional) Specifies whether the DB cluster is encrypted. The default is `false` for `provisioned` `engine_mode` and `true` for `serverless` `engine_mode`. When restoring an unencrypted `snapshot_identifier`, the `kms_key_id` argument must be provided to encrypt the restored cluster. Terraform will only perform drift detection if a configuration value is provided. +* `storage_type` - (Optional) Specifies the storage type to be associated with the DB cluster. (This setting is required to create a Multi-AZ DB cluster). Valid values: `io1`, Default: `io1`. * `tags` - (Optional) Map of tags to assign to the DB cluster. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. * `vpc_security_group_ids` - (Optional) List of VPC security groups to associate with the Cluster diff --git a/website/docs/r/rds_cluster_instance.html.markdown b/website/docs/r/rds_cluster_instance.html.markdown index 56cdabc842c..6e0c2e6c2a5 100644 --- a/website/docs/r/rds_cluster_instance.html.markdown +++ b/website/docs/r/rds_cluster_instance.html.markdown @@ -53,38 +53,28 @@ the [AWS official documentation](https://docs.aws.amazon.com/cli/latest/referenc The following arguments are supported: -* `identifier` - (Optional, Forces new resource) Identifier for the RDS instance, if omitted, Terraform will assign a random, unique identifier. -* `identifier_prefix` - (Optional, Forces new resource) Creates a unique identifier beginning with the specified prefix. Conflicts with `identifier`. +* `apply_immediately` - (Optional) Specifies whether any database modifications are applied immediately, or during the next maintenance window. Default is`false`. +* `auto_minor_version_upgrade` - (Optional) Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window. Default `true`. +* `availability_zone` - (Optional, Computed, Forces new resource) EC2 Availability Zone that the DB instance is created in. See [docs](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html) about the details. +* `ca_cert_identifier` - (Optional) Identifier of the CA certificate for the DB instance. * `cluster_identifier` - (Required, Forces new resource) Identifier of the [`aws_rds_cluster`](/docs/providers/aws/r/rds_cluster.html) in which to launch this instance. -* `engine` - (Required, Forces new resource) Name of the database engine to be used for the RDS instance. Valid Values: `aurora-mysql`, `aurora-postgresql`, `mysql`, `postgres`. -For information on the difference between the available Aurora MySQL engines -see [Comparison between Aurora MySQL 1 and Aurora MySQL 2](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/AuroraMySQL.Updates.20180206.html) -in the Amazon RDS User Guide. -* `engine_version` - (Optional) Database engine version. -* `instance_class` - (Required) Instance class to use. For details on CPU -and memory, see [Scaling Aurora DB Instances][4]. Aurora uses `db.*` instance classes/types. Please see [AWS Documentation][7] for currently available instance classes and complete details. -* `publicly_accessible` - (Optional) Bool to control if instance is publicly accessible. -Default `false`. See the documentation on [Creating DB Instances][6] for more -details on controlling this property. -* `db_subnet_group_name` - (Required if `publicly_accessible = false`, Optional otherwise, Forces new resource) DB subnet group to associate with this DB instance. **NOTE:** This must match the `db_subnet_group_name` of the attached [`aws_rds_cluster`](/docs/providers/aws/r/rds_cluster.html). +* `copy_tags_to_snapshot` – (Optional, boolean) Indicates whether to copy all of the user-defined tags from the DB instance to snapshots of the DB instance. Default `false`. * `db_parameter_group_name` - (Optional) Name of the DB parameter group to associate with this instance. -* `apply_immediately` - (Optional) Specifies whether any database modifications - are applied immediately, or during the next maintenance window. Default is`false`. -* `monitoring_role_arn` - (Optional) ARN for the IAM role that permits RDS to send -enhanced monitoring metrics to CloudWatch Logs. You can find more information on the [AWS Documentation](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.html) -what IAM permissions are needed to allow Enhanced Monitoring for RDS Instances. +* `db_subnet_group_name` - (Required if `publicly_accessible = false`, Optional otherwise, Forces new resource) DB subnet group to associate with this DB instance. **NOTE:** This must match the `db_subnet_group_name` of the attached [`aws_rds_cluster`](/docs/providers/aws/r/rds_cluster.html). +* `engine_version` - (Optional) Database engine version. +* `engine` - (Required, Forces new resource) Name of the database engine to be used for the RDS instance. Valid Values: `aurora-mysql`, `aurora-postgresql`, `mysql`, `postgres`. +* `identifier_prefix` - (Optional, Forces new resource) Creates a unique identifier beginning with the specified prefix. Conflicts with `identifier`. +* `identifier` - (Optional, Forces new resource) Identifier for the RDS instance, if omitted, Terraform will assign a random, unique identifier. +* `instance_class` - (Required) Instance class to use. For details on CPU and memory, see [Scaling Aurora DB Instances][4]. Aurora uses `db.*` instance classes/types. Please see [AWS Documentation][7] for currently available instance classes and complete details. * `monitoring_interval` - (Optional) Interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60. -* `promotion_tier` - (Optional) Default 0. Failover Priority setting on instance level. The reader who has lower tier has higher priority to get promoted to writer. -* `availability_zone` - (Optional, Computed, Forces new resource) EC2 Availability Zone that the DB instance is created in. See [docs](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html) about the details. -* `preferred_backup_window` - (Optional) Daily time range during which automated backups are created if automated backups are enabled. Eg: "04:00-09:00". **NOTE:** If `preferred_backup_window` is set at the cluster level, this argument **must** be omitted. -* `preferred_maintenance_window` - (Optional) Window to perform maintenance in. - Syntax: "ddd:hh24:mi-ddd:hh24:mi". Eg: "Mon:00:00-Mon:03:00". -* `auto_minor_version_upgrade` - (Optional) Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window. Default `true`. +* `monitoring_role_arn` - (Optional) ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. You can find more information on the [AWS Documentation](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.html) what IAM permissions are needed to allow Enhanced Monitoring for RDS Instances. * `performance_insights_enabled` - (Optional) Specifies whether Performance Insights is enabled or not. * `performance_insights_kms_key_id` - (Optional) ARN for the KMS key to encrypt Performance Insights data. When specifying `performance_insights_kms_key_id`, `performance_insights_enabled` needs to be set to true. * `performance_insights_retention_period` - (Optional) Amount of time in days to retain Performance Insights data. Valid values are `7`, `731` (2 years) or a multiple of `31`. When specifying `performance_insights_retention_period`, `performance_insights_enabled` needs to be set to true. Defaults to '7'. -* `copy_tags_to_snapshot` – (Optional, boolean) Indicates whether to copy all of the user-defined tags from the DB instance to snapshots of the DB instance. Default `false`. -* `ca_cert_identifier` - (Optional) Identifier of the CA certificate for the DB instance. +* `preferred_backup_window` - (Optional) Daily time range during which automated backups are created if automated backups are enabled. Eg: "04:00-09:00". **NOTE:** If `preferred_backup_window` is set at the cluster level, this argument **must** be omitted. +* `preferred_maintenance_window` - (Optional) Window to perform maintenance in. Syntax: "ddd:hh24:mi-ddd:hh24:mi". Eg: "Mon:00:00-Mon:03:00". +* `promotion_tier` - (Optional) Default 0. Failover Priority setting on instance level. The reader who has lower tier has higher priority to get promoted to writer. +* `publicly_accessible` - (Optional) Bool to control if instance is publicly accessible. Default `false`. See the documentation on [Creating DB Instances][6] for more details on controlling this property. * `tags` - (Optional) Map of tags to assign to the instance. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference