Skip to content

Commit

Permalink
Add "keepers" to the checks (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
masterfuzz authored Apr 4, 2023
1 parent a909dca commit e0de92c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/resources/http_health.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ resource "checkmate_http_health" "example_insecure_tls" {
- `headers` (Map of String) HTTP Request Headers
- `insecure_tls` (Boolean) Wether or not to completely skip the TLS CA verification. Default false.
- `interval` (Number) Interval in milliseconds between attemps. Default 200
- `keepers` (Map of String) Arbitrary map of string values that when changed will cause the healthcheck to run again.
- `method` (String) HTTP Method, defaults to GET
- `request_body` (String) Optional request body to send on each attempt.
- `request_timeout` (Number) Timeout for an individual request. If exceeded, the attempt will be considered failure and potentially retried. Default 1000
Expand Down
1 change: 1 addition & 0 deletions docs/resources/local_command.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ resource "checkmate_local_command" "example" {
- `consecutive_successes` (Number) Number of consecutive successes required before the check is considered successful overall. Defaults to 1.
- `create_anyway_on_check_failure` (Boolean) If false, the resource will fail to create if the check does not pass. If true, the resource will be created anyway. Defaults to false.
- `interval` (Number) Interval in milliseconds between attemps. Default 200
- `keepers` (Map of String) Arbitrary map of string values that when changed will cause the check to run again.
- `timeout` (Number) Overall timeout in milliseconds for the check before giving up, default 10000
- `working_directory` (String) Working directory where the command will be run. Defaults to the current working directory

Expand Down
6 changes: 6 additions & 0 deletions internal/provider/resource_http_health.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ func (*HttpHealthResource) Schema(ctx context.Context, req resource.SchemaReques
Optional: true,
MarkdownDescription: "Wether or not to completely skip the TLS CA verification. Default false.",
},
"keepers": schema.MapAttribute{
ElementType: types.StringType,
MarkdownDescription: "Arbitrary map of string values that when changed will cause the healthcheck to run again.",
Optional: true,
},
},
}
}
Expand All @@ -150,6 +155,7 @@ type HttpHealthResourceModel struct {
ResultBody types.String `tfsdk:"result_body"`
CABundle types.String `tfsdk:"ca_bundle"`
InsecureTLS types.Bool `tfsdk:"insecure_tls"`
Keepers types.Map `tfsdk:"keepers"`
}

func (r *HttpHealthResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/resource_local_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ func (*LocalCommandResource) Schema(ctx context.Context, req resource.SchemaRequ
MarkdownDescription: "Identifier",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"keepers": schema.MapAttribute{
ElementType: types.StringType,
MarkdownDescription: "Arbitrary map of string values that when changed will cause the check to run again.",
Optional: true,
},
}}
}

Expand All @@ -116,6 +121,7 @@ type LocalCommandResourceModel struct {
Stderr types.String `tfsdk:"stderr"`
IgnoreFailure types.Bool `tfsdk:"create_anyway_on_check_failure"`
Passed types.Bool `tfsdk:"passed"`
Keepers types.Map `tfsdk:"keepers"`
}

// ImportState implements resource.ResourceWithImportState
Expand Down

0 comments on commit e0de92c

Please sign in to comment.