forked from epam/ecc-aws-rulepack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: added policy ecc-aws-578-reserved_ec2_instance_payment_pending
- Loading branch information
1 parent
4ad2fb0
commit 2115d78
Showing
5 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
policies/ecc-aws-578-reserved_ec2_instance_payment_pending.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2023 EPAM Systems, Inc. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
|
||
policies: | ||
- name: ecc-aws-578-reserved_ec2_instance_payment_pending | ||
comment: '010008032000' | ||
description: | | ||
Amazon EC2 reserved instance payment pending | ||
resource: aws.ec2-reserved | ||
filters: | ||
- type: value | ||
key: State | ||
value: payment-pending | ||
- type: value | ||
key: Start | ||
value_type: age | ||
op: ge | ||
value: 0.5 |
12 changes: 12 additions & 0 deletions
12
terraform/ecc-aws-578-reserved_ec2_instance_payment_pending/iam/578-policy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"ec2:DescribeReservedInstances" | ||
], | ||
"Resource": "*" | ||
} | ||
] | ||
} |
59 changes: 59 additions & 0 deletions
59
...-reserved_ec2_instance_payment_pending/placebo-green/ec2.DescribeReservedInstances_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"ReservedInstances": [ | ||
{ | ||
"Duration": 31536000, | ||
"End": { | ||
"__class__": "datetime", | ||
"year": 2020, | ||
"month": 2, | ||
"day": 23, | ||
"hour": 11, | ||
"minute": 25, | ||
"second": 2, | ||
"microsecond": 0 | ||
}, | ||
"FixedPrice": 30.0, | ||
"InstanceCount": 1, | ||
"InstanceType": "t2.micro", | ||
"ProductDescription": "Linux/UNIX", | ||
"ReservedInstancesId": "32881ecb-6734-4b79-94a0-26c759c2da38", | ||
"Start": { | ||
"__class__": "datetime", | ||
"year": 2019, | ||
"month": 2, | ||
"day": 23, | ||
"hour": 11, | ||
"minute": 25, | ||
"second": 3, | ||
"microsecond": 340000 | ||
}, | ||
"State": "active", | ||
"UsagePrice": 0.0, | ||
"CurrencyCode": "USD", | ||
"InstanceTenancy": "default", | ||
"OfferingClass": "standard", | ||
"OfferingType": "Partial Upfront", | ||
"RecurringCharges": [ | ||
{ | ||
"Amount": 0.0034, | ||
"Frequency": "Hourly" | ||
} | ||
], | ||
"Scope": "Region" | ||
} | ||
], | ||
"ResponseMetadata": { | ||
"RequestId": "cfd41aad-88c0-4975-9725-f2385aaa5852", | ||
"HTTPStatusCode": 200, | ||
"HTTPHeaders": { | ||
"content-type": "text/xml;charset=UTF-8", | ||
"content-length": "1267", | ||
"date": "Sat, 23 Feb 2019 11:45:27 GMT", | ||
"server": "AmazonEC2" | ||
}, | ||
"RetryAttempts": 0 | ||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...78-reserved_ec2_instance_payment_pending/placebo-red/ec2.DescribeReservedInstances_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"ReservedInstances": [ | ||
{ | ||
"Duration": 31536000, | ||
"End": { | ||
"__class__": "datetime", | ||
"year": 2020, | ||
"month": 2, | ||
"day": 23, | ||
"hour": 11, | ||
"minute": 25, | ||
"second": 2, | ||
"microsecond": 0 | ||
}, | ||
"FixedPrice": 30.0, | ||
"InstanceCount": 1, | ||
"InstanceType": "t2.micro", | ||
"ProductDescription": "Linux/UNIX", | ||
"ReservedInstancesId": "32881ecb-6734-4b79-94a0-26c759c2da38", | ||
"Start": { | ||
"__class__": "datetime", | ||
"year": 2019, | ||
"month": 2, | ||
"day": 23, | ||
"hour": 11, | ||
"minute": 25, | ||
"second": 3, | ||
"microsecond": 340000 | ||
}, | ||
"State": "payment-pending", | ||
"UsagePrice": 0.0, | ||
"CurrencyCode": "USD", | ||
"InstanceTenancy": "default", | ||
"OfferingClass": "standard", | ||
"OfferingType": "Partial Upfront", | ||
"RecurringCharges": [ | ||
{ | ||
"Amount": 0.0034, | ||
"Frequency": "Hourly" | ||
} | ||
], | ||
"Scope": "Region" | ||
} | ||
], | ||
"ResponseMetadata": { | ||
"RequestId": "cfd41aad-88c0-4975-9725-f2385aaa5852", | ||
"HTTPStatusCode": 200, | ||
"HTTPHeaders": { | ||
"content-type": "text/xml;charset=UTF-8", | ||
"content-length": "1267", | ||
"date": "Sat, 23 Feb 2019 11:45:27 GMT", | ||
"server": "AmazonEC2" | ||
}, | ||
"RetryAttempts": 0 | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/ecc-aws-578-reserved_ec2_instance_payment_pending/red_policy_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class PolicyTest(object): | ||
|
||
def test_resources_with_client(self, base_test, resources, local_session): | ||
base_test.assertEqual(len(resources), 1) | ||
base_test.assertEqual(resources[0]['State'], "payment-pending") |