What will happen between - Terraform plan and Terraform Apply

HI,

if i have made a Configuration, and have done Terraform Plan, plan output is visible in screen, it shows 1 item to change, but before i use terraform apply, someone goes to Cloud provider UI and does the change manually, and after that i do a terraform apply, what will happen? it will show a error or do nothing or comes back to prompt saying it’s done

E:g - let’s assume we are using AWS, i have to change my security group rule from port 80 to port 443,
I did terraform plan it said 1 item to change
but, in the meantime someone changes the port number from 80 to 443 manually
i do a change, what will happen, it will turn back to port 80, it will error, it will do nothing?
my understanding - since TF is a declarative language, terraform apply will notice the drift, and would understand 443 is already there, it will just update the state file and comes back

Exactly what would happen in this case depends on the design of the underlying API. The most typical situation is that the underlying API only supports submitting a set of new values to the remote system, without any mechanism to detect that the “old values” have changed, and so in that case there is no way a Terraform provider can possibly recognize the situation you described.

When using Terraform, the typical way to avoid the problem you are describing is to avoid changing any object that’s managed by Terraform outside of Terraform. If you are routinely changing a particular outside of Terraform then you should not try to manage that object with Terraform.

@apparentlymart , thank you for taking time and replying