mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-31 10:36:54 +00:00
Add check-iam to setup.cfg
This commit is contained in:
parent
92a6ab2106
commit
d1b059e84a
2 changed files with 8 additions and 5 deletions
|
|
@ -1,7 +1,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
from typing import Sequence
|
||||
|
||||
import hcl2
|
||||
# from typing import Any
|
||||
from typing import Sequence
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> int:
|
||||
|
|
@ -11,7 +14,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|||
|
||||
retval = 0
|
||||
for filename in args.filenames:
|
||||
if filename == "iam.tf":
|
||||
if filename == 'iam.tf':
|
||||
continue
|
||||
with open(filename, 'rb') as f:
|
||||
try:
|
||||
|
|
@ -23,14 +26,14 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|||
if resources:
|
||||
for item in resources:
|
||||
for keys in item:
|
||||
if key.startswith("aws_iam"):
|
||||
if key.startswith('aws_iam'):
|
||||
print(f'{filename}: Has {key} resource')
|
||||
retval = 1
|
||||
resources = data.get('data')
|
||||
if resources:
|
||||
for item in resources:
|
||||
for keys in item:
|
||||
if key.startswith("aws_iam"):
|
||||
if key.startswith('aws_iam'):
|
||||
print(f'{filename}: Has {key} data resource')
|
||||
retval = 1
|
||||
return retval
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue