@@ -172,16 +172,23 @@ func (r *OrganizationVariableResource) Create(ctx context.Context, req resource.
172
172
organizationVariable := & client.OrganizationVariableEntity {}
173
173
174
174
err = jsonapi .UnmarshalPayload (strings .NewReader (string (bodyResponse )), organizationVariable )
175
-
175
+ tflog . Info ( ctx , string ( bodyResponse ))
176
176
if err != nil {
177
177
resp .Diagnostics .AddError ("Error unmarshal payload response" , fmt .Sprintf ("Error unmarshal payload response: %s" , err ))
178
178
return
179
179
}
180
180
181
181
tflog .Info (ctx , "Body Response" , map [string ]any {"bodyResponse" : string (bodyResponse )})
182
182
183
+ if * organizationVariable .Sensitive {
184
+ tflog .Info (ctx , "Variable value is not included in response, setting values the same as the plan for sensitive=true..." )
185
+ plan .Value = types .StringValue (plan .Value .ValueString ())
186
+ } else {
187
+ tflog .Info (ctx , "Variable value is included in response..." )
188
+ plan .Value = types .StringValue (organizationVariable .Value )
189
+ }
190
+
183
191
plan .Key = types .StringValue (organizationVariable .Key )
184
- plan .Value = types .StringValue (organizationVariable .Value )
185
192
plan .Description = types .StringValue (organizationVariable .Description )
186
193
plan .Category = types .StringValue (organizationVariable .Category )
187
194
plan .Sensitive = types .BoolValue (* organizationVariable .Sensitive )
@@ -231,8 +238,15 @@ func (r *OrganizationVariableResource) Read(ctx context.Context, req resource.Re
231
238
232
239
tflog .Info (ctx , "Body Response" , map [string ]any {"bodyResponse" : string (bodyResponse )})
233
240
241
+ if * organizationVariable .Sensitive {
242
+ tflog .Info (ctx , "Variable value is not included in response, setting values the same as the current state value" )
243
+ state .Value = types .StringValue (state .Value .ValueString ())
244
+ } else {
245
+ tflog .Info (ctx , "Variable value is included in response..." )
246
+ state .Value = types .StringValue (organizationVariable .Value )
247
+ }
248
+
234
249
state .Key = types .StringValue (organizationVariable .Key )
235
- state .Value = types .StringValue (organizationVariable .Value )
236
250
state .Description = types .StringValue (organizationVariable .Description )
237
251
state .Category = types .StringValue (organizationVariable .Category )
238
252
state .Sensitive = types .BoolValue (* organizationVariable .Sensitive )
@@ -330,7 +344,15 @@ func (r *OrganizationVariableResource) Update(ctx context.Context, req resource.
330
344
331
345
plan .ID = types .StringValue (state .ID .ValueString ())
332
346
plan .Key = types .StringValue (organizationVariable .Key )
333
- plan .Value = types .StringValue (organizationVariable .Value )
347
+
348
+ if * organizationVariable .Sensitive {
349
+ tflog .Info (ctx , "Variable value is not included in response, setting values the same as the plan for sensitive=true..." )
350
+ plan .Value = types .StringValue (plan .Value .ValueString ())
351
+ } else {
352
+ tflog .Info (ctx , "Variable value is included in response..." )
353
+ plan .Value = types .StringValue (organizationVariable .Value )
354
+ }
355
+
334
356
plan .Description = types .StringValue (organizationVariable .Description )
335
357
plan .Category = types .StringValue (organizationVariable .Category )
336
358
plan .Sensitive = types .BoolValue (* organizationVariable .Sensitive )
0 commit comments