@@ -94,6 +94,7 @@ func (r *fileResource) Schema(ctx context.Context, req resource.SchemaRequest, r
94
94
Sensitive : true , // define as sensitive, because content could be + avoid printing it
95
95
PlanModifiers : []planmodifier.String {
96
96
stringplanmodifier .RequiresReplace (),
97
+ stringplanmodifier .UseStateForUnknown (),
97
98
},
98
99
},
99
100
},
@@ -162,6 +163,9 @@ func (r *fileResource) Create(ctx context.Context, req resource.CreateRequest, r
162
163
data .SHA1Sum = types .StringValue (res [0 ].SHA1sum )
163
164
data .Location = types .StringValue (res [0 ].Location )
164
165
166
+ // Nullify content so it doesn’t go into state
167
+ data .ContentB64 = types .StringNull ()
168
+
165
169
if resp .Diagnostics .HasError () {
166
170
return
167
171
}
@@ -192,18 +196,18 @@ func (r *fileResource) Read(ctx context.Context, req resource.ReadRequest, resp
192
196
return
193
197
}
194
198
195
- content , err := r .client .GetFileContent (& api.File {
196
- Location : res .Location ,
197
- }, api .WithContext (ctx ))
198
- if err != nil {
199
- resp .Diagnostics .AddError (
200
- "CTFd Error" ,
201
- fmt .Sprintf ("Unable to read file at location %s, got error: %s" , res .Location , err ),
202
- )
203
- return
204
- }
199
+ // content, err := r.client.GetFileContent(&api.File{
200
+ // Location: res.Location,
201
+ // }, api.WithContext(ctx))
202
+ // if err != nil {
203
+ // resp.Diagnostics.AddError(
204
+ // "CTFd Error",
205
+ // fmt.Sprintf("Unable to read file at location %s, got error: %s", res.Location, err),
206
+ // )
207
+ // return
208
+ // }
205
209
206
- data .ContentB64 = types .StringValue (base64 .StdEncoding .EncodeToString (content ))
210
+ // data.ContentB64 = types.StringValue(base64.StdEncoding.EncodeToString(content))
207
211
208
212
if resp .Diagnostics .HasError () {
209
213
return
0 commit comments