Skip to content
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

Add support for setting auto tune options in aws_elasticsearch_domain #18421

Closed
tdmalone opened this issue Mar 25, 2021 · 6 comments · Fixed by #21652
Closed

Add support for setting auto tune options in aws_elasticsearch_domain #18421

tdmalone opened this issue Mar 25, 2021 · 6 comments · Fixed by #21652
Assignees
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/elasticsearch Issues and PRs that pertain to the elasticsearch service.
Milestone

Comments

@tdmalone
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Add support for specifying new Auto Tune options for Amazon Elasticsearch Clusters.

New or Affected Resource(s)

Potential Terraform Configuration

resource "aws_elasticsearch_domain" "example" {
  ...
  auto_tune_options {
    desired_state       = "ENABLED"          # Valid values ENABLED, DISABLED
    rollback_on_disable = "DEFAULT_ROLLBACK" # Valid values NO_ROLLBACK, DEFAULT_ROLLBACK

    maintenance_schedule {
      start_at                       = "2021-04-01T00:00:00Z"
      duration                       = "1" # or separate into eg. 'duration = { value = 1, unit = "HOURS" }', but HOURS is the only valid unit
      cron_expression_for_recurrence = "* * * * *"
    }
  }
}

References

@tdmalone tdmalone added the enhancement Requests to existing resources that expand the functionality or scope. label Mar 25, 2021
@ghost ghost added the service/elasticsearch Issues and PRs that pertain to the elasticsearch service. label Mar 25, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 25, 2021
@tdmalone
Copy link
Contributor Author

Current workaround (note: untested):

resource "null_resource" "auto_tune_options" {
  provisioner "local-exec" {
    command = <<-EOF
      aws es update-elasticsearch-domain-config \
        --domain-name "${aws_elasticsearch_domain.main.domain_name}" \
        --auto-tune-options '{
          "DesiredState": "ENABLED",
          "RollbackOnDisable": "DEFAULT_ROLLBACK",
          "MaintenanceSchedules": [{
            "StartAt": "2021-04-01T00:00:00Z",
            "Duration": {"Value": 1, "Unit": "HOURS"},
            "CronExpressionForRecurrence": "* * * * *"
          }]
        }'
    EOF
  }
}

@amaxine
Copy link

amaxine commented Apr 6, 2021

I have a mostly working version of this implemented here: 2539a15

A couple of notes tho:

  • tests with version <6.7 fail because they don't support auto tuning, and plans then unset values. I am unsure as to how to correctly gate this or work around it
  • MaintenanceSchedules has problems, specifically:
    • cannot get existing ones from API (this doesn't appear to be exposed at all)
    • attempting to set them fails server-side with The cron expression you provided is invalid. - I used the example from AWS docs, and I get the same problem using the CLI, so maybe the API is broken or incorrectly documented
    • StartAt needs to always be a date in the future, it's unclear to me if that's something that should be getting exposed in that case (regardless tho, the main issue is cron expressions)

I don't know if there's any point to opening a PR as is, though if someone can at least point me at how to fix the test issue, I'd happily do so. The work is good enough to enable/disable auto tuning already.

@oscarwest
Copy link

Looking forward to seeing this in the resource.

@jgrumboe
Copy link

@maxeaubrey
Hi, I'm still very new to Go and Terraform development. It would be cool to have this feature.
I don't know if this is a practise which is used somewhere in aws provider, but wouldn't a simple "if" statement around auto-tune options checking a minimum value of elasticsearch_version do the trick?

@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Sep 4, 2021
@zhelding zhelding self-assigned this Nov 4, 2021
@github-actions github-actions bot added this to the v3.69.0 milestone Dec 3, 2021
@github-actions
Copy link

This functionality has been released in v3.69.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/elasticsearch Issues and PRs that pertain to the elasticsearch service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants