Skip to content

Commit

Permalink
feat(file): make file non-challenge related by default
Browse files Browse the repository at this point in the history
  • Loading branch information
pandatix committed Jun 2, 2024
1 parent 91298c6 commit 5ce81f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/resources/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions provider/file_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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()
}

0 comments on commit 5ce81f5

Please sign in to comment.