{"id":19474198,"url":"https://github.com/happypathway/sentinel-init","last_synced_at":"2026-02-05T20:33:42.523Z","repository":{"id":50030403,"uuid":"370442153","full_name":"HappyPathway/Sentinel-Init","owner":"HappyPathway","description":null,"archived":false,"fork":false,"pushed_at":"2021-06-05T22:30:30.000Z","size":666,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-25T15:48:36.451Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HappyPathway.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-24T18:02:29.000Z","updated_at":"2021-06-05T22:30:09.000Z","dependencies_parsed_at":"2022-09-07T17:02:22.497Z","dependency_job_id":null,"html_url":"https://github.com/HappyPathway/Sentinel-Init","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/HappyPathway/Sentinel-Init","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HappyPathway%2FSentinel-Init","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HappyPathway%2FSentinel-Init/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HappyPathway%2FSentinel-Init/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HappyPathway%2FSentinel-Init/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HappyPathway","download_url":"https://codeload.github.com/HappyPathway/Sentinel-Init/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HappyPathway%2FSentinel-Init/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266737574,"owners_count":23976389,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":[],"created_at":"2024-11-10T19:23:53.856Z","updated_at":"2026-02-05T20:33:42.481Z","avatar_url":"https://github.com/HappyPathway.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sentinel-policies\nThis repo contains all of our Sentinel Policies for Terrafom Enterprise. \nAs sentinel can be rather difficult to learn, the hope is that this repo makes \nit a bit easier to begin creating policies. \n\n## Boilerplate Code\nHashicorp has provided code to help get people started with sentinel, the code in the common-functions directory contains this code.\nIn each of the directories, you see a docs directory. These docs contain useful information as to how to best leverage this code. \nIn order to use this code, you will need to import it into whichever policy set you are workign on. If you look in other directories \n(not utils, we will cover that later), you will see a sentinel.hcl file. These sentinel.hcl files are where you declare your policies\nas well as specify the source for included libraries. \n\nFrom sentinel.hcl\n```hcl\nmodule \"tfrun-functions\" {\n    source = \"../common-functions/tfrun-functions/tfrun-functions.sentinel\"\n}\n```\n\nOnce you've specified the source of your library, you can include it in your policy. For instance,\n```hcl\nimport \"tfrun-functions\" as run\n```\n\n## Creating New Policies\nIn order to create a new policy, you'll need to add a new file with the sentinel file extension. \nThese policies can be as complex or as simple as you like. The followin is an example of a very simple policy.\n```hcl\nimport \"tfrun\"\nimport \"decimal\"\nimport \"tfrun-functions\" as run\n\nparam max_percentage default 15\n\n# Main rule\nmain = rule {\n  run.limit_percentage_increase(max_percentage)\n}\n```\n\n## Paremeterizing Policy\nThe above policy takes a parameter `max_percentage`. This parameter can be set from outside the policy, thereby allowing you to parameterize \nyour policy and enabling you to keep your code DRY (dont repeat yourself). This policy can now be applied to different workspaces without having\nto duplicate your code.\n\n\n## Apply Policy to Specific Workspaces\nIn order to apply policy to workspaces, you need to define a policy set. These policy sets work in such a way that anything included in your sentinel.hcl\nfile is automatically applied to the workspace. You can create multiple policy sets that leverage the same policies but have different policy set parameters attached. You can look at cost-optimization.tf as an example. This policy set uses the code in the cost-optimization directory to apply policy. Since the policy in link_percentage_increase.sentinel uses a parameter, there is nothing stopping me from creating another policy set that specifies a different parameter for the workspaces that will be attached to this new policy set. \n\n\n## utils directory\nThis directory contains useful scripts to help create terraform code for deploying policies into place. Currently, there's only one script `list_workspaces.py`, but over time there will be more. These scripts interact with the TFE provider using a custom Python Library\n```bash\nhttps://github.com/HappyPathway/PyTFE-Core\n```\nGit clone this library and then install locally by running \n```bash\npython setup.py install\n```\nOnce you have this library, you'll be able to run these scripts.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappypathway%2Fsentinel-init","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhappypathway%2Fsentinel-init","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappypathway%2Fsentinel-init/lists"}