diff --git a/github/resource_github_repository.go b/github/resource_github_repository.go index 9afbdd8960..cc3c3a129d 100644 --- a/github/resource_github_repository.go +++ b/github/resource_github_repository.go @@ -752,6 +752,11 @@ func resourceGithubRepositoryUpdate(d *schema.ResourceData, meta interface{}) er // handle visibility updates separately from other fields repoReq.Visibility = nil + if !d.HasChange("security_and_analysis") { + repoReq.SecurityAndAnalysis = nil + log.Print("[DEBUG] No security_and_analysis update required. Removing this field from the payload.") + } + // The documentation for `default_branch` states: "This can only be set // after a repository has already been created". However, for backwards // compatibility we need to allow terraform configurations that set