{"id":19805976,"url":"https://github.com/cycloidio/cycloid-resource","last_synced_at":"2025-05-01T07:30:34.044Z","repository":{"id":46225172,"uuid":"381093020","full_name":"cycloidio/cycloid-resource","owner":"cycloidio","description":"Concourse resource to use Cycloid features inside pipelines","archived":false,"fork":false,"pushed_at":"2024-10-29T10:18:49.000Z","size":42,"stargazers_count":1,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T10:51:59.711Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cycloidio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-28T16:17:13.000Z","updated_at":"2024-10-29T10:18:31.000Z","dependencies_parsed_at":"2024-06-21T19:00:31.147Z","dependency_job_id":"3b7c5100-e2d6-450c-b436-25ecda55d024","html_url":"https://github.com/cycloidio/cycloid-resource","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Fcycloid-resource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Fcycloid-resource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Fcycloid-resource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Fcycloid-resource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cycloidio","download_url":"https://codeload.github.com/cycloidio/cycloid-resource/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251840098,"owners_count":21652275,"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","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-12T09:06:03.691Z","updated_at":"2025-05-01T07:30:33.746Z","avatar_url":"https://github.com/cycloidio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Infrapolicy Concourse resource\n\nThe goal of this resource is to perform a check of a generated Terraform Plan against Cycloid infrapolicies (link doc) in order to add more control on what's deployed with Terraform. It has been tested\nwith the Terraform concourse resource `ljfranklin/terraform-resource` but it can be used with any commands / resources providing a JSON terraform plan.\n\n## Usage\n\nFirst, declare your new resource type:\n\n```yaml\nresource_types:\n  - name: cycloid-resource\n    type: docker-image\n    source:\n      repository: cycloid/cycloid-resource\n      tag: latest\n```\n\nThen configure your resource:\n\n```yaml\nresources:\n\n# Infrapolicy resource\n  - name: infrapolicy\n    type: cycloid-resource\n    source:\n      feature: infrapolicy\n      api_key: \u003capi-key\u003e\n      api_url: ($ .api_url $)\n      env: ($ .environment $)\n      org: ($ .organization_canonical $)\n      project: ($ .project $)\n\n# Terracost resource\n  - name: terracost\n    type: cycloid-resource\n    source:\n      feature: terracost\n      api_key: \u003capi-key\u003e\n      api_url: ($ .api_url $)\n      env: ($ .environment $)\n      org: ($ .organization_canonical $)\n      project: ($ .project $)\n\n# Event resource\n  - name: event\n    type: cycloid-resource\n    source:\n      feature: event\n      api_key: \u003capi-key\u003e\n      api_url: ($ .api_url $)\n      env: ($ .environment $)\n      org: ($ .organization_canonical $)\n      project: ($ .project $)\n```\n\n\n## Parameters \n\n### Source configuration\n\n`feature`: _required_. The name of Cycloid feature to use, `terracost`, `infrapolicy` or `event`\n\n`api_key`: _required_. The Cycloid API key used to authenticate the resource against Cycloid APIs\n\n`project`: _required_. The name of the Cycloid project\n\n`env`: _required_. The environment name of the Cycloid project\n\n`org`: _required_. The organization name of the Cycloid project\n\n`api_url`: _optional_. Override the default API URL for infrapolicy validation \n\n### Put parameters for `event`\n\n`title`: _required_. The title of the event.\n\n`message` or `message_file`: _required_. One have to be specified, `message` message in the event body or `message_file` file path which contain the message for event body.\n\n`type`: _optional_. The type of the event. Currently, only Cycloid, Custom, AWS or Monitoring are allowed.\n\n`severity`: _optional_. The severity of the event. Currently, only info, warn, err or crit are allowed.\n\n`icon`: _optional_. Icon to display. The icons are the ones from Font Awesome. Example: fa-cubes https://fontawesome.com/search?o=r\u0026m=free\u0026f=classic\n\n`yaml_vars_file`: _optional_. Load vars from a file that you can use in event message or title. format MYKEY: value usage my title containing vars $MYKEY.\n\n`tags`: _optional_. The tags allow filtering. Example:\n\n```YAML\ntags:\n  foo: bar\n```\n\n\n\n### Put parameters for `terracost`, `infrapolicy`\n\n`tfplan_path`: _required_. The path to the JSON terraform plan result (this should be updated since we know the name of the JSON terraform plan)\n\n## Output files\n\nUsed with `get`, the resource will populate one output file:\n\n  * `version.json`: Which contain the same json output provided to Concourse for the version\n\n\n## Usage\n\nFinally, add the `put` step right after the terraform plan and don't forget to the `output_planfile: true` in order to generate a terraform plan JSON file:\n\n```yaml\n# Terracost and infrapolicy\n- put: tfstate\n  get_params:\n    output_planfile: true\n  ...\n- put: infrapolicy\n  params:\n    tfplan_path: tfstate/plan.json\n- put: terracost\n  params:\n    tfplan_path: tfstate/plan.json\n\n# Event\n- put: event\n  params:\n    title: \"my event\"\n    message: \"This is my message\"\n```\n\n## Tips - run the resource as a task (Advanced/troubleshooting)\n\nIf you need to obtain detailed json file. You can run it as a task to populate the following json files:\n\n  * `output.json`: JSON formatted output used also as stdout\n  * `cy-output.json`: Raw json output from Cycloid CLI\n\n```YAML\n      - task: cost\n        config:\n          platform: linux\n          image_resource:\n            type: registry-image\n            source:\n              repository: cycloid/cycloid-resource\n              tag: dev\n          run:\n            path: /bin/bash\n            args:\n              - '-ec'\n              - |\n                ls\n                cp ${src_tfplan_path} /tmp; echo \"${resource_config}\" \u003e source.json\n                /opt/resource/out $PWD/terracost-json/ \u003c source.json\n          inputs:\n            - name: tfstate\n          outputs:\n            - name: terracost-json\n        params:\n          src_tfplan_path: tfstate/plan.json\n          resource_config:\n            source:\n              api_key: ((custom_api-key-admin.key))\n              api_url: 'https://http-api.cycloid.io'\n              env: dev\n              feature: terracost\n              org: cycloid-demo\n              project: accenture-mi\n            params:\n              tfplan_path: /tmp/plan.json\n```\n\n## Contributing\n\nIf you want to contribute or to have more information on the workflow: [CONTRIBUTIING.md](./CONTRIBUTING.md)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycloidio%2Fcycloid-resource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcycloidio%2Fcycloid-resource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycloidio%2Fcycloid-resource/lists"}