{"id":20695633,"url":"https://github.com/ibm-cloud/terraform-opa-ibm","last_synced_at":"2025-08-18T17:08:56.851Z","repository":{"id":39585339,"uuid":"312616730","full_name":"IBM-Cloud/terraform-opa-ibm","owner":"IBM-Cloud","description":"An OPA library to develop IT Control policies, for the IBM Cloud","archived":false,"fork":false,"pushed_at":"2022-09-26T07:24:02.000Z","size":6093,"stargazers_count":17,"open_issues_count":0,"forks_count":9,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-28T14:03:00.743Z","etag":null,"topics":["ibm-cloud","open-policy-agent","rego","terraform"],"latest_commit_sha":null,"homepage":"","language":"Open Policy Agent","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IBM-Cloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-13T15:43:28.000Z","updated_at":"2025-01-10T15:13:35.000Z","dependencies_parsed_at":"2022-08-28T22:52:04.249Z","dependency_job_id":null,"html_url":"https://github.com/IBM-Cloud/terraform-opa-ibm","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/IBM-Cloud/terraform-opa-ibm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Cloud%2Fterraform-opa-ibm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Cloud%2Fterraform-opa-ibm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Cloud%2Fterraform-opa-ibm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Cloud%2Fterraform-opa-ibm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IBM-Cloud","download_url":"https://codeload.github.com/IBM-Cloud/terraform-opa-ibm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Cloud%2Fterraform-opa-ibm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271027687,"owners_count":24687082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ibm-cloud","open-policy-agent","rego","terraform"],"created_at":"2024-11-17T00:10:14.346Z","updated_at":"2025-08-18T17:08:56.829Z","avatar_url":"https://github.com/IBM-Cloud.png","language":"Open Policy Agent","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# terraform-opa-ibm\n\n-   [Introduction](#introduction)\n-   [How does terraform-opa-ibm work?](#how-does-terraform-opa-ibm-work)\n-   [Framework structure](#framework-structure)\n-   [Evaluating terraform-plan locally](#running-terraform-opa-ibm-locally)\n\n\n## Introduction\n\nThis is a Rego based policy library, the policy language used by the Open Policy Agent (OPA), for the `IBM Cloud Provider plugin for Terraform`.  It is designed to be a helper, for your own OPA Policy repository.  This Rego library provides a simple abstractions to read the policy-information generated by Terraform, in a common and consistent manner.  For example, the terraform generated `plan json` file and the `state` file.  It also include a set of generic and customizable Rego rules for IBM Cloud resources, provisioned using `IBM Cloud Provider plugin for Terraform`. It can be used in your DevOps pipelines, to assess for potential mis-configurations or compliance violations in IBM Cloud, prior to the infrastructure deployment.  Use this library to develop the following types of IT Controls policies:\n\n- Naming \u0026 tagging policy\n- Configuration threshold policy\n- Resource sizing policy\n- IAM Security policy\n- Network Security policy\n- Data Security policy\n- Change management policy\n- and more..\n\n## Framework structure\n\nThe directory structure for the framework is as shown below.\n\n```\nterraform-opa-ibm\n├── README.md\n├── lib\n│   ├── plan\n│   │   └── base_tfplan.rego\n│   └── state\n│       └── state.rego\n└── resources\n    ├── ibm_container_vpc_cluster\n    │   └── ibm_container_vpc_cluster.rego\n    ├── ibm_is_public_gateway\n    │   └── ibm_is_public_gateway.rego\n    ├── ibm_is_subnet\n    │   └── ibm_is_subnet.rego\n    └── ibm_is_vpc\n        └── ibm_is_vpc.rego\n    .\n    .\n    .\n```\n\n- lib directory has Rego functions for terraform plan and generic rules.\n- resources directory has the rules-evaluation logic for individual ibmcloud resource.\n\n\n## Evaluating terraform-plan locally\n\nInstall the prerequisites:\n\n- [Open Policy Agent](https://www.openpolicyagent.org/docs/latest/#1-download-opa)\n- [Terraform 0.12+](https://www.terraform.io/downloads.html)\n\n## How does terraform-opa-ibm work?\n\nterraform-opa-ibm provides a Rego based function to read the IBM Cloud 'resource' information, provisioned using `IBM Cloud Provider plugin for Terraform`. The functions available to read:\n\n* Resource information from Terraform plan file.\n* Resource information from Terraform state file.\n\n##  How to use terraform-opa-ibm in the users policy repo:\n\n### Run the following command:\n\n`git-vendor https://github.com/IBM-Cloud/terraform-opa-ibm.git`\n\nUse the the directory where `terraform-opa-ibm` is vendored and Rego code defined while evaluating the policy. \n\nSome example:\n\n* To check Terraform plan file against `terraform-op-ibm` based rules:\n   \n  ```opa eval --format pretty  -d \u003cpath_to_terraform-opa-ibm based rule\u003e -d \u003cpath-to-plan-json-file\u003e \"data.terraform.analysis.ibm.cos\"```\n   \n* To check Terraform state file against `terraform-op-ibm` based rules:\n   \n  ```opa eval --format pretty  -d \u003cpath_to_terraform-opa-ibm based rule\u003e -d \u003cpath-to-state-json-file\u003e \"data.terraform.analysis.ibm.cos\"```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibm-cloud%2Fterraform-opa-ibm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibm-cloud%2Fterraform-opa-ibm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibm-cloud%2Fterraform-opa-ibm/lists"}