Skip to content

Commit

Permalink
Fixed the InvalidParameterCombination for the table aws_rds_db_instan…
Browse files Browse the repository at this point in the history
…ce (#2085)
  • Loading branch information
ParthaI authored Feb 23, 2024
1 parent 3d7f19e commit 1396be1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
10 changes: 8 additions & 2 deletions aws/table_aws_rds_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

rdsv1 "github.com/aws/aws-sdk-go/service/rds"

"github.com/turbot/go-kit/helpers"
"github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform"
Expand Down Expand Up @@ -632,9 +633,14 @@ func getRDSDBInstanceProcessorFeatures(ctx context.Context, d *plugin.QueryData,
return nil, err
}

// https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeOrderableDBInstanceOptions.html
// Return nil if unsupported engine type
if !helpers.StringSliceContains([]string{"aurora-mysql", "aurora-postgresql", "custom-oracle-ee", "db2-ae", "db2-se", "mariadb", "mysql", "oracle-ee", "oracle-ee-cdb", "oracle-se2", "oracle-se2-cdb", "postgres", "sqlserver-ee", "sqlserver-se", "sqlserver-ex", "sqlserver-web"}, *dbInstance.Engine) {
return nil, nil
}

params := &rds.DescribeOrderableDBInstanceOptionsInput{
Engine: dbInstance.Engine,
EngineVersion: dbInstance.EngineVersion,
DBInstanceClass: dbInstance.DBInstanceClass,
AvailabilityZoneGroup: aws.String(d.EqualsQualString(matrixKeyRegion)),
}
Expand All @@ -646,7 +652,7 @@ func getRDSDBInstanceProcessorFeatures(ctx context.Context, d *plugin.QueryData,
}

for _, p := range op.OrderableDBInstanceOptions {
if *p.StorageType == *dbInstance.StorageType {
if *p.StorageType == *dbInstance.StorageType && *p.EngineVersion == *dbInstance.EngineVersion {
// Match the RDS insance Availability Zone
for _, a := range p.AvailabilityZones {
if *a.Name == *dbInstance.AvailabilityZone {
Expand Down
31 changes: 31 additions & 0 deletions docs/tables/aws_rds_db_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,35 @@ from
aws_rds_db_instance
where
julianday('now') - julianday(json_extract(certificate, '$.ValidTill')) >= 90;
```

### Listing RDS DB Instances with Existing Processor Features
Supports Infrastructure as Code (IaC) and Automation For organizations using IaC practices or automation in their cloud environments, such queries can help in generating reports, monitoring configurations, or triggering workflows based on the state of RDS instances.

```sql+postgres
select
db_instance_identifier,
class,
engine,
engine_version,
kms_key_id,
processor_features
from
aws_rds_db_instance
where
processor_features not null;
```

```sql+sqlite
select
db_instance_identifier,
class,
engine,
engine_version,
kms_key_id,
processor_features
from
aws_rds_db_instance
where
processor_features not null;
```

0 comments on commit 1396be1

Please sign in to comment.