feat: add github_repository_custom_properties resource for batch property management#3237
Open
mkushakov wants to merge 2 commits intointegrations:mainfrom
Open
Conversation
New resource for managing multiple custom property values on a repository in a single resource block with in-place updates. Complements the existing singular github_repository_custom_property resource.
|
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #3240
Summary
Add a new
github_repository_custom_propertiesresource (plural) that manages multiple custom property values on a single repository in one resource block, with in-place updates when values change.This complements the existing
github_repository_custom_propertyresource (singular), which manages one property per resource instance and requires destroy+recreate on any change.Motivation
The existing singular
github_repository_custom_propertyresource has limitations:PATCHproperty_type— the user must manually specify the property type, even though it's already defined at the org levelThe new plural resource addresses all of these:
github_repository_custom_property)github_repository_custom_properties)property_typeowner/repo/property_nameowner/repo(imports ALL properties)Changes
New Resource (
resource_github_repository_custom_properties.go)repository_name(ForceNew) andproperty(TypeSet of name/value blocks)CreateandUpdateshare the same function — looks up org property definitions to auto-detect types, then callsCreateOrUpdateCustomPropertieswith all properties in a single API callReadfilters to only managed properties (from state), or imports ALL properties when state is empty (import case)Deletesets all managed properties tonilin a single API callStateContextimporter that acceptsowner/repoformat and imports all propertiescheckOrganizationguard on all CRUD operationsfmt.Errorfand%wProvider Registration (
provider.go)github_repository_custom_propertiesTests (
resource_github_repository_custom_properties_test.go)owner/repoAll tests use
providerFactories(modern pattern) andskipUnlessHasOrgs.Example Usage
Relationship to Existing Resources
github_repository_custom_property(singular) — unchanged, still available. Users can choose whichever pattern fits their workflow.github_organization_custom_properties— defines properties at the org level. The new resource reads these definitions to auto-detect property types.data.github_repository_custom_properties(data source) — already exists, reads all properties for a repo.Testing
go build ./...— passesgo vet ./...— passes