@@ -14,7 +14,7 @@ import (
14
14
15
15
func resourceAccountIdp () * schema.Resource {
16
16
return & schema.Resource {
17
- Description : "Identity providers used in Codefresh for user authentication. " ,
17
+ Description : "Account level identity providers " ,
18
18
Create : resourceAccountIDPCreate ,
19
19
Read : resourceAccountIDPRead ,
20
20
Update : resourceAccountIDPUpdate ,
@@ -142,42 +142,37 @@ func mapAccountIDPToResource(cfClientIDP cfclient.IDP, d *schema.ResourceData) e
142
142
// Codefresh API Returns the client secret as an encrypted string on the server side
143
143
// hence we need to keep in the state the original secret the user provides along with the encrypted computed secret
144
144
// for Terraform to properly calculate the diff
145
- "client_secret" : d .Get ("github.0.client_secret" ),
146
- "client_secret_encrypted" : cfClientIDP .ClientSecret ,
147
- "authentication_url" : cfClientIDP .AuthURL ,
148
- "token_url" : cfClientIDP .TokenURL ,
149
- "user_profile_url" : cfClientIDP .UserProfileURL ,
150
- "api_host" : cfClientIDP .ApiHost ,
151
- "api_path_prefix" : cfClientIDP .ApiPathPrefix ,
145
+ "client_secret" : d .Get ("github.0.client_secret" ),
146
+ "authentication_url" : cfClientIDP .AuthURL ,
147
+ "token_url" : cfClientIDP .TokenURL ,
148
+ "user_profile_url" : cfClientIDP .UserProfileURL ,
149
+ "api_host" : cfClientIDP .ApiHost ,
150
+ "api_path_prefix" : cfClientIDP .ApiPathPrefix ,
152
151
}}
153
152
154
153
d .Set ("github" , attributes )
155
154
}
156
155
157
156
if cfClientIDP .ClientType == "gitlab" {
158
157
attributes := []map [string ]interface {}{{
159
- "client_id" : cfClientIDP .ClientId ,
160
- "client_secret" : d .Get ("gitlab.0.client_secret" ),
161
- "client_secret_encrypted" : cfClientIDP .ClientSecret ,
162
- "authentication_url" : cfClientIDP .AuthURL ,
163
- "user_profile_url" : cfClientIDP .UserProfileURL ,
164
- "api_url" : cfClientIDP .ApiURL ,
158
+ "client_id" : cfClientIDP .ClientId ,
159
+ "client_secret" : d .Get ("gitlab.0.client_secret" ),
160
+ "authentication_url" : cfClientIDP .AuthURL ,
161
+ "user_profile_url" : cfClientIDP .UserProfileURL ,
162
+ "api_url" : cfClientIDP .ApiURL ,
165
163
}}
166
164
167
165
d .Set ("gitlab" , attributes )
168
166
}
169
167
170
168
if cfClientIDP .ClientType == "okta" {
171
169
attributes := []map [string ]interface {}{{
172
- "client_id" : cfClientIDP .ClientId ,
173
- "client_secret" : d .Get ("okta.0.client_secret" ),
174
- "client_secret_encrypted" : cfClientIDP .ClientSecret ,
175
- "client_host" : cfClientIDP .ClientHost ,
176
- "app_id" : d .Get ("okta.0.app_id" ),
177
- "app_id_encrypted" : cfClientIDP .AppId ,
178
- "sync_mirror_accounts" : cfClientIDP .SyncMirrorAccounts ,
179
- "access_token" : d .Get ("okta.0.access_token" ),
180
- "access_token_encrypted" : cfClientIDP .Access_token ,
170
+ "client_id" : cfClientIDP .ClientId ,
171
+ "client_secret" : d .Get ("okta.0.client_secret" ),
172
+ "client_host" : cfClientIDP .ClientHost ,
173
+ "app_id" : d .Get ("okta.0.app_id" ),
174
+ "sync_mirror_accounts" : cfClientIDP .SyncMirrorAccounts ,
175
+ "access_token" : d .Get ("okta.0.access_token" ),
181
176
}}
182
177
183
178
d .Set ("okta" , attributes )
@@ -187,11 +182,8 @@ func mapAccountIDPToResource(cfClientIDP cfclient.IDP, d *schema.ResourceData) e
187
182
attributes := []map [string ]interface {}{{
188
183
"client_id" : cfClientIDP .ClientId ,
189
184
"client_secret" : d .Get ("google.0.client_secret" ),
190
- "client_secret_encrypted" : cfClientIDP .ClientSecret ,
191
185
"admin_email" : d .Get ("google.0.admin_email" ),
192
- "admin_email_encrypted" : cfClientIDP .Subject ,
193
186
"json_keyfile" : d .Get ("google.0.json_keyfile" ),
194
- "json_keyfile_encrypted" : cfClientIDP .KeyFile ,
195
187
"allowed_groups_for_sync" : cfClientIDP .AllowedGroupsForSync ,
196
188
"sync_field" : cfClientIDP .SyncField ,
197
189
}}
@@ -201,10 +193,9 @@ func mapAccountIDPToResource(cfClientIDP cfclient.IDP, d *schema.ResourceData) e
201
193
202
194
if cfClientIDP .ClientType == "auth0" {
203
195
attributes := []map [string ]interface {}{{
204
- "client_id" : cfClientIDP .ClientId ,
205
- "client_secret" : d .Get ("auth0.0.client_secret" ),
206
- "client_secret_encrypted" : cfClientIDP .ClientSecret ,
207
- "domain" : cfClientIDP .ClientHost ,
196
+ "client_id" : cfClientIDP .ClientId ,
197
+ "client_secret" : d .Get ("auth0.0.client_secret" ),
198
+ "domain" : cfClientIDP .ClientHost ,
208
199
}}
209
200
210
201
d .Set ("auth0" , attributes )
@@ -221,7 +212,6 @@ func mapAccountIDPToResource(cfClientIDP cfclient.IDP, d *schema.ResourceData) e
221
212
attributes := []map [string ]interface {}{{
222
213
"app_id" : cfClientIDP .ClientId ,
223
214
"client_secret" : d .Get ("azure.0.client_secret" ),
224
- "client_secret_encrypted" : cfClientIDP .ClientSecret ,
225
215
"object_id" : cfClientIDP .AppId ,
226
216
"autosync_teams_and_users" : cfClientIDP .AutoGroupSync ,
227
217
"sync_interval" : syncInterval ,
@@ -233,11 +223,10 @@ func mapAccountIDPToResource(cfClientIDP cfclient.IDP, d *schema.ResourceData) e
233
223
234
224
if cfClientIDP .ClientType == "onelogin" {
235
225
attributes := []map [string ]interface {}{{
236
- "client_id" : cfClientIDP .ClientId ,
237
- "client_secret" : d .Get ("onelogin.0.client_secret" ),
238
- "client_secret_encrypted" : cfClientIDP .ClientSecret ,
239
- "domain" : cfClientIDP .ClientHost ,
240
- "api_client_id" : cfClientIDP .ApiClientId ,
226
+ "client_id" : cfClientIDP .ClientId ,
227
+ "client_secret" : d .Get ("onelogin.0.client_secret" ),
228
+ "domain" : cfClientIDP .ClientHost ,
229
+ "api_client_id" : cfClientIDP .ApiClientId ,
241
230
// When account scoped, Client secret is returned obfuscated after first apply, causing diff to appear everytime.
242
231
// This behavior would always set the API clint secret from the resource, allowing at least changing the secret when the value in terraform configuration changes.
243
232
// Though it would not detect drift if the secret is changed from UI.
@@ -250,11 +239,10 @@ func mapAccountIDPToResource(cfClientIDP cfclient.IDP, d *schema.ResourceData) e
250
239
251
240
if cfClientIDP .ClientType == "keycloak" {
252
241
attributes := []map [string ]interface {}{{
253
- "client_id" : cfClientIDP .ClientId ,
254
- "client_secret" : d .Get ("keycloak.0.client_secret" ),
255
- "client_secret_encrypted" : cfClientIDP .ClientSecret ,
256
- "host" : cfClientIDP .Host ,
257
- "realm" : cfClientIDP .Realm ,
242
+ "client_id" : cfClientIDP .ClientId ,
243
+ "client_secret" : d .Get ("keycloak.0.client_secret" ),
244
+ "host" : cfClientIDP .Host ,
245
+ "realm" : cfClientIDP .Realm ,
258
246
}}
259
247
260
248
d .Set ("keycloak" , attributes )
@@ -267,22 +255,18 @@ func mapAccountIDPToResource(cfClientIDP cfclient.IDP, d *schema.ResourceData) e
267
255
return err
268
256
}
269
257
attributes := []map [string ]interface {}{{
270
- "endpoint" : cfClientIDP .EntryPoint ,
271
- "application_certificate" : d .Get ("saml.0.application_certificate" ),
272
- "application_certificate_encrypted" : cfClientIDP .ApplicationCert ,
273
- "provider" : cfClientIDP .SamlProvider ,
274
- "allowed_groups_for_sync" : cfClientIDP .AllowedGroupsForSync ,
275
- "autosync_teams_and_users" : cfClientIDP .AutoGroupSync ,
276
- "activate_users_after_sync" : cfClientIDP .ActivateUserAfterSync ,
277
- "sync_interval" : syncInterval ,
278
- "app_id" : cfClientIDP .AppId ,
279
- "client_host" : cfClientIDP .ClientHost ,
280
- "json_keyfile" : d .Get ("saml.0.json_keyfile" ),
281
- "json_keyfile_encrypted" : cfClientIDP .KeyFile ,
282
- "admin_email" : d .Get ("saml.0.admin_email" ),
283
- "admin_email_encrypted" : cfClientIDP .Subject ,
284
- "access_token" : d .Get ("saml.0.access_token" ),
285
- "access_token_encrypted" : cfClientIDP .Access_token ,
258
+ "endpoint" : cfClientIDP .EntryPoint ,
259
+ "application_certificate" : d .Get ("saml.0.application_certificate" ),
260
+ "provider" : cfClientIDP .SamlProvider ,
261
+ "allowed_groups_for_sync" : cfClientIDP .AllowedGroupsForSync ,
262
+ "autosync_teams_and_users" : cfClientIDP .AutoGroupSync ,
263
+ "activate_users_after_sync" : cfClientIDP .ActivateUserAfterSync ,
264
+ "sync_interval" : syncInterval ,
265
+ "app_id" : cfClientIDP .AppId ,
266
+ "client_host" : cfClientIDP .ClientHost ,
267
+ "json_keyfile" : d .Get ("saml.0.json_keyfile" ),
268
+ "admin_email" : d .Get ("saml.0.admin_email" ),
269
+ "access_token" : d .Get ("saml.0.access_token" ),
286
270
}}
287
271
288
272
d .Set ("saml" , attributes )
@@ -292,12 +276,10 @@ func mapAccountIDPToResource(cfClientIDP cfclient.IDP, d *schema.ResourceData) e
292
276
attributes := []map [string ]interface {}{{
293
277
"url" : cfClientIDP .Url ,
294
278
"password" : d .Get ("ldap.0.password" ),
295
- "password_encrypted" : cfClientIDP .Password ,
296
279
"distinguished_name" : cfClientIDP .DistinguishedName ,
297
280
"search_base" : cfClientIDP .SearchBase ,
298
281
"search_filter" : cfClientIDP .SearchFilter ,
299
282
"certificate" : d .Get ("ldap.0.certificate" ),
300
- "certificate_encrypted" : cfClientIDP .Certificate ,
301
283
"allowed_groups_for_sync" : cfClientIDP .AllowedGroupsForSync ,
302
284
"search_base_for_sync" : cfClientIDP .SearchBaseForSync ,
303
285
}}
0 commit comments