Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/aws_db_instance: Correctly handles update and reboot for replica instances #22178

Merged
merged 15 commits into from
Feb 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/22178.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_db_instance: Fix error with reboot of replica
```
2 changes: 1 addition & 1 deletion docs/contributing/contribution-checklists.md
Original file line number Diff line number Diff line change
@@ -148,7 +148,7 @@ func TestAccServiceThing_nameGenerated(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckThingExists(resourceName, &thing),
create.TestCheckResourceAttrNameGenerated(resourceName, "name"),
resource.TestCheckResourceAttr(resourceName, "name_prefix", "terraform-"),
resource.TestCheckResourceAttr(resourceName, "name_prefix", resource.UniqueIdPrefix),
),
},
// If the resource supports import:
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ import (
"strings"
"text/template"

"github.com/hashicorp/terraform-provider-aws/internal/namevaluesfilters"
"github.com/hashicorp/terraform-provider-aws/internal/generate/namevaluesfilters"
)

const filename = `service_filters_gen.go`
15 changes: 15 additions & 0 deletions internal/service/rds/enum.go
Original file line number Diff line number Diff line change
@@ -6,6 +6,20 @@ const (
ClusterRoleStatusPending = "PENDING"
)

const (
StorageTypeStandard = "standard"
StorageTypeGp2 = "gp2"
StorageTypeIo1 = "io1"
)

func StorageType_Values() []string {
return []string{
StorageTypeStandard,
StorageTypeGp2,
StorageTypeIo1,
}
}

// https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/accessing-monitoring.html#Overview.DBInstance.Status.
const (
InstanceStatusAvailable = "available"
@@ -15,6 +29,7 @@ const (
InstanceStatusCreating = "creating"
InstanceStatusDeleting = "deleting"
InstanceStatusIncompatibleParameters = "incompatible-parameters"
InstanceStatusIncompatibleRestore = "incompatible-restore"
InstanceStatusModifying = "modifying"
InstanceStatusStarting = "starting"
InstanceStatusStopping = "stopping"
249 changes: 139 additions & 110 deletions internal/service/rds/instance.go

Large diffs are not rendered by default.

1,236 changes: 1,025 additions & 211 deletions internal/service/rds/instance_test.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions internal/service/rds/wait.go
Original file line number Diff line number Diff line change
@@ -154,6 +154,7 @@ func waitDBInstanceDeleted(conn *rds.RDS, id string, timeout time.Duration) (*rd
InstanceStatusCreating,
InstanceStatusDeleting,
InstanceStatusIncompatibleParameters,
InstanceStatusIncompatibleRestore,
InstanceStatusModifying,
InstanceStatusStarting,
InstanceStatusStopping,
8 changes: 4 additions & 4 deletions website/docs/r/db_instance.html.markdown
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ for additional read replica contraints.
* `domain_iam_role_name` - (Optional, but required if domain is provided) The name of the IAM role to be used when making API calls to the Directory Service.
* `enabled_cloudwatch_logs_exports` - (Optional) Set of log types to enable for exporting to CloudWatch logs. If omitted, no logs will be exported. Valid values (depending on `engine`). MySQL and MariaDB: `audit`, `error`, `general`, `slowquery`. PostgreSQL: `postgresql`, `upgrade`. MSSQL: `agent` , `error`. Oracle: `alert`, `audit`, `listener`, `trace`.
* `engine` - (Required unless a `snapshot_identifier` or `replicate_source_db`
is provided) The database engine to use. For supported values, see the Engine parameter in [API action CreateDBInstance](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html).
is provided) The database engine to use. For supported values, see the Engine parameter in [API action CreateDBInstance](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html). Cannot be specified for a replica.
Note that for Amazon Aurora instances the engine must match the [DB cluster](/docs/providers/aws/r/rds_cluster.html)'s engine'.
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)
@@ -119,7 +119,7 @@ in the Amazon RDS User Guide.
is enabled, you can provide a prefix of the version such as `5.7` (for `5.7.10`).
The actual engine version used is returned in the attribute `engine_version_actual`, [defined below](#engine_version_actual).
For supported values, see the EngineVersion parameter in [API action CreateDBInstance](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html).
Note that for Amazon Aurora instances the engine version must match the [DB cluster](/docs/providers/aws/r/rds_cluster.html)'s engine version'.
Note that for Amazon Aurora instances the engine version must match the [DB cluster](/docs/providers/aws/r/rds_cluster.html)'s engine version'. Cannot be specified for a replica.
* `final_snapshot_identifier` - (Optional) The name of your final DB snapshot
when this DB instance is deleted. Must be provided if `skip_final_snapshot` is
set to `false`. The value must begin with a letter, only contain alphanumeric characters and hyphens, and not end with a hyphen or contain two consecutive hyphens. Must not be provided when deleting a read replica.
@@ -153,7 +153,7 @@ information on the [AWS
Documentation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.html)
what IAM permissions are needed to allow Enhanced Monitoring for RDS Instances.
* `multi_az` - (Optional) Specifies if the RDS instance is multi-AZ
* `name` - (Optional) The name of the database to create when the DB instance is created. If this parameter is not specified, no database is created in the DB instance. Note that this does not apply for Oracle or SQL Server engines. See the [AWS documentation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/rds/create-db-instance.html) for more details on what applies for those engines. If you are providing an Oracle db name, it needs to be in all upper case.
* `name` - (Optional) The name of the database to create when the DB instance is created. If this parameter is not specified, no database is created in the DB instance. Note that this does not apply for Oracle or SQL Server engines. See the [AWS documentation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/rds/create-db-instance.html) for more details on what applies for those engines. If you are providing an Oracle db name, it needs to be in all upper case. Cannot be specified for a replica.
* `nchar_character_set_name` - (Optional, Forces new resource) The national character set is used in the NCHAR, NVARCHAR2, and NCLOB data types for Oracle instances. This can't be changed. See [Oracle Character Sets
Supported in Amazon RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.OracleCharacterSets.html).
* `option_group_name` - (Optional) Name of the DB option group to associate.
@@ -206,7 +206,7 @@ creation. See [MSSQL User
Guide](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_SQLServer.html#SQLServer.Concepts.General.TimeZone)
for more information.
* `username` - (Required unless a `snapshot_identifier` or `replicate_source_db`
is provided) Username for the master DB user.
is provided) Username for the master DB user. Cannot be specified for a replica.
* `vpc_security_group_ids` - (Optional) List of VPC security groups to
associate.
* `customer_owned_ip_enabled` - (Optional) Indicates whether to enable a customer-owned IP address (CoIP) for an RDS on Outposts DB instance. See [CoIP for RDS on Outposts](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-on-outposts.html#rds-on-outposts.coip) for more information.