Skip to content

Commit

Permalink
fix ID setup for import test
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoodsell-tempus committed Sep 22, 2023
1 parent 1346623 commit c8ebc6b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions okta/resource_okta_app_oauth_role_assignment_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package okta

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

func TestAccResourceOktaAppOAuthRoleAssignment_basic(t *testing.T) {
Expand All @@ -28,6 +30,13 @@ func TestAccResourceOktaAppOAuthRoleAssignment_basic(t *testing.T) {
ResourceName: "okta_app_oauth_role_assignment.test",
ImportState: true,
ImportStateVerify: true,
ImportStateIdFunc: func(s *terraform.State) (string, error) {
r, ok := s.RootModule().Resources["okta_app_oauth_role_assignment.test"]
if !ok {
return "", fmt.Errorf("Unable to find resource: %s:", "okta_app_oauth_role_assignment.test")
}
return fmt.Sprintf("%s/%s", r.Primary.Attributes["client_id"], r.Primary.Attributes["id"]), nil
},
},
{
Config: mgr.GetFixtures("basic_updated.tf", t),
Expand Down

0 comments on commit c8ebc6b

Please sign in to comment.