@@ -25,6 +25,7 @@ func TestAccGithubOrganizationSettings(t *testing.T) {
2525 has_repository_projects = true
2626 default_repository_permission = "read"
2727 members_can_create_repositories = true
28+ members_can_change_repo_visibility = true
2829 members_can_create_public_repositories = true
2930 members_can_create_private_repositories = true
3031 members_can_create_internal_repositories = false
@@ -42,10 +43,43 @@ func TestAccGithubOrganizationSettings(t *testing.T) {
4243 }`
4344
4445 check := resource .ComposeTestCheckFunc (
45- resource .TestCheckResourceAttr (
46- "github_organization_settings.test" ,
47- "billing_email" , "test@example.com" ,
48- ),
46+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "billing_email" , "test@example.com" ),
47+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "company" , "Test Company" ),
48+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "blog" , "https://example.com" ),
49+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "email" , "test@example.com" ),
50+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "twitter_username" , "Test" ),
51+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "location" , "Test Location" ),
52+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "name" , "Test Name" ),
53+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "description" , "Test Description" ),
54+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "has_organization_projects" , "true" ),
55+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "has_repository_projects" , "true" ),
56+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "default_repository_permission" , "read" ),
57+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_repositories" , "true" ),
58+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_change_repo_visibility" , "true" ),
59+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_public_repositories" , "true" ),
60+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_private_repositories" , "true" ),
61+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_internal_repositories" , "false" ),
62+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_pages" , "true" ),
63+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_public_pages" , "true" ),
64+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_private_pages" , "true" ),
65+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_fork_private_repositories" , "true" ),
66+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "web_commit_signoff_required" , "true" ),
67+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "advanced_security_enabled_for_new_repositories" , "false" ),
68+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "dependabot_alerts_enabled_for_new_repositories" , "false" ),
69+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "dependabot_security_updates_enabled_for_new_repositories" , "false" ),
70+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "dependency_graph_enabled_for_new_repositories" , "false" ),
71+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "secret_scanning_enabled_for_new_repositories" , "false" ),
72+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "secret_scanning_push_protection_enabled_for_new_repositories" , "false" ),
73+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "secret_scanning_validity_checks_enabled" , "false" ),
74+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_delete_repositories" , "false" ),
75+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_change_repo_visibility" , "true" ),
76+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_invite_outside_collaborators" , "false" ),
77+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_delete_issues" , "false" ),
78+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "display_commenter_full_name_setting_enabled" , "false" ),
79+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "readers_can_create_discussions" , "false" ),
80+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_teams" , "false" ),
81+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_view_dependency_insights" , "false" ),
82+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "default_repository_branch" , "main" ),
4983 )
5084
5185 resource .Test (t , resource.TestCase {
@@ -84,14 +118,8 @@ func TestAccGithubOrganizationSettings(t *testing.T) {
84118 }` , updatedBillingEmail , updatedCompany , updatedBlog ),
85119 }
86120 checks := map [string ]resource.TestCheckFunc {
87- "before" : resource .TestCheckResourceAttr (
88- "github_organization_settings.test" ,
89- "billing_email" , billingEmail ,
90- ),
91- "after" : resource .TestCheckResourceAttr (
92- "github_organization_settings.test" ,
93- "billing_email" , updatedBillingEmail ,
94- ),
121+ "before" : resource .TestCheckResourceAttr ("github_organization_settings.test" , "billing_email" , billingEmail ),
122+ "after" : resource .TestCheckResourceAttr ("github_organization_settings.test" , "billing_email" , updatedBillingEmail ),
95123 }
96124 resource .Test (t , resource.TestCase {
97125 PreCheck : func () { skipUnlessHasOrgs (t ) },
@@ -150,6 +178,7 @@ func TestAccGithubOrganizationSettings(t *testing.T) {
150178 resource "github_organization_settings" "test" {
151179 billing_email = "test@example.com"
152180 members_can_create_private_repositories = false
181+ members_can_change_repo_visibility = false
153182 members_can_create_internal_repositories = false
154183 members_can_fork_private_repositories = false
155184 web_commit_signoff_required = false
@@ -162,52 +191,19 @@ func TestAccGithubOrganizationSettings(t *testing.T) {
162191 }`
163192
164193 check := resource .ComposeTestCheckFunc (
165- resource .TestCheckResourceAttr (
166- "github_organization_settings.test" ,
167- "billing_email" , "test@example.com" ,
168- ),
169- resource .TestCheckResourceAttr (
170- "github_organization_settings.test" ,
171- "members_can_create_private_repositories" , "false" ,
172- ),
173- resource .TestCheckResourceAttr (
174- "github_organization_settings.test" ,
175- "members_can_create_internal_repositories" , "false" ,
176- ),
177- resource .TestCheckResourceAttr (
178- "github_organization_settings.test" ,
179- "members_can_fork_private_repositories" , "false" ,
180- ),
181- resource .TestCheckResourceAttr (
182- "github_organization_settings.test" ,
183- "web_commit_signoff_required" , "false" ,
184- ),
185- resource .TestCheckResourceAttr (
186- "github_organization_settings.test" ,
187- "advanced_security_enabled_for_new_repositories" , "false" ,
188- ),
189- resource .TestCheckResourceAttr (
190- "github_organization_settings.test" ,
191- "dependabot_alerts_enabled_for_new_repositories" , "false" ,
192- ),
193- resource .TestCheckResourceAttr (
194- "github_organization_settings.test" ,
195- "dependabot_security_updates_enabled_for_new_repositories" , "false" ,
196- ),
197- resource .TestCheckResourceAttr (
198- "github_organization_settings.test" ,
199- "dependency_graph_enabled_for_new_repositories" , "false" ,
200- ),
201- resource .TestCheckResourceAttr (
202- "github_organization_settings.test" ,
203- "secret_scanning_enabled_for_new_repositories" , "false" ,
204- ),
205- resource .TestCheckResourceAttr (
206- "github_organization_settings.test" ,
207- "secret_scanning_push_protection_enabled_for_new_repositories" , "false" ,
208- ),
194+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "billing_email" , "test@example.com" ),
195+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_private_repositories" , "false" ),
196+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_change_repo_visibility" , "false" ),
197+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_internal_repositories" , "false" ),
198+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_fork_private_repositories" , "false" ),
199+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "web_commit_signoff_required" , "false" ),
200+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "advanced_security_enabled_for_new_repositories" , "false" ),
201+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "dependabot_alerts_enabled_for_new_repositories" , "false" ),
202+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "dependabot_security_updates_enabled_for_new_repositories" , "false" ),
203+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "dependency_graph_enabled_for_new_repositories" , "false" ),
204+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "secret_scanning_enabled_for_new_repositories" , "false" ),
205+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "secret_scanning_push_protection_enabled_for_new_repositories" , "false" ),
209206 )
210-
211207 resource .Test (t , resource.TestCase {
212208 PreCheck : func () { skipUnlessHasOrgs (t ) },
213209 ProviderFactories : providerFactories ,
@@ -225,6 +221,7 @@ func TestAccGithubOrganizationSettings(t *testing.T) {
225221 resource "github_organization_settings" "test" {
226222 billing_email = "test@example.com"
227223 members_can_create_private_repositories = false
224+ members_can_change_repo_visibility = true
228225 members_can_create_internal_repositories = true
229226 members_can_fork_private_repositories = false
230227 web_commit_signoff_required = true
@@ -237,52 +234,19 @@ func TestAccGithubOrganizationSettings(t *testing.T) {
237234 }`
238235
239236 check := resource .ComposeTestCheckFunc (
240- resource .TestCheckResourceAttr (
241- "github_organization_settings.test" ,
242- "billing_email" , "test@example.com" ,
243- ),
244- resource .TestCheckResourceAttr (
245- "github_organization_settings.test" ,
246- "members_can_create_private_repositories" , "false" ,
247- ),
248- resource .TestCheckResourceAttr (
249- "github_organization_settings.test" ,
250- "members_can_create_internal_repositories" , "true" ,
251- ),
252- resource .TestCheckResourceAttr (
253- "github_organization_settings.test" ,
254- "members_can_fork_private_repositories" , "false" ,
255- ),
256- resource .TestCheckResourceAttr (
257- "github_organization_settings.test" ,
258- "web_commit_signoff_required" , "true" ,
259- ),
260- resource .TestCheckResourceAttr (
261- "github_organization_settings.test" ,
262- "advanced_security_enabled_for_new_repositories" , "false" ,
263- ),
264- resource .TestCheckResourceAttr (
265- "github_organization_settings.test" ,
266- "dependabot_alerts_enabled_for_new_repositories" , "true" ,
267- ),
268- resource .TestCheckResourceAttr (
269- "github_organization_settings.test" ,
270- "dependabot_security_updates_enabled_for_new_repositories" , "false" ,
271- ),
272- resource .TestCheckResourceAttr (
273- "github_organization_settings.test" ,
274- "dependency_graph_enabled_for_new_repositories" , "true" ,
275- ),
276- resource .TestCheckResourceAttr (
277- "github_organization_settings.test" ,
278- "secret_scanning_enabled_for_new_repositories" , "false" ,
279- ),
280- resource .TestCheckResourceAttr (
281- "github_organization_settings.test" ,
282- "secret_scanning_push_protection_enabled_for_new_repositories" , "true" ,
283- ),
237+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "billing_email" , "test@example.com" ),
238+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_private_repositories" , "false" ),
239+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_change_repo_visibility" , "true" ),
240+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_internal_repositories" , "true" ),
241+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_fork_private_repositories" , "false" ),
242+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "web_commit_signoff_required" , "true" ),
243+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "advanced_security_enabled_for_new_repositories" , "false" ),
244+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "dependabot_alerts_enabled_for_new_repositories" , "true" ),
245+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "dependabot_security_updates_enabled_for_new_repositories" , "false" ),
246+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "dependency_graph_enabled_for_new_repositories" , "true" ),
247+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "secret_scanning_enabled_for_new_repositories" , "false" ),
248+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "secret_scanning_push_protection_enabled_for_new_repositories" , "true" ),
284249 )
285-
286250 resource .Test (t , resource.TestCase {
287251 PreCheck : func () { skipUnlessHasOrgs (t ) },
288252 ProviderFactories : providerFactories ,
@@ -520,6 +484,7 @@ func TestAccGithubOrganizationSettings(t *testing.T) {
520484 resource .TestCheckResourceAttr ("github_organization_settings.test" , "secret_scanning_enabled_for_new_repositories" , "true" ),
521485 resource .TestCheckResourceAttr ("github_organization_settings.test" , "secret_scanning_push_protection_enabled_for_new_repositories" , "true" ),
522486 resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_private_repositories" , "true" ),
487+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_change_repo_visibility" , "true" ),
523488 resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_internal_repositories" , "true" ),
524489 resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_pages" , "true" ),
525490 resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_public_pages" , "true" ),
@@ -551,6 +516,7 @@ func TestAccGithubOrganizationSettings(t *testing.T) {
551516 secret_scanning_enabled_for_new_repositories = false
552517 secret_scanning_push_protection_enabled_for_new_repositories = false
553518 members_can_create_private_repositories = false
519+ members_can_change_repo_visibility = false
554520 members_can_create_internal_repositories = false
555521 members_can_create_pages = false
556522 members_can_create_public_pages = false
@@ -567,6 +533,7 @@ func TestAccGithubOrganizationSettings(t *testing.T) {
567533 resource .TestCheckResourceAttr ("github_organization_settings.test" , "secret_scanning_enabled_for_new_repositories" , "false" ),
568534 resource .TestCheckResourceAttr ("github_organization_settings.test" , "secret_scanning_push_protection_enabled_for_new_repositories" , "false" ),
569535 resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_private_repositories" , "false" ),
536+ resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_change_repo_visibility" , "false" ),
570537 resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_internal_repositories" , "false" ),
571538 resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_pages" , "false" ),
572539 resource .TestCheckResourceAttr ("github_organization_settings.test" , "members_can_create_public_pages" , "false" ),
0 commit comments