Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshat0694 committed Dec 4, 2023
1 parent d9e91e8 commit 1cc2591
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Tirith scans declarative Infrastructure as Code (IaC) configurations like Terraf

<!-- - [Feature Road-Map](#feature-road-map) -->
<!-- - [Local Development Environment](#local-development-environment) -->

- [Features](#features)
- [Usage](#usage)
- [Example Tirith policies](#example-tirith-policies)
Expand Down Expand Up @@ -42,15 +43,16 @@ This is only a list of approved features that will be included in Tirith over th
- Extended library of evaluator functions -->

## Usage

```
usage: tirith [-h] [-policy-path PATH] [-input-path SOURCE-TYPE] [--json] [--verbose] [--version]
usage: tirith [-h] [-policy-path PATH] [-input-path PATH] [--json] [--verbose] [--version]
Tirith (StackGuardian Policy Framework)
optional arguments:
-h, --help show this help message and exit
-policy-path PATH Path containing Tirith policy as code
-input-path SOURCE-TYPE Input file path
-input-path PATH Input file path
--json Only print the result in JSON form (useful for passing output to other programs)
--verbose Show detailed logs of from the run
--version show program's version number and exit
Expand All @@ -61,6 +63,7 @@ optional arguments:
[Examples using various providers](tests/providers)

1. VPC and EC2 instance policy (using Terraform plan provider)

- AWS VPC instance_tenancy is "default"
- EC2 instance cannot be destroyed

Expand All @@ -72,7 +75,7 @@ optional arguments:
},
"evaluators": [
{
"id": "check_ec2_tags_are_present",
"id": "check_ec2_tenancy",
"provider_args": {
"operation_type": "attribute",
"terraform_resource_type": "aws_vpc",
Expand All @@ -84,22 +87,23 @@ optional arguments:
}
},
{
"id": "destroy_ec2",
"provider_args": {
"operation_type": "action",
"terraform_resource_type": "aws_instance"
},
"condition": {
"type": "ContainedIn",
"value": ["destroy"]
},
"id": "destroy_ec2"
}
}
],
"eval_expression": "check_ec2_tags_are_present && !destroy_ec2"
"eval_expression": "check_ec2_tenancy && !destroy_ec2"
}
```

2. Cost control policy (using Infracost provider)

- EC2 instance cost is lower than 100 USD per month

```json
Expand All @@ -110,22 +114,23 @@ optional arguments:
},
"evaluators": [
{
"id": "ec2_cost_below_100_per_month",
"provider_args": {
"operation_type": "total_monthly_cost",
"resource_type": ["aws_ec2"]
},
"condition": {
"type": "LessThanEqualTo",
"value": 100
},
"id": "ec2_cost_below_100_per_month"
}
}
],
"eval_expression": "ec2_cost_below_100_per_month"
}
```

3. StackGuardian Workflow Policy (using SG workflow provider)

- Terraform Workflow should require an approval to create or destroy resources

```json
Expand All @@ -136,22 +141,23 @@ optional arguments:
},
"evaluators": [
{
"id": "require_approval_before_creating_ec2",
"provider_args": {
"operation_type": "attribute",
"workflow_attribute": "approvalPreApply"
},
"condition": {
"type": "Equals",
"value": true
},
"id": "require_approval_before_creating_ec2"
}
}
],
"eval_expression": "require_approval_before_creating_ec2"
}
```

4. Make sure that all AWS ELBs are attached to security group (using Terraform plan provider)

```json
{
"meta": {
Expand All @@ -178,6 +184,7 @@ optional arguments:
```

5. Make sure that all `aws_s3_bucket` are referenced by `aws_s3_bucket_intelligent_tiering_configuration` (using Terraform plan provider)

```json
{
"meta": {
Expand Down Expand Up @@ -205,6 +212,7 @@ optional arguments:
```

6. Kubernetes (using Kubernetes provider)

- Make sure that all pods have a liveness probe defined

```json
Expand Down Expand Up @@ -232,7 +240,6 @@ optional arguments:
}
```


<!-- ## Local Development Environment
- [Python 3.6 or higher](https://www.python.org/downloads/) is required.
Expand Down
2 changes: 1 addition & 1 deletion src/tirith/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, prog="PROG") -> None:
)
parser.add_argument(
"-input-path",
metavar="SOURCE-TYPE",
metavar="PATH",
type=str,
dest="inputPath",
help="Input file path",
Expand Down

0 comments on commit 1cc2591

Please sign in to comment.