Parliament checks IAM policy validity against the latest AWS IAM specifications, so e.g. It'll pick up if your policy uses an older Action like billing:*, instead of the current aws-portal:*
By default, Parliament runs only on JSON IAM policies, not Terraform files. However I wanted to validate my Terraform files.
This utility parses your Terraform, finds aws_iam_policy_document elements, generates resulting IAM policy document strings, and runs Parliament on them.
It stubs any Terraform interpolations ${...} so they can be evaluated by Parliament as valid JSON.

| Resource Type | Supported? |
|---|---|
aws_iam_policy | Yes only inline policy not file() |
aws_iam_policy_document | Yes |
aws_iam_user_policy | No |
aws_iam_group_policy | No |
aws_iam_role_policy | No |
aws_s3_bucket_policy | No |
aws_[ecr|efs|iot|media_store_container|organizations]*_policy | No |
data.template_file | No |
The unsupported resource types should be pretty easy to add, if anyone feels a PR coming on :)
RESOURCE_MISMATCH if you have a policy with action Get* and resource ending in /* (referring to objects in a bucket), since s3:Get* includes some permissions which are bucket-level, not object-level. I have tried allowing you to ignore this by implementing config override per Parliament doco, and calling parliament.override_config(), to no availUse /github/workspace/ to mount the directory containing the Terraform, since this image is intended to run as a GitHub action:
| Intention | Command |
|---|---|
| Run on the entire directory | docker run --rm -ti -v (pwd):/github/workspace/ rdkls/tf-parliament |
| Run on one file | docker run --rm -ti -v (pwd):/github/workspace/ rdkls/tf-parliament iam.tf |
| Run on some TF files only | docker run --rm -ti -v (pwd):/github/workspace/ rdkls/tf-parliament 'iam-*.tf' |
Notes
(pwd), in bash switch that to `pwd`pip install -r requirements.txt
tf-parliament.py my-template.tf
(also supports wildcards & directories per Docker method)
Content type
Image
Digest
Size
51.2 MB
Last updated
over 5 years ago
docker pull rdkls/tf-parliament