@@ -118,6 +118,39 @@ func TestAccResourceOktaIdpSaml_crud(t *testing.T) {
118118 })
119119}
120120
121+ // TestAccResourceOktaIdpSaml_account_link_auto exercises the Read path when account_link_action
122+ // is set to AUTO without account_link_group_include. Regression test for OKTA-1131393 where
123+ // the provider panicked with a nil pointer dereference when the Okta API returned
124+ // accountLink.filter.groups = null (filter non-null, groups null inside it).
125+ func TestAccResourceOktaIdpSaml_account_link_auto (t * testing.T ) {
126+ mgr := newFixtureManager ("resources" , resources .OktaIDaaSIdpSaml , t .Name ())
127+ config := mgr .GetFixtures ("account_link_auto.tf" , t )
128+ resourceName := fmt .Sprintf ("%s.test" , resources .OktaIDaaSIdpSaml )
129+
130+ acctest .OktaResourceTest (t , resource.TestCase {
131+ PreCheck : acctest .AccPreCheck (t ),
132+ ErrorCheck : testAccErrorChecks (t ),
133+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactoriesForTestAcc (t ),
134+ CheckDestroy : checkResourceDestroy (resources .OktaIDaaSIdpSaml , createDoesIdpExist ),
135+ Steps : []resource.TestStep {
136+ {
137+ Config : config ,
138+ Check : resource .ComposeTestCheckFunc (
139+ resource .TestCheckResourceAttr (resourceName , "name" , acctest .BuildResourceName (mgr .Seed )),
140+ resource .TestCheckResourceAttr (resourceName , "account_link_action" , "AUTO" ),
141+ resource .TestCheckNoResourceAttr (resourceName , "account_link_group_include" ),
142+ ),
143+ },
144+ {
145+ ResourceName : resourceName ,
146+ ImportState : true ,
147+ ImportStateVerify : true ,
148+ ImportStateVerifyIgnore : []string {"issuer_mode" },
149+ },
150+ },
151+ })
152+ }
153+
121154// TestAccResourceOktaIdpSaml_minimal_example was used to prove that the PR
122155// https://github.com/okta/terraform-provider-okta/pull/1355 was correct. This
123156// test would fail if the org was missing the mappings api feature. And pass if
0 commit comments