Skip to content

Commit 2aa0f25

Browse files
committed
fix: fix pennywise_cost_estimate
1 parent 740d0c0 commit 2aa0f25

File tree

169 files changed

+173
-173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+173
-173
lines changed

compliance/controls/baseline/aws/dynamoDb/aws_unused_dynamodb_table.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Query:
1111
kaytu_resource_id,
1212
kaytu_account_id,
1313
case
14-
when item_count::int = 0 then (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::dynamodb::table' and resource_id = t.kaytu_resource_id)
14+
when item_count::int = 0 then (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::dynamodb::table' and resource_id = t.kaytu_resource_id limit 1)
1515
else 0
1616
end as cost_optimization,
1717
case

compliance/controls/baseline/aws/ebs/aws_ebs_volume_unused.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Query:
1212
kaytu_resource_id as kaytu_resource_id,
1313
case
1414
when state = 'in-use' then 0
15-
else (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::ec2::volume' and resource_id = v.kaytu_resource_id)
15+
else (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::ec2::volume' and resource_id = v.kaytu_resource_id limit 1)
1616
end as cost_optimization,
1717
case
1818
when state = 'in-use' then 'ok'

compliance/controls/baseline/aws/ebs/aws_ebs_volumes_attached_to_stopped_ec2_instances.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Query:
1212
v.kaytu_account_id,
1313
case
1414
when i.instance_state = 'running' then 0
15-
else (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::ec2::volume' and resource_id = v.kaytu_resource_id)
15+
else (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::ec2::volume' and resource_id = v.kaytu_resource_id limit 1)
1616
end as cost_optimization,
1717
case
1818
when i.instance_state = 'running' then 'ok'

compliance/controls/baseline/aws/ebs/aws_ebs_volumes_too_old_snapshots.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Query:
1111
kaytu_resource_id,
1212
kaytu_account_id,
1313
CASE
14-
WHEN start_time + ({{.awsEbsSnapshotAgeMaxDays}}::INT || ' days')::interval < now() THEN (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::ec2::volumesnapshot' and resource_id = es.kaytu_resource_id)
14+
WHEN start_time + ({{.awsEbsSnapshotAgeMaxDays}}::INT || ' days')::interval < now() THEN (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::ec2::volumesnapshot' and resource_id = es.kaytu_resource_id limit 1)
1515
ELSE 0
1616
END AS cost_optimization,
1717
CASE

compliance/controls/baseline/aws/ec2/aws_ec2_ami_too_old.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Query:
2626
when is_aws_backup_managed then 0
2727
when root_device_type <> 'ebs' then 0
2828
when now() - (creation_date)::timestamp > '{{.awsEbsAmiAgeMaxDays}} days'::interval then (SELECT SUM((select cost from pennywise_cost_estimate AS es WHERE es.resource_type = 'aws::ec2::volumesnapshot'
29-
AND es.resource_id = s.arn))
29+
AND es.resource_id = s.arn limit 1))
3030
FROM jsonb_array_elements(block_device_mappings) AS bdm
3131
LEFT JOIN aws_ebs_snapshot AS s ON s.snapshot_id = bdm -> 'Ebs' ->> 'SnapshotId')
3232
else 0

compliance/controls/baseline/aws/ec2/aws_unused_ami.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Query:
2929
when is_aws_backup_managed then 0
3030
when ami.root_device_type <> 'ebs' then 0
3131
when i.arn is null then (SELECT SUM((select cost from pennywise_cost_estimate AS es WHERE es.resource_type = 'aws::ec2::volumesnapshot'
32-
AND es.resource_id = s.arn))
32+
AND es.resource_id = s.arn limit 1))
3333
FROM jsonb_array_elements(ami.block_device_mappings) AS bdm
3434
LEFT JOIN aws_ebs_snapshot AS s ON s.snapshot_id = bdm -> 'Ebs' ->> 'SnapshotId')
3535
else 0

compliance/controls/baseline/aws/load_balancer/aws_unused_application_load_balancers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Query:
2828
else a.title || ' has registered target of type ' || b.target_type || '.'
2929
end as reason,
3030
case
31-
when b.load_balancer_arn is null then (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::elasticloadbalancingv2::loadbalancer' and resource_id = a.kaytu_resource_id)
31+
when b.load_balancer_arn is null then (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::elasticloadbalancingv2::loadbalancer' and resource_id = a.kaytu_resource_id limit 1)
3232
else 0
3333
end as cost_optimization,
3434
a.region,

compliance/controls/baseline/aws/load_balancer/aws_unused_elastic_load_balancers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Query:
1212
kaytu_resource_id,
1313
case
1414
when jsonb_array_length(instances) > 0 then 0
15-
else (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::elasticloadbalancing::loadbalancer' and resource_id = lb.kaytu_resource_id)
15+
else (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::elasticloadbalancing::loadbalancer' and resource_id = lb.kaytu_resource_id limit 1)
1616
end as cost_optimization,
1717
case
1818
when jsonb_array_length(instances) > 0 then 'ok'

compliance/controls/baseline/aws/load_balancer/aws_unused_gateway_load_balancers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Query:
2020
kaytu_resource_id,
2121
kaytu_account_id,
2222
case
23-
when jsonb_array_length(b.target_health_descriptions) = 0 then (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::elasticloadbalancingv2::loadbalancer' and resource_id = a.kaytu_resource_id)
23+
when jsonb_array_length(b.target_health_descriptions) = 0 then (SELECT cost FROM pennywise_cost_estimate where resource_type = 'aws::elasticloadbalancingv2::loadbalancer' and resource_id = a.kaytu_resource_id limit 1)
2424
else 0
2525
end as cost_optimization,
2626
case

compliance/controls/baseline/aws/rds/aws_aurora_database_instance_accessibility.yaml

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Description: "Ensure that all database instances within an Amazon Aurora cluster
44
Connector:
55
- aws
66
Query:
7-
Engine: CloudQL-v0.0.1
7+
Engine: odysseus-v0.0.1
88
QueryToExecute: |-
99
with access_count as (
1010
select

0 commit comments

Comments
 (0)