integrations / integrations/terraform-provider-github

[FEAT]: Data sources for code security configurations

Open
#3,505 1 comment 2 reactions 0 assignees View on GitHub
New data source Type: Feature
Dominant language
Go
Stars
1.2k
Forks
1k
Avg merge
1d 14h
Merged PRs (30d)
8

Description

### Describe the need

The `github_organization_security_configuration` and `github_enterprise_security_configuration` **resources** are being added in #3284. As @stevehipwell suggested in his review there, it would be valuable to also provide matching **data sources** so configurations can be looked up/read without managing them:

- `data "github_organization_security_configuration"` — read an organization code security configuration (by name and/or `configuration_id`)
- `data "github_enterprise_security_configuration"` — read an enterprise code security configuration (by `enterprise_slug` + name/`configuration_id`)

This follows the usual provider convention of pairing resources with read-only data sources (e.g. `github_actions_organization_permissions` recently got a data source in #3465), and enables common workflows like referencing GitHub's built-in preset configurations (e.g. "GitHub recommended") or an externally-managed configuration from Terraform.

The GitHub REST API supports the reads already (`GET /orgs/{org}/code-security/configurations`, `GET /enterprises/{enterprise}/code-security/configurations`).

Tracking this separately from #3284 per the maintainer's suggestion to keep the resource PR focused. Happy to open a PR for it once the resources land.

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the organization and enterprise security configuration resources being added in #3284, then compare the read-only data source pattern from github_actions_organization_permissions in #3465. Use the listed organization and enterprise REST endpoints as the read targets; done means both data sources can look up configurations by name or configuration_id and expose the requested configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, terraform
Domain
devops, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.