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: Prevent double apply with replicate_source_db, prevent pending-reboot on creation with parameter_group_name #5672

Merged
merged 1 commit into from
Aug 30, 2018

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Aug 23, 2018

Fixes #218
Fixes #263
Fixes #1329
Fixes #1494
Fixes #1510
Fixes #2909

Previously:

--- FAIL: TestAccAWSDBInstance_SnapshotIdentifier_AllocatedStorage (1160.55s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'allocated_storage' expected "10", got "5"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_AllocatedStorage (1433.85s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'allocated_storage' expected "10", got "5"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_AutoMinorVersionUpgrade (1707.73s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'auto_minor_version_upgrade' expected "false", got "true"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_BackupRetentionPeriod (1336.28s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'backup_retention_period' expected "1", got "0"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_BackupWindow (1451.16s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'backup_window' expected "00:00-08:00", got "08:31-09:01"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_IamDatabaseAuthenticationEnabled (1525.07s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'iam_database_authentication_enabled' expected "true", got "false"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_MaintenanceWindow (1695.94s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'maintenance_window' expected "sun:01:00-sun:01:30", got "sat:07:22-sat:07:52"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_MultiAZ (1802.71s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'multi_az' expected "true", got "false"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_ParameterGroupName (1624.64s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'parameter_group_name' expected "tf-acc-test-2677194822897355379", got "default.mysql5.7"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_VpcSecurityGroupIds (1479.95s)
	testing.go:527: Step 0 error: After applying this step, the plan was not empty:

		DIFF:

		UPDATE: aws_db_instance.test
		  vpc_security_group_ids.1493394302: "" => "sg-0202c4194da544ffb"
		  vpc_security_group_ids.81746784:   "sg-1ca59078" => ""

Before RebootDBInstance addition:

--- FAIL: TestAccAWSDBInstance_SnapshotIdentifier_ParameterGroupName (1256.87s)
	testing.go:527: Step 0 error: Check failed: Check 5/5 error: expected DB Instance (tf-acc-test-8132994030462245505) Parameter Group (tf-acc-test-8132994030462245505) apply status to be: "in-sync", got: "pending-reboot"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_ParameterGroupName (1761.14s)
	testing.go:527: Step 0 error: Check failed: Check 5/5 error: expected DB Instance (tf-acc-test-632112102194298217) Parameter Group (tf-acc-test-632112102194298217) apply status to be: "in-sync", got: "pending-reboot"

Changes proposed in this pull request:

  • Add ModifyDBInstance call to CreateDBInstanceReadReplica if necessary
  • Add RebootDBInstance call after ModifyDBInstance if necessary
  • Refactor to not call update function during create function
  • Additional acceptance testing with snapshot_identifier and allocated_storage, availability_zone, auto_minor_version_upgrade, and port

Output from acceptance testing:

51 tests passed (all tests)
--- PASS: TestAccAWSDBInstance_namePrefix (450.90s)
--- PASS: TestAccAWSDBInstance_iamAuth (470.49s)
--- PASS: TestAccAWSDBInstance_generatedName (491.28s)
--- PASS: TestAccAWSDBInstance_importBasic (501.34s)
--- PASS: TestAccAWSDBInstance_IsAlreadyBeingDeleted (501.44s)
--- PASS: TestAccAWSDBInstance_basic (520.82s)
--- PASS: TestAccAWSDBInstance_kmsKey (550.28s)
--- PASS: TestAccAWSDBInstance_optionGroup (592.18s)
--- PASS: TestAccAWSDBInstance_FinalSnapshotIdentifier_SkipFinalSnapshot (733.31s)
--- PASS: TestAccAWSDBInstance_subnetGroup (935.85s)
--- PASS: TestAccAWSDBInstance_FinalSnapshotIdentifier (956.10s)
--- PASS: TestAccAWSDBInstance_S3Import (784.56s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_BackupWindow (1381.45s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_IamDatabaseAuthenticationEnabled (1533.10s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_AvailabilityZone (1604.60s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_AutoMinorVersionUpgrade (1644.87s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb (1654.63s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_Monitoring (1661.31s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_MaintenanceWindow (1705.38s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier (1289.00s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_AutoMinorVersionUpgrade (1258.32s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_Port (1531.50s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_AvailabilityZone (1298.63s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_BackupWindow (1156.87s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_BackupRetentionPeriod (2148.84s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_VpcSecurityGroupIds (1675.46s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_AllocatedStorage (2279.75s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_AllocatedStorage (1761.78s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_BackupRetentionPeriod (1450.02s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_ParameterGroupName (1935.97s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_IamDatabaseAuthenticationEnabled (1228.25s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_MaintenanceWindow (1137.73s)
--- PASS: TestAccAWSDBInstance_MinorVersion (459.25s)
--- PASS: TestAccAWSDBInstance_enhancedMonitoring (626.51s)
--- PASS: TestAccAWSDBInstance_portUpdate (542.92s)
--- PASS: TestAccAWSDBInstance_separate_iops_update (633.42s)
--- PASS: TestAccAWSDBInstance_diffSuppressInitialState (459.22s)
--- PASS: TestAccAWSDBInstance_ec2Classic (449.74s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_Monitoring (1280.71s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_MultiAZ (2389.66s)
--- PASS: TestAccAWSDBInstance_cloudwatchLogsExportConfiguration (514.97s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_ParameterGroupName (1248.17s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_Port (1277.75s)
--- PASS: TestAccAWSDBInstance_cloudwatchLogsExportConfigurationUpdate (559.38s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_Tags (1298.67s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_VpcSecurityGroupIds (1209.14s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_VpcSecurityGroupIds_Tags (1380.50s)
--- PASS: TestAccAWSDBInstance_EnabledCloudwatchLogsExports_Oracle (823.13s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_MultiAZ (1944.08s)
--- PASS: TestAccAWSDBInstance_MSSQL_TZ (1530.48s)
--- PASS: TestAccAWSDBInstance_SnapshotIdentifier_MultiAZ_SQLServer (3841.77s)

@bflad bflad added bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service. labels Aug 23, 2018
@bflad bflad requested a review from a team August 23, 2018 22:59
…db, prevent pending-reboot on creation with parameter_group_name

* Add ModifyDBInstance call to CreateDBInstanceReadReplica if necessary
* Add RebootDBInstance call after ModifyDBInstance if necessary
* Refactor to not call update function during create function
* Additional acceptance testing with snapshot_identifier with allocated_storage, availability_zone, auto_minor_version_upgrade, and port

Previously:

```
--- FAIL: TestAccAWSDBInstance_SnapshotIdentifier_AllocatedStorage (1160.55s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'allocated_storage' expected "10", got "5"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_AllocatedStorage (1433.85s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'allocated_storage' expected "10", got "5"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_AutoMinorVersionUpgrade (1707.73s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'auto_minor_version_upgrade' expected "false", got "true"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_BackupRetentionPeriod (1336.28s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'backup_retention_period' expected "1", got "0"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_BackupWindow (1451.16s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'backup_window' expected "00:00-08:00", got "08:31-09:01"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_IamDatabaseAuthenticationEnabled (1525.07s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'iam_database_authentication_enabled' expected "true", got "false"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_MaintenanceWindow (1695.94s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'maintenance_window' expected "sun:01:00-sun:01:30", got "sat:07:22-sat:07:52"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_MultiAZ (1802.71s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'multi_az' expected "true", got "false"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_ParameterGroupName (1624.64s)
	testing.go:527: Step 0 error: Check failed: Check 4/4 error: aws_db_instance.test: Attribute 'parameter_group_name' expected "tf-acc-test-2677194822897355379", got "default.mysql5.7"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_VpcSecurityGroupIds (1479.95s)
	testing.go:527: Step 0 error: After applying this step, the plan was not empty:

		DIFF:

		UPDATE: aws_db_instance.test
		  vpc_security_group_ids.1493394302: "" => "sg-0202c4194da544ffb"
		  vpc_security_group_ids.81746784:   "sg-1ca59078" => ""
```

Before RebootDBInstance addition:

```
--- FAIL: TestAccAWSDBInstance_SnapshotIdentifier_ParameterGroupName (1256.87s)
	testing.go:527: Step 0 error: Check failed: Check 5/5 error: expected DB Instance (tf-acc-test-8132994030462245505) Parameter Group (tf-acc-test-8132994030462245505) apply status to be: "in-sync", got: "pending-reboot"
--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_ParameterGroupName (1761.14s)
	testing.go:527: Step 0 error: Check failed: Check 5/5 error: expected DB Instance (tf-acc-test-632112102194298217) Parameter Group (tf-acc-test-632112102194298217) apply status to be: "in-sync", got: "pending-reboot"
```
@bflad bflad force-pushed the b-aws_db_instance-replica-sg-pg branch from 1883d7c to d90aa04 Compare August 27, 2018 00:46
@bflad bflad added this to the v1.34.0 milestone Aug 30, 2018
@bflad bflad merged commit 96bc1a6 into master Aug 30, 2018
@bflad bflad deleted the b-aws_db_instance-replica-sg-pg branch August 30, 2018 12:28
bflad added a commit that referenced this pull request Aug 30, 2018
@bflad
Copy link
Contributor Author

bflad commented Aug 30, 2018

This has been released in version 1.34.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
2 participants