-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Cannot create stable aws_elasticsearch_domain resources with auto_tune_options specified #22239
Comments
@bevanbennett Thanks for raising this issue. |
Thanks Kit! I didn't know about the time provider. Maybe we should mention it as a useful example in the docs for aws_elasticsearch_domain and specifically auto_tune_options. |
So is |
@ewbankkit It seems like there may need to be a different model needed here for internally calculating the |
Has anyone come up with a good workaround? I also get a cycle error when trying to use the time provider. I've put a snippet of my code below for reference along with the error. Error: Cycle: module.es.time_offset.auto_tune_start, module.es.aws_elasticsearch_domain.domain
|
Spent a bit of time wrestling with this, and wanted to jot down my thoughts. First, I was intrigued by @bostrowski13's comment:
I tried running
But it's true — the AWS console doesn't ask for that parameter at all. I examined the API request the console sends for you, and it's just tricking you: even though it doesn't ask you for the parameter, it does send it. Specifically, it sends the timestamp for now plus 24 hours. So, given that, I have a proposal for a fix. We'll add a new schema parameter to the I thought about trying to set a As I've never contributed to Terraform or this provider, I'd appreciate feedback on this approach. I'm willing to give it a shot if it seems reasonable. |
|
@ravron is there any update on the fix yet? |
@ewbankkit the moving timestamp you mentioned is not the issue, as I hard coded my Do you see anyway of improving the drift detection? As @ravron dived a bit deeper into it and it seems the API behaves a bit unhelpful here. For now I have had to resort to |
Hi Dirk (@YakDriver), |
FYI (also for any user stumbling upon this ticket):
resource "time_offset" "start_at" {
triggers = { create = local.name_tag }
offset_hours = 4
}
|
Looks like Auto-Tune maintenance windows are (to be) superseded by 10h "off-peak windows" since Feb 2023
AWS: https://docs.aws.amazon.com/opensearch-service/latest/developerguide/off-peak.html incl. Migrating from Auto-Tune maintenance windows section. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Debug Output
Panic Output
Expected Behavior
After adding auto_tune_options, we should be able to update existing clusters without causing eternal planning diffs.
Actual Behavior
With no start_at specified, plan errors out with
The argument "start_at" is required, but no definition was found.
With a hardcoded start_at, plan succeeds but apply will eventually fail when start_at is in the past
Error: ValidationException: The StartAt time you provided occurs in the past. Specify a time in the future.
With a computed start_at, every plan flags this as a change and wants to update the resource
If we ignore_changes for
auto_tune_options[0].maintenance_schedule
, we can never add a maintenance schedule where one did not exist previously, or update other elements of the maintenance schedule.If we try to reference the start_at element directly, we cannot because:
Going through other, similar ignore_changes issues, it's suggested that changing this from a Set to a ListType could address the issue by allowing us to address individual maintenance_schedule blocks inside auto_tune_options and filter out start_at. That said, given the requirement for, and behaviour of start_at in this context, I'd expect this resource to include a built-in ignore_changes for it so that this resource is actually useable in a non-hardcoded manner. Currently it looks like our only option is to pass an explicit start_at based on the current date to every invocation of the module, which is awkward and ugly.
Steps to Reproduce
terraform apply
Important Factoids
Trying to use this resource in a module that's applied to many environments.
References
The text was updated successfully, but these errors were encountered: