When I ran terraform-compliance on the repository present in the aws codecommit , the terraform-compliance throws the error:
File "C:\Users\AKewal\AppData\Local\Programs\Python\Python310\lib\site-packages\terraform_compliance\main.py", line 95, in cli
raise ValueError("Bad feature directory:" + args.features)
ValueError: Bad feature directory:https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MY_REPO
Suggested Solution description ( if you have any ):
I have looked over the code and found out it supports only URL ending with *.git
if args.features.startswith(('http', 'https', 'ssh')):
# Default to master branch and full repository
if args.features.endswith('.git'):
features_git_repo = args.features
features_git_branch = "master"
# Optionally allow for directory and branch
elif '.git//' in args.features and '?ref=' in args.features:
# Split on .git/
features_git_list = args.features.split('.git/', 1)
# Everything up to .git is the repository
features_git_repo = features_git_list[0] + '.git'
# Split the directory and branch ref
features_git_list = features_git_list[1].split('?ref=', 1)
features_dir = features_git_list[0]
features_git_branch = features_git_list[1]
else: # invalid
raise ValueError("Bad feature directory:" + args.features)
Support for aws codecommit private git repository
When I ran terraform-compliance on the repository present in the aws codecommit , the terraform-compliance throws the error:
Suggested Solution description ( if you have any ): I have looked over the code and found out it supports only URL ending with *.git
AWS Codecommit git URL sample: https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MY_REPO. I tweaked the code and didn't filter this url based on .git ending and was able to clone the repo and run the terraform compliance command successfully.
Sharing code snippet here