terraform,

Resolve: 'The block type lifecycle is reserved for use by Terraform in a future version'

Apr 13, 2023 · 1 min read · Post a comment

A common error for Terraform beginners out there is: The block type "lifecycle" is reserved for use by Terraform in a future version. in case you want to “ignore” a certain attribute change. And, this is all about lifecycle and ignore_changes.

Prerequisites

  • Terraform

Solution

The short answer is to use lifecycle in the format as:

lifecycle {
  ignore_changes = [
    <some_attribute_name_to_ignore_here>
  ]
}

For instance:

resource "aws_elasticsearch_domain" "this" {
  ...

  domain_name           = var.domain_name
  elasticsearch_version = var.elasticsearch_version

  lifecycle {
    ignore_changes = [
      log_publishing_options
    ]
  }
}

Conclusion

In case nothing works, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.