Skip to content

Commit

Permalink
r/aws_db_instance: Set 'listener_endpoint' even if API result is nil.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Mar 7, 2023
1 parent ec0f18c commit bb2e200
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/service/rds/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,8 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte
if err := d.Set("listener_endpoint", []interface{}{flattenEndpoint(v.ListenerEndpoint)}); err != nil {
return sdkdiag.AppendErrorf(diags, "setting listener_endpoint: %s", err)
}
} else {
d.Set("listener_endpoint", nil)
}

dbSetResourceDataEngineVersionFromInstance(d, v)
Expand Down
2 changes: 2 additions & 0 deletions internal/service/rds/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func TestAccRDSInstance_basic(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName, "instance_class", "data.aws_rds_orderable_db_instance.test", "instance_class"),
resource.TestCheckResourceAttr(resourceName, "iops", "0"),
resource.TestCheckResourceAttr(resourceName, "license_model", "general-public-license"),
resource.TestCheckResourceAttr(resourceName, "listener_endpoint.#", "0"),
resource.TestCheckResourceAttrSet(resourceName, "maintenance_window"),
resource.TestCheckResourceAttr(resourceName, "max_allocated_storage", "0"),
resource.TestCheckResourceAttr(resourceName, "name", "test"),
Expand Down Expand Up @@ -2827,6 +2828,7 @@ func TestAccRDSInstance_SnapshotIdentifier_multiAZSQLServer(t *testing.T) {
testAccCheckInstanceExists(ctx, sourceDbResourceName, &sourceDbInstance),
testAccCheckDBSnapshotExists(ctx, snapshotResourceName, &dbSnapshot),
testAccCheckInstanceExists(ctx, resourceName, &dbInstance),
resource.TestCheckResourceAttr(resourceName, "listener_endpoint.#", "1"),
resource.TestCheckResourceAttr(resourceName, "multi_az", "true"),
),
},
Expand Down

0 comments on commit bb2e200

Please sign in to comment.