Skip to content

Commit

Permalink
Try this
Browse files Browse the repository at this point in the history
  • Loading branch information
N-lson committed Oct 11, 2024
1 parent d1f46a2 commit d08c127
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion octopusdeploy_framework/resource_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,28 @@ func TestAccUserBasic(t *testing.T) {
Config: testAccUserBasic(localName, displayName, isActive, isService, password, username, emailAddress),
},
{
Config: testAccUserImport(localName, username),
//Config: testAccUserImport(localName, username),
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"password"},
ImportStateIdFunc: testAccUserImportStateIdFunc(resourceName),
},
},
})
}

func testAccUserImportStateIdFunc(resourceName string) resource.ImportStateIdFunc {
return func(s *terraform.State) (string, error) {
rs, ok := s.RootModule().Resources[resourceName]
if !ok {
return "", fmt.Errorf("Not found: %s", resourceName)
}

return rs.Primary.ID, nil
}
}

func testAccUserImport(localName string, username string) string {
return fmt.Sprintf(`resource "octopusdeploy_user" "%s" {}`, localName)
}
Expand Down

0 comments on commit d08c127

Please sign in to comment.