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

⭐ Add new properties to aws.rds.dbInstances #2006

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 13 additions & 1 deletion providers/aws/resources/aws.lr
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ private aws.rds.snapshot @defaults("arn") {
}

// Amazon RDS Database Instance
private aws.rds.dbinstance @defaults("arn") {
private aws.rds.dbinstance @defaults("id region engine engineVersion") {
// ARN for the database instance
arn string
// Name of the database instance
Expand All @@ -1215,8 +1215,16 @@ private aws.rds.dbinstance @defaults("arn") {
snapshots() []aws.rds.snapshot
// Denotes whether the instance is encrypted
storageEncrypted bool
// The amount of storage, in GiB, provisioned on the instance
storageAllocated int
// The storage IOPS provisioned on the instance
storageIops int
// The type of storage provisioned on the instance
storageType string
// Region where the instance exists
region string
// Availability zone where the instance exists
availabilityZone string
// Denotes whether or not the instance is publicly accessible
publiclyAccessible bool
// List of log types the instance is configured to export to cloudwatch logs
Expand All @@ -1237,12 +1245,16 @@ private aws.rds.dbinstance @defaults("arn") {
dbInstanceIdentifier string
// Name of the database engine for this DB instance
engine string
// The version of the database engine for this DB instance
engineVersion string
// List of VPC security group elements that the DB instance belongs to
securityGroups []aws.ec2.securitygroup
// Current state of this database
status string
// Indicates whether minor version patches are applied automatically
autoMinorVersionUpgrade bool
// The creation date of the RDS instance
creationDate time
}

// Amazon ElastiCache
Expand Down
72 changes: 72 additions & 0 deletions providers/aws/resources/aws.lr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions providers/aws/resources/aws.lr.manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,11 @@ resources:
arn: {}
autoMinorVersionUpgrade:
min_mondoo_version: 8.22.0
availabilityZone:
min_mondoo_version: 9.0.0
backupRetentionPeriod: {}
creationDate:
min_mondoo_version: 9.0.0
dbInstanceClass:
min_mondoo_version: 5.19.1
dbInstanceIdentifier:
Expand All @@ -1811,6 +1815,8 @@ resources:
enabledCloudwatchLogsExports: {}
engine:
min_mondoo_version: 5.19.1
engineVersion:
min_mondoo_version: 9.0.0
enhancedMonitoringResourceArn: {}
id: {}
multiAZ: {}
Expand All @@ -1822,7 +1828,13 @@ resources:
snapshots: {}
status:
min_mondoo_version: 5.19.1
storageAllocated:
min_mondoo_version: 9.0.0
storageEncrypted: {}
storageIops:
min_mondoo_version: 9.0.0
storageType:
min_mondoo_version: 9.0.0
tags: {}
is_private: true
min_mondoo_version: 5.15.0
Expand Down
28 changes: 17 additions & 11 deletions providers/aws/resources/aws_rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,29 @@ func (a *mqlAwsRds) getDbInstances(conn *connection.AwsConnection) []*jobpool.Jo
mqlDBInstance, err := CreateResource(a.MqlRuntime, "aws.rds.dbinstance",
map[string]*llx.RawData{
"arn": llx.StringData(convert.ToString(dbInstance.DBInstanceArn)),
"name": llx.StringData(convert.ToString(dbInstance.DBName)),
"autoMinorVersionUpgrade": llx.BoolData(dbInstance.AutoMinorVersionUpgrade),
"availabilityZone": llx.StringData(convert.ToString(dbInstance.AvailabilityZone)),
"backupRetentionPeriod": llx.IntData(int64(dbInstance.BackupRetentionPeriod)),
"storageEncrypted": llx.BoolData(dbInstance.StorageEncrypted),
"region": llx.StringData(regionVal),
"publiclyAccessible": llx.BoolData(dbInstance.PubliclyAccessible),
"enabledCloudwatchLogsExports": llx.ArrayData(stringSliceInterface, types.String),
"enhancedMonitoringResourceArn": llx.StringData(convert.ToString(dbInstance.EnhancedMonitoringResourceArn)),
"multiAZ": llx.BoolData(dbInstance.MultiAZ),
"id": llx.StringData(convert.ToString(dbInstance.DBInstanceIdentifier)),
"deletionProtection": llx.BoolData(dbInstance.DeletionProtection),
"tags": llx.MapData(rdsTagsToMap(dbInstance.TagList), types.String),
"dbInstanceClass": llx.StringData(convert.ToString(dbInstance.DBInstanceClass)),
"dbInstanceIdentifier": llx.StringData(convert.ToString(dbInstance.DBInstanceIdentifier)),
"deletionProtection": llx.BoolData(dbInstance.DeletionProtection),
"enabledCloudwatchLogsExports": llx.ArrayData(stringSliceInterface, types.String),
"engine": llx.StringData(convert.ToString(dbInstance.Engine)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use can use llx.StringDataPtr here

"engineVersion": llx.StringData(convert.ToString(dbInstance.EngineVersion)),
"enhancedMonitoringResourceArn": llx.StringData(convert.ToString(dbInstance.EnhancedMonitoringResourceArn)),
"id": llx.StringData(convert.ToString(dbInstance.DBInstanceIdentifier)),
"multiAZ": llx.BoolData(dbInstance.MultiAZ),
"name": llx.StringData(convert.ToString(dbInstance.DBName)),
"publiclyAccessible": llx.BoolData(dbInstance.PubliclyAccessible),
"region": llx.StringData(regionVal),
"securityGroups": llx.ArrayData(sgs, types.Resource("aws.ec2.securitygroup")),
"status": llx.StringData(convert.ToString(dbInstance.DBInstanceStatus)),
"autoMinorVersionUpgrade": llx.BoolData(dbInstance.AutoMinorVersionUpgrade),
"storageAllocated": llx.IntData(int64(dbInstance.AllocatedStorage)),
"storageEncrypted": llx.BoolData(dbInstance.StorageEncrypted),
"storageType": llx.StringData(convert.ToString(dbInstance.StorageType)),
"storageIops": llx.IntData(convert.ToInt64From32(dbInstance.Iops)),
"tags": llx.MapData(rdsTagsToMap(dbInstance.TagList), types.String),
"creationDate": llx.TimeData(toTime(dbInstance.InstanceCreateTime)),
})
if err != nil {
return nil, err
Expand Down