Skip to content

Commit a1fea6b

Browse files
repo archive_on_destroy: Do not modify any unrelated settings
Same issue as integrations#2397. Alternatively we could also just send only archived=true and not all fields (since we just ended management of the repo via terraform and thus care whether it matches the settings).
1 parent 9fceeda commit a1fea6b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

github/resource_github_repository.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,10 @@ func resourceGithubRepositoryDelete(d *schema.ResourceData, meta interface{}) er
875875
return err
876876
}
877877
repoReq := resourceGithubRepositoryObject(d)
878+
if !d.HasChange("security_and_analysis") {
879+
repoReq.SecurityAndAnalysis = nil
880+
log.Print("[DEBUG] No security_and_analysis update required. Removing this field from the payload.")
881+
}
878882
log.Printf("[DEBUG] Archiving repository on delete: %s/%s", owner, repoName)
879883
_, _, err := client.Repositories.Edit(ctx, owner, repoName, repoReq)
880884
return err

0 commit comments

Comments
 (0)