Starting in Terraform Version
0.15.4, new reporting shows updates being made to the state file after detecting remote object changes. This is a task Terraform has done historically by design during
refreshsilently in the background. This new feature brings this information to the forefront for user awareness. It is important to review how the state is changing to match the remote system. This feature solves the gap in knowledge that was previously hidden and avoids negative consequences. Users now have the opportunity to review changes to the remote system that are either expected or catch changes that are not expected.
1.2.0 and newer.
In previous versions, as demonstrated in the next section of this article, the feature originally streamed all of the changes that occurred to the state file. This created an extensive output to stream at plan time for large terraform configurations, which caused workflow interruptions. More information on this can be found in GitHub Issue 28803.
In newer versions during
terraform plantime, "Note: Objects have changed outside of Terraform." will only stream in the plan output if the remote changes are related to resources and resource attributes that contributed to the changes Terraform is proposing to make in the current run. More information on this can be found in GitHub Issue 30486.
(~) Update In-Place Remote Objects to State
Here is an example of what this feature looks like when an in-place change is made after a remote object change is detected.
Reporting this change to the state is important and can result in a change in behavior of your configuration if any other expressions in the module refer to the changed value.
In this example, if there were any reference to
elsewhere in the module, the value returned would be
2VCPUs rather than
0VCPUs after detecting this change. This is the behavior Terraform is reporting in order to show context around which actions Terraform decides are appropriate for the next plan. This is behavior that has always existed behind the scenes and is now visual for Terraform users.
(+) Adding Remote Objects to State
Another reporting feature that may be observed includes the addition of provider required objects that exist remotely and need to be added to the state to match.
The only mechanism Terraform currently has in order to disable detecting these remote changes during
refreshis the global
-refresh=falseoption, which will result in Terraform not refreshing anything at all. It is advised to have Terraform refresh during the normal planning phase (default behavior) and allow this reporting to occur. This is highly recommended in order to be clear about the new values Terraform used as the basis of the plan.
This note is to clarify that
ignore_changesis not designed to ignore any changes that are coming in from the remote system. The
ignore_changesargument disables Terraform behavior of comparing the terraform configuration to the state in order to plan any necessary new actions. The “Objects have change outside of Terraform” is reporting a difference between the prior state and remote objects.