Terraform

What happens if you update user_data in the following case and apply the changes?

resource "aws_instance" "example" {
 ami = "..."
 instance_type = "t2.micro"

 user_data =  index.xhtml
 EOF
}

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

Nothing, because user_data is executed on boot so if an instance is already running, it won't change anything.

To make it effective you'll have to use user_data_replace_on_change = true.