Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ resource "aws_instance" "default" {
tags = module.this.tags

volume_tags = var.volume_tags_enabled ? module.this.tags : {}

lifecycle {
ignore_changes = var.ignore_ami_changes ? [ami] : []
Copy link
Member

Choose a reason for hiding this comment

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

I don't believe variables are supported in lifecycle blocks in terraform

Copy link
Author

@Lawstorant Lawstorant Oct 1, 2024

Choose a reason for hiding this comment

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

You're right. Well, that's what I get by not testing things properly

}
}

resource "aws_eip" "default" {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ variable "ami_owner" {
default = ""
}

variable "ignore_ami_changes" {
type = bool
description = "Do not recreate the EC2 instance if proivided AMI image ID changes"
default = false
}

variable "ebs_optimized" {
type = bool
description = "Launched EC2 instance will be EBS-optimized"
Expand Down