Skip to content

Commit 82cbf7a

Browse files
gsoldevilatobio
andauthored
Do not set LastExecutionDate if it is nil (#508)
* Do not set LastExecutionDate if it is `nil` * Changelog --------- Co-authored-by: Toby Brain <[email protected]>
1 parent 53e466a commit 82cbf7a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## [Unreleased]
22

3+
### Fixed
4+
- Handle nil LastExecutionDate's in Kibana alerting rules. ([#508](https://github.com/elastic/terraform-provider-elasticstack/pull/508))
5+
36
## [0.11.0] - 2023-12-12
47

58
### Added

internal/kibana/alerting.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,10 @@ func resourceRuleRead(ctx context.Context, d *schema.ResourceData, meta interfac
325325
if err := d.Set("last_execution_status", rule.ExecutionStatus.Status); err != nil {
326326
return diag.FromErr(err)
327327
}
328-
if err := d.Set("last_execution_date", rule.ExecutionStatus.LastExecutionDate.Format("2006-01-02 15:04:05.999 -0700 MST")); err != nil {
329-
return diag.FromErr(err)
328+
if rule.ExecutionStatus.LastExecutionDate != nil {
329+
if err := d.Set("last_execution_date", rule.ExecutionStatus.LastExecutionDate.Format("2006-01-02 15:04:05.999 -0700 MST")); err != nil {
330+
return diag.FromErr(err)
331+
}
330332
}
331333

332334
params, err := json.Marshal(rule.Params)

0 commit comments

Comments
 (0)