You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/iac/concepts/options/ignorechanges.md
+16-9Lines changed: 16 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ After the resource is created, Pulumi relies on the last recorded state for ever
26
26
27
27
Because Pulumi reuses the value stored in the state, an external system can safely update the live resource as long as you synchronize the stack before the next update. Run `pulumi refresh` (or `pulumi up --refresh`) to pull the latest provider values into the state. Skipping the refresh step leaves stale values in the state, and Pulumi will continue to send those stale values to the provider during subsequent updates, which can overwrite the drift you meant to preserve.
28
28
29
-
{{% notes "warning" %}}
29
+
{{% notes type="warning" %}}
30
30
When you skip `pulumi refresh` (or `pulumi up --refresh`) after `ignoreChanges` has been set, Pulumi keeps using the previous state value when it performs an update. Providers that require full object replacements—such as AWS load balancer listeners where the entire target group array is sent on every update—will receive the stale values from the state and may reset the live configuration.
31
31
{{% /notes %}}
32
32
@@ -107,7 +107,7 @@ resources:
107
107
108
108
{{< /chooser >}}
109
109
110
-
One reason you would use the `ignoreChanges` option is to ignore changes in properties that lead to diffs. Another reason is to change the defaults for a property without forcing all existing deployed stacks to update or replace the affected resource. This is common after you’ve imported existing infrastructure provisioned by another method into Pulumi. In these cases, there may be historical drift that you’d prefer to retain, rather than replacing and reconstructing critical parts of your infrastructure.
110
+
One reason you would use the `ignoreChanges` option is to ignore changes in properties that lead to diffs. Another reason is to change the defaults for a property without forcing all existing deployed stacks to update or replace the affected resource. This commonly occurs after importing existing infrastructure provisioned by another method into Pulumi. In these cases, there may be historical drift that you’d prefer to retain, rather than replacing and reconstructing critical parts of your infrastructure.
111
111
112
112
## Example: Preserve externally managed weights
113
113
@@ -145,6 +145,8 @@ const frontEndListener = new aws.lb.Listener("frontEndListener", {
new CustomResourceOptions { IgnoreChanges = { "defaultActions[*].forward.targetGroups[*].weight" } });
295
299
296
300
});
297
301
@@ -353,7 +357,10 @@ public class App {
353
357
.build())
354
358
.build())
355
359
.build())
356
-
.build());
360
+
.build(),
361
+
CustomResourceOptions.builder()
362
+
.ignoreChanges("prop")
363
+
.build());
357
364
358
365
}
359
366
}
@@ -402,17 +409,17 @@ resources:
402
409
403
410
After the initial deployment, an external process could change the weights (for example, to a 50/50 split). Before you next run `pulumi up` to add a third target group, run `pulumi refresh` so that the stack captures the live weights. Without the refresh, Pulumi retains the original `100` and `0` values in state and will resend them to the AWS API on the next update, resetting the weights you meant to preserve.
404
411
405
-
{{% notes "info" %}}
412
+
{{% notes type="info" %}}
406
413
The `ignoreChanges` option only applies to resource inputs, not outputs.
407
414
{{% /notes %}}
408
415
409
-
{{% notes "info" %}}
416
+
{{% notes type="info" %}}
410
417
The `ignoreChanges` resource option does not apply to inputs to component resources. If `ignoreChanges` is passed to a component resource, it is up to that component's implementation to decide what if anything it will do.
411
418
{{% /notes %}}
412
419
413
420
In addition to passing simple property names, nested properties can also be supplied to ignore changes to a more targeted nested part of the resource's inputs. See [property paths](/docs/iac/concepts/miscellaneous/property-paths/) for examples of legal paths that can be passed to specify nested properties of objects and arrays.
414
421
415
-
{{% notes "info" %}}
422
+
{{% notes type="info" %}}
416
423
For arrays with different lengths, only changes for elements that are in both arrays are ignored. If the new input array is longer, additional elements will be taken from the new array. If the new array is shorter, we only take that number of elements from the original array.
417
424
418
425
For example `ignoreChanges` on an old array `[1, 2]` and a new array `[a, b, c]` results in `[1, 2, c]`, and an old array `[1, 2, 3]` and a new array `[a, b]` results in `[1, 2]`.
0 commit comments