Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
support for cloudflare_logpush_job kind attribute (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfaulkner committed Jun 28, 2022
1 parent 6428077 commit 1ff13ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/resources/logpush_job.md
Expand Up @@ -118,8 +118,9 @@ resource "cloudflare_logpush_job" "example_job" {
- `enabled` (Boolean) Whether to enable the job.
- `filter` (String) Use filters to select the events to include and/or remove from your logs. For more information, refer to [Filters](https://developers.cloudflare.com/logs/reference/logpush-api-configuration/filters/).
- `frequency` (String) A higher frequency will result in logs being pushed on faster with smaller files. `low` frequency will push logs less often with larger files. Available values: `high`, `low`. Defaults to `high`.
- `kind` (String) The kind of logpush job to create. Available values: `edge`, `instant-logs`, ``.
- `logpull_options` (String) Configuration string for the Logshare API. It specifies things like requested fields and timestamp formats. See [Logpull options documentation](https://developers.cloudflare.com/logs/logpush/logpush-configuration-api/understanding-logpush-api/#options).
- `name` (String) The name of the logpush job to create. Must match the regular expression `^[a-zA-Z0-9\-\.]*$`.
- `name` (String) The name of the logpush job to create.
- `ownership_challenge` (String) Ownership challenge token to prove destination ownership, required when destination is Amazon S3, Google Cloud Storage, Microsoft Azure or Sumo Logic. See [Developer documentation](https://developers.cloudflare.com/logs/logpush/logpush-configuration-api/understanding-logpush-api/#usage).
- `zone_id` (String) The zone identifier to target for the resource.

Expand Down
2 changes: 2 additions & 0 deletions internal/provider/resource_cloudflare_logpush_job.go
Expand Up @@ -63,6 +63,7 @@ func getJobFromResource(d *schema.ResourceData) (cloudflare.LogpushJob, *AccessI
job := cloudflare.LogpushJob{
ID: id,
Enabled: d.Get("enabled").(bool),
Kind: d.Get("kind").(string),
Name: d.Get("name").(string),
Dataset: d.Get("dataset").(string),
LogpullOptions: d.Get("logpull_options").(string),
Expand Down Expand Up @@ -130,6 +131,7 @@ func resourceCloudflareLogpushJobRead(ctx context.Context, d *schema.ResourceDat
}

d.Set("name", job.Name)
d.Set("kind", job.Kind)
d.Set("enabled", job.Enabled)
d.Set("logpull_options", job.LogpullOptions)
d.Set("destination_conf", job.DestinationConf)
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/schema_cloudflare_logpush_job.go
Expand Up @@ -27,6 +27,12 @@ func resourceCloudflareLogpushJobSchema() map[string]*schema.Schema {
Optional: true,
Description: "Whether to enable the job.",
},
"kind": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"edge", "instant-logs", ""}, false),
Description: fmt.Sprintf("The kind of logpush job to create. %s", renderAvailableDocumentationValuesStringSlice([]string{"edge", "instant-logs", ""})),
},
"name": {
Type: schema.TypeString,
Optional: true,
Expand Down

0 comments on commit 1ff13ba

Please sign in to comment.