@@ -209,6 +209,55 @@ func TestAccGithubRepository(t *testing.T) {
209209 },
210210 })
211211 })
212+ t .Run ("unarchives archived repositories without error" , func (t * testing.T ) {
213+ randomID := acctest .RandStringFromCharSet (5 , acctest .CharSetAlphaNum )
214+ testRepoName := fmt .Sprintf ("%sunarchive-%s" , testResourcePrefix , randomID )
215+ config := fmt .Sprintf (`
216+ resource "github_repository" "test" {
217+ name = "%s"
218+ description = "Terraform acceptance tests %[1]s"
219+ archived = false
220+ visibility = "%s"
221+ }
222+ ` , testRepoName , baseVisibility )
223+
224+ resource .Test (t , resource.TestCase {
225+ PreCheck : func () { skipUnauthenticated (t ) },
226+ ProviderFactories : providerFactories ,
227+ Steps : []resource.TestStep {
228+ {
229+ Config : config ,
230+ Check : resource .ComposeTestCheckFunc (
231+ resource .TestCheckResourceAttr (
232+ "github_repository.test" , "archived" ,
233+ "false" ,
234+ ),
235+ ),
236+ },
237+ {
238+ Config : strings .Replace (config ,
239+ `archived = false` ,
240+ `archived = true` , 1 ),
241+ Check : resource .ComposeTestCheckFunc (
242+ resource .TestCheckResourceAttr (
243+ "github_repository.test" , "archived" ,
244+ "true" ,
245+ ),
246+ ),
247+ },
248+ {
249+ Config : config ,
250+ Check : resource .ComposeTestCheckFunc (
251+ resource .TestCheckResourceAttr (
252+ "github_repository.test" , "archived" ,
253+ "false" ,
254+ ),
255+ ),
256+ },
257+ },
258+ })
259+ })
260+
212261 t .Run ("creates_repositories_as_archived_without_error" , func (t * testing.T ) {
213262 randomID := acctest .RandStringFromCharSet (5 , acctest .CharSetAlphaNum )
214263 testRepoName := fmt .Sprintf ("%screate-and-archive-%s" , testResourcePrefix , randomID )
@@ -246,8 +295,9 @@ func TestAccGithubRepository(t *testing.T) {
246295 name = "%s"
247296 description = "Terraform acceptance tests %[1]s"
248297 has_projects = false
298+ visibility = "%s"
249299 }
250- ` , testRepoName )
300+ ` , testRepoName , baseVisibility )
251301
252302 checks := map [string ]resource.TestCheckFunc {
253303 "before" : resource .ComposeTestCheckFunc (
@@ -524,8 +574,9 @@ func TestAccGithubRepository(t *testing.T) {
524574 auto_init = true
525575 archive_on_destroy = true
526576 archived = false
577+ visibility = "%s"
527578 }
528- ` , testRepoName )
579+ ` , testRepoName , baseVisibility )
529580
530581 checks := map [string ]resource.TestCheckFunc {
531582 "before" : resource .ComposeTestCheckFunc (
0 commit comments