diff --git a/docs/resources/file.md b/docs/resources/file.md index 680608c..84b3960 100644 --- a/docs/resources/file.md +++ b/docs/resources/file.md @@ -44,11 +44,11 @@ resource "ctfd_file" "http_file" { ### Required -- `challenge_id` (String) Challenge of the file. - `name` (String) Name of the file as displayed to end-users. ### Optional +- `challenge_id` (String) Challenge of the file. - `content` (String, Sensitive) Raw content of the file, perfectly fit the use-cases of a .txt document or anything with a simple binary content. You could provide it from the file-system using `file("${path.module}/...")`. - `contentb64` (String, Sensitive) Base 64 content of the file, perfectly fit the use-cases of complex binaries. You could provide it from the file-system using `filebase64("${path.module}/...")`. - `location` (String) Location where the file is stored on the CTFd instance, for download purposes. diff --git a/provider/file_resource.go b/provider/file_resource.go index afd01b5..0885c01 100644 --- a/provider/file_resource.go +++ b/provider/file_resource.go @@ -60,7 +60,7 @@ func (r *fileResource) Schema(ctx context.Context, req resource.SchemaRequest, r }, "challenge_id": schema.StringAttribute{ MarkdownDescription: "Challenge of the file.", - Required: true, + Optional: true, }, "name": schema.StringAttribute{ MarkdownDescription: "Name of the file as displayed to end-users.", @@ -291,9 +291,5 @@ func lookForChallengeId(ctx context.Context, client *api.Client, fileID int, dia } } } - diags.AddError( - "Provider Error", - fmt.Sprintf("Unable to find challenge of file %d", fileID), - ) return types.StringNull() }