{ "info": { "author": "ys-tydy", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Programming Language :: Python :: 3.6" ], "description": "# Terraform automatic reviewer\n\nterraform scripts checker.
\nThis package helps you to review your tf script.
\n(ex: confirm add logging rule to all s3 bucket)\n\n## 1 Installation\n\n```shell\n$ pip install tf_cop\n```\n\n\n## 2 Usage\n### 2.1 cli use\nat your console\n\n```shell\n$ tfcop TERRAFORM_ROOT_PATH REVIEW_BOOK_ROOT_PATH(optional)\n```\n\nsample output\n\n```shell\n\u2601 tf_cop [master] \u26a1 tfcop test\n[INFO] tf_root_path : test\n[INFO] rbook_root_path :\n\n==========================================================\nRESOURCE AWS_S3_BUCKET.TEST_TF_REVIEW_BUCKET\n==========================================================\n[WARN] desc_checker : description not use\n[ALERT] tag_checker : tags not use\n\n==========================================================\nRESOURCE AWS_S3_BUCKET.TEST_TF_REVIEW_BUCKET2\n==========================================================\n[WARN] desc_checker : description not use\n[PASS] tag_checker : passed\n[PASS] name_checker : passed\n[PASS] env_checker : passed\n\n==========================================================\nDATA AWS_S3_BUCKET.TEST_DATA_TF_REVIEW_BUCKET\n==========================================================\n[PASS] bucket_checker : passed\n\n =======================\n| RESOURCE NUM : 3 |\n| warn NUM : 2 |\n| alert NUM : 1 |\n| pass NUM : 4 |\n =======================\n```\n### 2.2 module use\n#### 2.2.1 do review\npass `terraform root path` & `review_book root path`\n\n```python\nimport tf_cop\n\nif __name__ == '__main__':\n test = tf_cop.TfCop()\n test.tf_review(\"./test\", \"./review_book_default\")\n```\n\n#### 2.2.2 get output\n\n```python\n output = test.output(color_flg=True)\n print(output)\n```\n\n## 3 Review_book yaml rule\n\n### 3.1 file name rule\n\n```python\nreview_book_yaml = resource_name.split(\"_\")[1] + '.yaml'\n```\n(ex. aws_s3_bucket => s3.yaml)\n\nfolder structure\n```\n${REVIEW_BOOK_ROOT_PATH}\n\u251c\u2500\u2500 data\n\u2502 \u251c\u2500\u2500s3.yaml\n\u2502\u00a0\u00a0 \u2514\u2500\u2500...\n\u2514\u2500\u2500 resource\n \u251c\u2500\u2500 acm.yaml\n \u251c\u2500\u2500 api.yaml\n \u00a0\u00a0 \u2514\u2500\u2500 ...\n```\n\n### 3.2 key rule\n\n|key |description |required|\n|---|---|---|\n|title |test title|required|\n|desc |description for test|option|\n|mode|test mode (existance\\|value\\|nested)|required|\n|key|test target key (ex. tags)|required|\n|value|correct value regex|option|\n|nest|for nested test|option|\n|type|test type (ex. alert, warn)|required|\n\n#### 3.2.1 existance test\ncheck if target key is exist.
\n(ex. description)\n\n#### 3.2.2 value test\ncheck if target value is correct.
\n(ex. name = \"(prd|stg|dev)-s3-.*-terraform\")\n\n#### 3.2.3 nested test\ntest to nested key_value\n```hcl\ntags {\n Name = \"${terraform.env}-tf-review-bucket\"\n Env = \"dev\"\n}\n```\n\n### 3.3 sample\n```yaml\naws_s3_bucket:\n-\n title: description_checker\n description: simple existance checker\n mode: existance\n warn: True\n key: description\n-\n title: private_checker\n description: simple value checker\n mode: value\n key: acl\n value: private\n-\n title: bucket_checker\n description: simple value regex checker\n mode: value\n key: bucket\n value: .*-tf-review-bucket.*\n-\n title: tag_checker\n description: nested value checker\n mode: nested\n key: tags\n nest:\n -\n title: name_checker\n description: nested value checker\n mode: value\n key: Name\n value: .*-tf-review-bucket.*\n -\n title: env_checker\n description: nested value checker\n mode: value\n warn: True\n key: Env\n value: (dev|stg|prd)\n-\n title: if_checker\n mode: if\n key: logging\n nest:\n title: name_checker\n mode: existance\n key: lifecycle_rule\n```\n\n## 4 Testing\n`python test.py`\n\n## 5 Sample usage\ntest terraform files using docker.\n\n```\n\u251c\u2500\u2500 Dockerfile\n\u251c\u2500\u2500 main.py\n\u2514\u2500\u2500 requirements.txt\n```\n\n```dockerfile\nFROM python:3.6\n\nRUN apt-get update\nENV LANG ja_JP.UTF-8\nENV LANGUAGE ja_JP:ja\nENV LC_ALL ja_JP.UTF-8\nENV TZ JST-9\n\nRUN pip install --upgrade pip\nRUN pip install --upgrade setuptools\n\nWORKDIR /tmp\n\nCOPY requirements.txt ./\nRUN pip install -r requirements.txt\n\nCOPY . .\n\nCMD [\"python\",\"main.py\"]\n```\n\n\n```python\nimport tf_cop\n\nif __name__ == '__main__':\n test = tf_cop.TfCop()\n test.tf_review(\"./terraform\", \"./review_book\")\n\n output = test.output(color_flg=True)\n print(output)\n```\n\nset `TF_ROOT_PATH` & `REVIEW_BOOK_PATH`\n\n```bash\ndocker build -t tf_cop .\ndocker run \\\n -v `pwd`/${TF_ROOT_PATH}:/tmp/terraform \\\n -v `pwd`/${REVIEW_BOOK_PATH}:/tmp/review_book \\\n tf_cop\n```\n\n## 6 Author\nys-tydy", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ys-tydy/tf_cop", "keywords": "terraform hcl review", "license": "ys-tydy", "maintainer": "", "maintainer_email": "", "name": "tf-cop", "package_url": "https://pypi.org/project/tf-cop/", "platform": "", "project_url": "https://pypi.org/project/tf-cop/", "project_urls": { "Homepage": "https://github.com/ys-tydy/tf_cop" }, "release_url": "https://pypi.org/project/tf-cop/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "auto terraform review", "version": "0.2.1" }, "last_serial": 4340801, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2f2fa5f2a564e3817c601c9a9297cfc8", "sha256": "a6d1b06935ee549e0e3c40555d1b2a67552b190c8c09cf92876cb03fccb0ac14" }, "downloads": -1, "filename": "tf_cop-0.0.1.tar.gz", "has_sig": false, "md5_digest": "2f2fa5f2a564e3817c601c9a9297cfc8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2777, "upload_time": "2018-09-29T14:13:49", "url": "https://files.pythonhosted.org/packages/77/e7/e7c02ed2a41c90e8e31639436d6f6ed2e8eed48d791aa7ede1f8d06d2435/tf_cop-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "1c8f10c1c730c0921ade88624af8fbfa", "sha256": "2e982cc8e463f56df7f5099dbbc6bd5db0975e01933025aebd5c7b1a8e63363b" }, "downloads": -1, "filename": "tf_cop-0.0.2.tar.gz", "has_sig": false, "md5_digest": "1c8f10c1c730c0921ade88624af8fbfa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3378, "upload_time": "2018-09-29T15:11:48", "url": "https://files.pythonhosted.org/packages/4a/f4/878e765af243fa438cf648072a9f977418039a1e548c9e1ffa1571d98cdd/tf_cop-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "219ce4c4e21eb38525c0f8c52ccfbd2d", "sha256": "e9fee6b470f074bbb12fedee39dc8a9f2519d4e12a2dfff6e98c2ea13ceff6ea" }, "downloads": -1, "filename": "tf_cop-0.0.3.tar.gz", "has_sig": false, "md5_digest": "219ce4c4e21eb38525c0f8c52ccfbd2d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4409, "upload_time": "2018-09-30T21:48:09", "url": "https://files.pythonhosted.org/packages/56/70/ee2361b6207b81d7c0175b473e740c08ea33908038c91d42613e415dc4b8/tf_cop-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "edc72fac57f789f492effcf5671b64e1", "sha256": "9a7041afadfbb20e04baa4af5b93751ee90b22bdf24b30f6dc3ba6d4991843c7" }, "downloads": -1, "filename": "tf_cop-0.0.4.tar.gz", "has_sig": false, "md5_digest": "edc72fac57f789f492effcf5671b64e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4420, "upload_time": "2018-09-30T21:51:48", "url": "https://files.pythonhosted.org/packages/2f/5f/2a9b9751a8a8df6d89f2025dc95dd1caa0961de7ee930a33d529abc27472/tf_cop-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "3815aefb3d8a068810b7e00e81e8cd15", "sha256": "4eb858f908326b912869d54ce99ed2d453bc468902b6ca0d827bddde43b3205b" }, "downloads": -1, "filename": "tf_cop-0.0.5.tar.gz", "has_sig": false, "md5_digest": "3815aefb3d8a068810b7e00e81e8cd15", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4429, "upload_time": "2018-09-30T21:58:04", "url": "https://files.pythonhosted.org/packages/37/c4/ea7f7e1bdee6db9375e97a9e815d0e8a00011ee30983f0e251b1600ca291/tf_cop-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "bf8d3964f73da91798add248c7547f36", "sha256": "b9aee913c1ad3f8a9e7c053c1aaa34c5ae384f6789f752bb89fd90be32935784" }, "downloads": -1, "filename": "tf_cop-0.0.6.tar.gz", "has_sig": false, "md5_digest": "bf8d3964f73da91798add248c7547f36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4777, "upload_time": "2018-09-30T22:02:07", "url": "https://files.pythonhosted.org/packages/e8/9b/e6b8a7be40c4e7a4bd071a2a6c1a559fad7f8dbfbe4eb67fa61cd6288fc0/tf_cop-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "2be77ddcbd056c04f9c9550b2136ed57", "sha256": "ab5a0c31d41741dbdae9661ef2b5a047da48691647f01a944fe96f289582b97b" }, "downloads": -1, "filename": "tf_cop-0.0.7.tar.gz", "has_sig": false, "md5_digest": "2be77ddcbd056c04f9c9550b2136ed57", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4784, "upload_time": "2018-09-30T22:20:03", "url": "https://files.pythonhosted.org/packages/fe/91/678022c9f48b8fc8decac5991a8348d18df3b482f974a5a63d47d6392f2d/tf_cop-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "fb7f86fe84a53bcf39f4d2c300412fdd", "sha256": "1ca1f7d824282d155cc3e8a4c7f2c7d767ce040e79718353a204a50a97e657c6" }, "downloads": -1, "filename": "tf_cop-0.0.8.tar.gz", "has_sig": false, "md5_digest": "fb7f86fe84a53bcf39f4d2c300412fdd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5269, "upload_time": "2018-09-30T22:36:51", "url": "https://files.pythonhosted.org/packages/8e/b3/c23b28ec82195055457584aa6550c614cdd23dc747d27af4f0ec97da89ef/tf_cop-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "769e2a0549b425d7ab4e12f35c6b64c2", "sha256": "5016297d6118cf1cc8b5abe9587d002b61c0b497a9aa05217f208fdd3712ac5c" }, "downloads": -1, "filename": "tf_cop-0.0.9.tar.gz", "has_sig": false, "md5_digest": "769e2a0549b425d7ab4e12f35c6b64c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5263, "upload_time": "2018-09-30T22:39:54", "url": "https://files.pythonhosted.org/packages/7e/56/b9ea437f4e2eb690106414583731aae1da6d9441df308eefd5993e58b900/tf_cop-0.0.9.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "e1feb77ebdd7b638c8496558aa7250ba", "sha256": "d313c7cdb53414a5921bb6eda1aa65a3ce0d64aae45ad9413aaa993f37c58348" }, "downloads": -1, "filename": "tf_cop-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e1feb77ebdd7b638c8496558aa7250ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6285, "upload_time": "2018-10-02T23:44:43", "url": "https://files.pythonhosted.org/packages/50/be/4e24615a944859e7a1b94cb922ab1bd6a281f714126e8686b9a44bbbfdb2/tf_cop-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "ea91d48a9311c5993839d6585e779dc3", "sha256": "8f1506e69e41bf29cc39bce563c1963d8058b1905973d6560273e6fc4c3add35" }, "downloads": -1, "filename": "tf_cop-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ea91d48a9311c5993839d6585e779dc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7649, "upload_time": "2018-10-03T16:31:40", "url": "https://files.pythonhosted.org/packages/d6/28/817a479b34154664096e9f11222772a2bc5e060b10d3174e530dd0d8a552/tf_cop-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "8383ee9065aa483f3d775536c0532dc5", "sha256": "89c86aacdc8ed1757dffa070a283ed761cfd403efee6188d0a0892d06d1f4cbb" }, "downloads": -1, "filename": "tf_cop-0.2.0.tar.gz", "has_sig": false, "md5_digest": "8383ee9065aa483f3d775536c0532dc5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8704, "upload_time": "2018-10-04T13:09:35", "url": "https://files.pythonhosted.org/packages/56/e2/c366be0437cb1419f41dd9526d53d93de667264dcaabb00a4e82ecf040ba/tf_cop-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "3cfe9bdef1818ee76cfc0fb604cca998", "sha256": "1b2307b9ef9f73c98796be35127852044b1ca2cd51cfff4c136802cac06281ab" }, "downloads": -1, "filename": "tf_cop-0.2.1.tar.gz", "has_sig": false, "md5_digest": "3cfe9bdef1818ee76cfc0fb604cca998", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8638, "upload_time": "2018-10-04T15:36:06", "url": "https://files.pythonhosted.org/packages/44/71/4ddb6f243c69dfed79fc891418f5393a06e7941f40765439f397bc872cee/tf_cop-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3cfe9bdef1818ee76cfc0fb604cca998", "sha256": "1b2307b9ef9f73c98796be35127852044b1ca2cd51cfff4c136802cac06281ab" }, "downloads": -1, "filename": "tf_cop-0.2.1.tar.gz", "has_sig": false, "md5_digest": "3cfe9bdef1818ee76cfc0fb604cca998", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8638, "upload_time": "2018-10-04T15:36:06", "url": "https://files.pythonhosted.org/packages/44/71/4ddb6f243c69dfed79fc891418f5393a06e7941f40765439f397bc872cee/tf_cop-0.2.1.tar.gz" } ] }