aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap
[AWS::RDS::DBInstance] - [BUG] - Cannot delete DBInstance through CloudControl API
- Dominant language
- No language data
- Stars
- 1.1k
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
### Name of the resource
AWS::RDS::DBInstance
### Resource Name
_No response_
### Issue Description
It is not possible to delete a `DBInstance` that is part of a `DBCluster` via the CloudControl API. This issue was originally reported in the [pulumi-aws-native](https://github.com/pulumi/pulumi-aws-native/issues/874) repo which uses the CloudControl API to manage resources.
### Expected Behavior
I expect to be able to delete the instance successfully.
### Observed Behavior
You get this error message
```console
operation DELETE failed with "InvalidRequest": FinalDBSnapshotIdentifier can not be specified when deleting a cluster instance
```
### Test Cases
Create an RDS Cluster and a RDS Instance as part of that cluster. For example:
```yaml
Parameters:
Username:
NoEcho: 'true'
Description: Username for Aurora MySQL database access
Type: String
MinLength: '1'
MaxLength: '16'
Default: "bevelvoerder"
AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
ConstraintDescription: must begin with a letter and contain only alphanumeric characters.
Password:
NoEcho: 'true'
Description: Password for Aurora MySQL database access
Type: String
MinLength: '8'
MaxLength: '41'
Default: "Passw0rd"
AllowedPattern: '[a-zA-Z0-9]*'
ConstraintDescription: must contain only alphanumeric characters.
Resources:
RDSCluster:
Type: 'AWS::RDS::DBCluster'
Properties:
MasterUsername:
Ref: Username
MasterUserPassword:
Ref: Password
Engine: aurora-mysql
DBClusterParameterGroupName:
Ref: RDSDBClusterParameterGroup
RDSDBInstance:
Type: 'AWS::RDS::DBInstance'
Properties:
DBParameterGroupName:
Ref: RDSDBParameterGroup
Engine: aurora-mysql
DBClusterIdentifier:
Ref: RDSCluster
PubliclyAccessible: 'true'
DBInstanceClass: db.r3.xlarge
RDSDBClusterParameterGroup:
Type: 'AWS::RDS::DBClusterParameterGroup'
Properties:
Description: CloudFormation Sample Aurora Cluster Parameter Group
Family: aurora5.6
Parameters:
time_zone: US/Eastern
RDSDBParameterGroup:
Type: 'AWS::RDS::DBParameterGroup'
Properties:
Description: CloudFormation Sample Aurora Parameter Group
Family: aurora5.6
Parameters:
sql_mode: IGNORE_SPACE
max_allowed_packet: 1024
innodb_buffer_pool_size: '{DBInstanceClassMemory*3/4}'
```
Then try to delete the instance using the CloudControl API
```console
aws cloudcontrol delete-resource --identifier IDENTIFIER --type-name 'AWS::RDS::DBInstance'
```
### Other Details
I'm not 100% sure how the `delete` operation works in CCAPI, especially since you cannot pass any parameters, but my hunch is that this error is due to [this code](https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-rds/blob/546170a703a1da8fa40520cf442e8efc21d68129/aws-rds-dbinstance/src/main/java/software/amazon/rds/dbinstance/DeleteHandler.java#L46-L59) that assigns a default value for the `FinalSnapshotIdentifier`. My hunch is that when the request is sent via the CCAPI, the cluster identifier is not part of the request.
Contributor guide
Assessment
This issue has not been assessed yet.