Ignore the entire block if condition is not true

Is there any way that I can ignore the entire block if my condition is not true,
EX:
image_uri = “${module.ecr_repository.url}:dummy”
lifecycle {
ignore_changes = [
image_uri
]
}
Let’s assume I am not going to use image_uri block but I still need to keep them on my module for reuse purposes without creating a new Lambda Function.
now when I apply I need to just ignore that entire part and create the lambda.
How can I put a condition to ignore the above mention block when I really don’t want to use it?

If you compare it with this module, then you’d just set it to null if not needed. You might also consider using that module, though.

Thank you! let me try this and update, you mean in variable file default = null right?