{"id":41437735,"url":"https://github.com/kosli-dev/terraform-provider-kosli","last_synced_at":"2026-02-18T20:01:04.513Z","repository":{"id":332077702,"uuid":"1129565270","full_name":"kosli-dev/terraform-provider-kosli","owner":"kosli-dev","description":"Terraform Kosli Provider","archived":false,"fork":false,"pushed_at":"2026-02-18T08:22:37.000Z","size":221,"stargazers_count":0,"open_issues_count":9,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-18T11:32:18.843Z","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/kosli-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-07T09:14:12.000Z","updated_at":"2026-02-18T08:22:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kosli-dev/terraform-provider-kosli","commit_stats":null,"previous_names":["kosli-dev/terraform-provider-kosli"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/kosli-dev/terraform-provider-kosli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kosli-dev%2Fterraform-provider-kosli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kosli-dev%2Fterraform-provider-kosli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kosli-dev%2Fterraform-provider-kosli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kosli-dev%2Fterraform-provider-kosli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kosli-dev","download_url":"https://codeload.github.com/kosli-dev/terraform-provider-kosli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kosli-dev%2Fterraform-provider-kosli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29593926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T18:54:29.675Z","status":"ssl_error","status_checked_at":"2026-02-18T18:50:50.517Z","response_time":162,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-23T14:47:25.304Z","updated_at":"2026-02-18T20:01:04.500Z","avatar_url":"https://github.com/kosli-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform Provider for Kosli\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n\u003e [!WARNING]\n\u003e This is an early-stage provider under active development. Features and APIs may change.\n\u003e We recommend not to use this provider in production environments yet, and to pin to specific versions when you do.\n\n\nManage [Kosli](https://kosli.com) resources using Terraform. This provider allows you to define and manage Kosli custom attestation types as Infrastructure-as-Code, enabling you to integrate proprietary tools, custom metrics, or specialized compliance requirements into your Kosli workflows.\n\nThe Terraform provider enables you to automate the management of Kosli resources alongside your infrastructure.\n\n## Requirements\n\n- [Terraform](https://www.terraform.io/downloads.html) \u003e= 1.8\n- [Go](https://golang.org/doc/install) 1.23 or later (for development)\n- Kosli account and API credentials\n\n## Quick Start\n\n### Installation\n\nThe provider is available on the [Terraform Registry](https://registry.terraform.io/providers/kosli-dev/kosli/latest). Add it to your Terraform configuration:\n\n```hcl\nterraform {\n  required_providers {\n    kosli = {\n      source  = \"kosli-dev/kosli\"\n      version = \"~\u003e 0.1\"\n    }\n  }\n}\n\nprovider \"kosli\" {\n  api_token = var.kosli_api_token\n  org       = var.kosli_org_name\n  api_url   = \"https://app.kosli.com\"  # Optional, defaults to EU region\n}\n```\n\n### Basic Configuration\n\nFor complete examples with variables and multiple use cases, see the [examples](examples/) directory:\n\n- [Resource examples](examples/resources/) - Creating and managing resources\n- [Data source examples](examples/data-sources/) - Referencing existing resources\n- [Complete examples](examples/complete/) - End-to-end scenarios\n\n## Documentation\n\n### Attestation Types\n\nAttestation types are custom data structures that define how Kosli validates and evaluates evidence. They act as templates specifying:\n\n- **JSON Schema**: Defines the structure and data types for attestation data\n- **Evaluation Rules**: jq-formatted rules that must evaluate to `true` for compliance\n- **Naming Convention**: Names must start with a letter/number and contain only letters, numbers, periods, hyphens, underscores, and tildes\n\nCommon use cases include:\n- Security scan validation (e.g., no critical vulnerabilities)\n- Test coverage requirements (e.g., minimum 80% coverage)\n- Code quality checks (e.g., no failing tests)\n- Custom compliance criteria specific to your organization\n\nFull documentation is available on the [Terraform Registry](https://registry.terraform.io/providers/kosli-dev/kosli/latest/docs) and in the [docs/](docs/) directory.\n\nFor more details on attestation types, see the [Kosli documentation](https://docs.kosli.com/client_reference/kosli_create_attestation-type/).\n\n## Supported Resources\n\n### Resources\n- `kosli_custom_attestation_type` - Create and manage custom attestation types\n- `kosli_environment` - Create and manage physical environments (K8S, ECS, S3, docker, server, lambda)\n- `kosli_logical_environment` - Create and manage logical environments that aggregate physical environments\n\n### Data Sources\n- `kosli_custom_attestation_type` - Reference existing attestation types\n- `kosli_environment` - Reference existing physical environments\n- `kosli_logical_environment` - Reference existing logical environments\n\n## Configuration\n\nThe Kosli provider requires authentication via API token and organization name.\n\n### Using Environment Variables (Recommended)\n\nThe recommended approach is to use environment variables, especially for sensitive credentials:\n\n```bash\nexport KOSLI_API_TOKEN=\"your-api-token\"\nexport KOSLI_ORG=\"your-org-name\"\nexport KOSLI_API_URL=\"https://app.kosli.com\"  # Optional, defaults to EU region\n```\n\nThen configure the provider without hardcoded credentials:\n\n```hcl\nprovider \"kosli\" {\n  # Credentials are read from environment variables:\n  # KOSLI_API_TOKEN, KOSLI_ORG, KOSLI_API_URL\n}\n```\n\n### Using Terraform Variables\n\nAlternatively, use Terraform variables (ensure you manage secrets securely):\n\n```hcl\nprovider \"kosli\" {\n  api_token = var.kosli_api_token  # Use secure variable management\n  org       = var.kosli_org_name\n  api_url   = \"https://app.kosli.com\"  # Optional, defaults to EU region\n  timeout   = 30                        # Optional, defaults to 30s\n}\n```\n\n### Regional Endpoints\n\nKosli operates in two regions:\n\n- **EU Region** (default): `https://app.kosli.com`\n- **US Region**: `https://app.us.kosli.com`\n\nConfigure the appropriate endpoint based on where your Kosli organization is hosted.\n\n### Getting API Credentials\n\n**Recommended: Use Service Accounts**\n\nService accounts provide secure, programmatic access to Kosli without tying credentials to individual users:\n\n1. Log in to your [Kosli account](https://app.kosli.com)\n2. Navigate to **Settings → Service Accounts**\n3. Click **Add New Service Account**\n4. Give it a descriptive name (e.g., \"Terraform Automation\")\n5. **Assign Admin permissions** to the service account (required for managing environments and attestation types)\n6. Click the **\"...\"** menu on the service account\n7. Select **Add API Key**\n8. Copy the API key and store it securely\n\n\u003e [!IMPORTANT]\n\u003e The Terraform provider requires a Service Account with **Admin permissions** to manage Kosli resources.\n\n**Store credentials securely:**\n- Use environment variables (see Configuration above)\n- For CI/CD: Use your platform's secrets management (GitHub Secrets, GitLab CI/CD variables, etc.)\n- For local development: Use a `.envrc` file (with direnv) or similar - **never commit credentials to version control**\n\n## Contributing\n\nWe welcome contributions! Whether you're fixing a bug, adding a feature, or improving documentation, your help is appreciated.\n\n### Quick Start for Contributors\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/your-feature`)\n3. Make your changes and add tests\n4. Run `make fmt \u0026\u0026 make vet \u0026\u0026 make test`\n5. Submit a pull request\n\n### Development Guide\n\nFor comprehensive development information, see **[CONTRIBUTING.md](CONTRIBUTING.md)**:\n\n- **Development environment setup** - Prerequisites and dependencies\n- **Building and testing** - Make commands and workflows\n- **Code quality standards** - Formatting, linting, and best practices\n- **Pull request process** - Detailed submission guidelines and review timeline\n- **Project structure** - Directory organization and architecture\n- **Release process** - How releases are created and published\n\n### Common Development Commands\n\n```bash\nmake help         # View all available commands\nmake build        # Build the provider\nmake test         # Run unit tests with coverage\nmake testacc      # Run acceptance tests\nmake install      # Install locally for testing\n```\n\n### Getting Help\n\n- **Questions**: [GitHub Discussions](https://github.com/kosli-dev/terraform-provider-kosli/discussions)\n- **Bug reports**: [GitHub Issues](https://github.com/kosli-dev/terraform-provider-kosli/issues)\n- **Community**: [Kosli Community](https://www.kosli.com/community/)\n\n## Roadmap\n\nSee [GitHub Issues](https://github.com/kosli-dev/terraform-provider-kosli/issues) for detailed feature tracking.\n\n## Troubleshooting\n\n### Authentication Errors\n\nVerify your API token and organization are valid:\n\n```bash\n# For EU region (default)\ncurl -H \"Authorization: Bearer $KOSLI_API_TOKEN\" https://app.kosli.com/api/v2/environments/$KOSLI_ORG\n\n# For US region\ncurl -H \"Authorization: Bearer $KOSLI_API_TOKEN\" https://app.us.kosli.com/api/v2/environments/$KOSLI_ORG\n```\n\n### API Timeouts\n\nIncrease the timeout if you're experiencing timeout errors:\n\n```hcl\nprovider \"kosli\" {\n  api_token = var.kosli_api_token\n  timeout   = 60  # seconds\n}\n```\n\n### Resource State Issues\n\nIf Terraform state becomes out of sync with Kosli:\n\n```bash\nterraform refresh\n```\n\n## Known Issues\n\n### Custom Attestation Type Schema Normalization\n\n**Issue**: The Kosli API returns `type_schema` in Python `repr()` format (single quotes, `True`/`False`/`None`) instead of valid JSON. The provider automatically normalizes this to JSON format.\n\n**Limitation**: The normalization uses regex with word boundaries, which may convert Python keywords even if they appear inside string values. For example:\n\n```python\n# API returns (Python format):\n{'description': 'Set to None to disable'}\n\n# Provider normalizes to (JSON format):\n{\"description\": \"Set to null to disable\"}  # \"None\" → \"null\" inside string\n```\n\n**Impact**: Minimal. JSON schemas rarely contain prose descriptions with the words \"True\", \"False\", or \"None\". The API typically returns structured data where these appear as literals (boolean/null values), not inside string content.\n\n**Workaround**: If you encounter this edge case, contact Kosli support about the API returning invalid JSON, as this is a client-side workaround for an API limitation.\n\n**Tracking**: See [#106](https://github.com/kosli-dev/terraform-provider-kosli/issues/106) for discussion of potential solutions (JSON-aware parsing, API-side fix).\n\n## Support\n\n- **Documentation**: https://docs.kosli.com\n- **Issues**: [GitHub Issues](https://github.com/kosli-dev/terraform-provider-kosli/issues)\n- **Community**: [Kosli Slack Community](https://koslicommunity.slack.com)\n- **Email**: support@kosli.com\n\n## License\n\nThis provider is released under the [MIT License](LICENSE).\n\n## About Kosli\n\nKosli is a software intelligence platform that helps teams maintain visibility and governance over their Software Delivery Lifecycle (SDLC). Learn more at [kosli.com](https://kosli.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkosli-dev%2Fterraform-provider-kosli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkosli-dev%2Fterraform-provider-kosli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkosli-dev%2Fterraform-provider-kosli/lists"}