@@ -761,10 +761,10 @@ func TestAccKeycloakOpenidClient_import(t *testing.T) {
761761 CheckDestroy : testAccCheckKeycloakOpenidClientNotDestroyed (),
762762 Steps : []resource.TestStep {
763763 {
764- ResourceName : "keycloak_openid_client. client" ,
765- ImportState : true ,
766- ImportStateId : testAccRealm . Realm + "/account" ,
767-
764+ Config : testKeycloakOpenidClient_import ( "non-existing- client", true ) ,
765+ ExpectError : regexp . MustCompile ( "Error: openid clientId non-existing-client does not exist in" ) ,
766+ } ,
767+ {
768768 Config : testKeycloakOpenidClient_import ("account" , false ),
769769 Check : testAccCheckKeycloakOpenidClientExistsWithEnabledStatus ("keycloak_openid_client.client" , false ),
770770 },
@@ -2095,12 +2095,16 @@ func testKeycloakOpenidClient_import(clientId string, enabled bool) string {
20952095data "keycloak_realm" "realm" {
20962096 realm = "%s"
20972097}
2098+ import {
2099+ id = "${data.keycloak_realm.realm.id}/%s"
2100+ to = keycloak_openid_client.client
2101+ }
20982102resource "keycloak_openid_client" "client" {
20992103 client_id = "%s"
21002104 realm_id = data.keycloak_realm.realm.id
21012105 access_type = "PUBLIC"
21022106 root_url = ""
21032107 enabled = %t
21042108}
2105- ` , testAccRealm .Realm , clientId , enabled )
2109+ ` , testAccRealm .Realm , clientId , clientId , enabled )
21062110}
0 commit comments