diff --git a/github/resource_github_repository_custom_property.go b/github/resource_github_repository_custom_property.go index 6de2a7dce..76fb830d5 100644 --- a/github/resource_github_repository_custom_property.go +++ b/github/resource_github_repository_custom_property.go @@ -109,6 +109,11 @@ func resourceGithubRepositoryCustomPropertyRead(d *schema.ResourceData, meta int return err } + if wantedCustomPropertyValue == nil { + d.SetId("") + return nil + } + d.SetId(buildThreePartID(owner, repoName, propertyName)) d.Set("repository", repoName) d.Set("property_name", propertyName) @@ -154,7 +159,7 @@ func readRepositoryCustomPropertyValue(ctx context.Context, client *github.Clien } if wantedCustomProperty == nil { - return nil, fmt.Errorf("could not find a custom property with name: %s", propertyName) + return nil, nil } wantedPropertyValue, err := parseRepositoryCustomPropertyValueToStringSlice(wantedCustomProperty)