@@ -220,18 +220,23 @@ func (r *resourceTFEHYOKConfiguration) Create(ctx context.Context, req resource.
220
220
}
221
221
222
222
var azureOIDCConfig * tfe.AzureOIDCConfiguration
223
- if plan .VaultOIDCConfigurationID .ValueString () != "" {
223
+ if plan .AzureOIDCConfigurationID .ValueString () != "" {
224
224
azureOIDCConfig = & tfe.AzureOIDCConfiguration {ID : plan .AzureOIDCConfigurationID .ValueString ()}
225
225
}
226
226
227
- options := tfe.HYOKConfigurationsCreateOptions {
228
- KEKID : plan .KEKID .ValueString (),
229
- Name : plan .Name .ValueString (),
230
- KMSOptions : & tfe.KMSOptions {
227
+ var kmsOptions * tfe.KMSOptions
228
+ if plan .KMSOptions != nil {
229
+ kmsOptions = & tfe.KMSOptions {
231
230
KeyRegion : plan .KMSOptions .KeyRegion .ValueString (),
232
231
KeyLocation : plan .KMSOptions .KeyLocation .ValueString (),
233
232
KeyRingID : plan .KMSOptions .KeyRingID .ValueString (),
234
- },
233
+ }
234
+ }
235
+
236
+ options := tfe.HYOKConfigurationsCreateOptions {
237
+ KEKID : plan .KEKID .ValueString (),
238
+ Name : plan .Name .ValueString (),
239
+ KMSOptions : kmsOptions ,
235
240
OIDCConfiguration : & tfe.OIDCConfigurationTypeChoice {
236
241
AWSOIDCConfiguration : awsOIDCConfig ,
237
242
GCPOIDCConfiguration : gcpOIDCConfig ,
@@ -295,15 +300,20 @@ func (r *resourceTFEHYOKConfiguration) Update(ctx context.Context, req resource.
295
300
return
296
301
}
297
302
298
- options := tfe.HYOKConfigurationsUpdateOptions {
299
- Name : plan .Name .ValueStringPointer (),
300
- KEKID : plan .KEKID .ValueStringPointer (),
301
- KMSOptions : & tfe.KMSOptions {
303
+ var kmsOptions * tfe.KMSOptions
304
+ if plan .KMSOptions != nil {
305
+ kmsOptions = & tfe.KMSOptions {
302
306
KeyRegion : plan .KMSOptions .KeyRegion .ValueString (),
303
307
KeyLocation : plan .KMSOptions .KeyLocation .ValueString (),
304
308
KeyRingID : plan .KMSOptions .KeyRingID .ValueString (),
305
- },
306
- AgentPool : & tfe.AgentPool {ID : plan .AgentPoolID .ValueString ()},
309
+ }
310
+ }
311
+
312
+ options := tfe.HYOKConfigurationsUpdateOptions {
313
+ Name : plan .Name .ValueStringPointer (),
314
+ KEKID : plan .KEKID .ValueStringPointer (),
315
+ KMSOptions : kmsOptions ,
316
+ AgentPool : & tfe.AgentPool {ID : plan .AgentPoolID .ValueString ()},
307
317
}
308
318
309
319
hyokID := state .ID .ValueString ()
@@ -340,10 +350,13 @@ func (r *resourceTFEHYOKConfiguration) Delete(ctx context.Context, req resource.
340
350
}
341
351
342
352
func modelFromTFEHYOKConfiguration (p * tfe.HYOKConfiguration ) modelTFEHYOKConfiguration {
343
- kmsOptions := modelTFEKMSOptions {
344
- KeyRegion : types .StringValue (p .KMSOptions .KeyRegion ),
345
- KeyLocation : types .StringValue (p .KMSOptions .KeyLocation ),
346
- KeyRingID : types .StringValue (p .KMSOptions .KeyRingID ),
353
+ var kmsOptions * modelTFEKMSOptions
354
+ if p .KMSOptions != nil {
355
+ kmsOptions = & modelTFEKMSOptions {
356
+ KeyRegion : types .StringValue (p .KMSOptions .KeyRegion ),
357
+ KeyLocation : types .StringValue (p .KMSOptions .KeyLocation ),
358
+ KeyRingID : types .StringValue (p .KMSOptions .KeyRingID ),
359
+ }
347
360
}
348
361
349
362
model := modelTFEHYOKConfiguration {
@@ -352,7 +365,7 @@ func modelFromTFEHYOKConfiguration(p *tfe.HYOKConfiguration) modelTFEHYOKConfigu
352
365
KEKID : types .StringValue (p .KEKID ),
353
366
Organization : types .StringValue (p .Organization .Name ),
354
367
AgentPoolID : types .StringValue (p .AgentPool .ID ),
355
- KMSOptions : & kmsOptions ,
368
+ KMSOptions : kmsOptions ,
356
369
}
357
370
358
371
if p .OIDCConfiguration .AWSOIDCConfiguration != nil {
0 commit comments