Terraform output shows previous public IP after ec2 instance type change

I have updated the instance type of my EC2 instance on my Terraform resources. It has started a new instance with new public ip. But my outputs are showing the previous public IP

Hi @ruwanvm,

If your output value refers directly to the public_ip attribute of the EC2 instance then Terraform should typically detect that it will change as part of replacing the instance, because the provider will signal that public_ip is a value known only after apply.

It sounds like something unusual happened in your case. To understand more about that, it would help if you can share the relevant parts of your configuration (at least the output value definition and any resource it directly refers to) and, if you still have it, the planned changes Terraform proposed which included the one to replace this EC2 instance, and which would typically also include a plan to change the output value (but perhaps did not, in your case).

Thanks!