Skip to content

[ResponseOps] Maintenance Window Resource #1037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

adcoelho
Copy link
Contributor

@adcoelho adcoelho commented Feb 26, 2025

Closes #197021

Summary

The response-ops team has been working on a public maintenance window API.

Most of the work is done and the feature should be available for v9.1.0. (Feature branch PR)

This PR enables users to define maintenance windows tf resources.

Testing

The server version needs to be >=9.1.0 so on all the tests I have been using the maintenance window API feature branch.

I built it locally and ran testacc or Terraform commands.

What would the proper procedure be to deploy this change?

Example resource

resource "elasticstack_kibana_maintenance_window" "my_maintenance_window" {
  title   = "Terraform Maintenance Window Updated"
  enabled = true
  custom_schedule {
    start    = "1992-01-01T05:00:00.200Z"
    duration = "12d"

    recurring {
      every       = "20d"
      end         = "2029-05-17T05:05:00.000Z"
      on_week_day = ["MO", "TU"]
    }
  }

  scope {
    alerting {
      kql = "_id: '1234'"
    }
  }
}

@adcoelho adcoelho changed the title [OnWeek] Maintenance Window APi [OnWeek] Maintenance Window API Mar 4, 2025
@TinaHeiligers TinaHeiligers requested review from TinaHeiligers and removed request for TinaHeiligers March 23, 2025 20:56
@adcoelho adcoelho requested a review from tobio April 8, 2025 12:16
@adcoelho adcoelho self-assigned this Apr 8, 2025
@adcoelho adcoelho marked this pull request as ready for review April 8, 2025 12:25
@adcoelho adcoelho changed the title [OnWeek] Maintenance Window API [ResponseOps] Maintenance Window Resource Apr 8, 2025
@adcoelho adcoelho requested a review from jcger April 10, 2025 11:19
}

func ResourceMaintenanceWindow() *schema.Resource {
apikeySchema := map[string]*schema.Schema{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like this wasn't generated but implemented by you. If so, couldn't this be generated based on the OAS files we create on the Kibana side?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generation is only for the API client, so the resource specification is usually done manually. Maybe there is a way but I don't think we use it in this project.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hashicorp have an openapi generator which builds a schema based on a set of openapi routes. It's not used in this project yet, but we're using it to help with Serverless project resources. It's... ok, but has some limitations to deal with.

Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we able to use the consolidated kibana spec for this new resource rather than on the older alerting client?

return nil
}

func ResourceMaintenanceWindow() *schema.Resource {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rebuild this as a plugin-framework based resource (data view as an example). It automatically solves a bunch of TF related limitations, and should be the future for any new work in the provider.

}

func ResourceMaintenanceWindow() *schema.Resource {
apikeySchema := map[string]*schema.Schema{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hashicorp have an openapi generator which builds a schema based on a set of openapi routes. It's not used in this project yet, but we're using it to help with Serverless project resources. It's... ok, but has some limitations to deal with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants