Skip to content

Commit 8cf5173

Browse files
committed
update docs
1 parent ae92d76 commit 8cf5173

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

content/docs/iac/concepts/options/ignorechanges.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ After the resource is created, Pulumi relies on the last recorded state for ever
2626

2727
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.
2828

29-
{{% notes "warning" %}}
29+
{{% notes type="warning" %}}
3030
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.
3131
{{% /notes %}}
3232

@@ -107,7 +107,7 @@ resources:
107107
108108
{{< /chooser >}}
109109
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.
111111

112112
## Example: Preserve externally managed weights
113113

@@ -145,6 +145,8 @@ const frontEndListener = new aws.lb.Listener("frontEndListener", {
145145
],
146146
},
147147
}],
148+
}, {
149+
ignoreChanges: ['defaultActions[*].forward.targetGroups[*].weight']
148150
});
149151
150152
```
@@ -180,7 +182,8 @@ front_end_listener = aws.lb.Listener("frontEndListener",
180182
},
181183
],
182184
},
183-
}])
185+
}],
186+
opts=ResourceOptions(ignore_changes=["defaultActions[*].forward.targetGroups[*].weight"]))
184187
185188
```
186189

@@ -233,7 +236,7 @@ func main() {
233236
},
234237
},
235238
},
236-
})
239+
}, pulumi.IgnoreChanges([]string{"defaultActions[*].forward.targetGroups[*].weight"}))
237240
if err != nil {
238241
return err
239242
}
@@ -291,7 +294,8 @@ return await Deployment.RunAsync(() =>
291294
},
292295
},
293296
},
294-
});
297+
},
298+
new CustomResourceOptions { IgnoreChanges = { "defaultActions[*].forward.targetGroups[*].weight" } });
295299
296300
});
297301
@@ -353,7 +357,10 @@ public class App {
353357
.build())
354358
.build())
355359
.build())
356-
.build());
360+
.build(),
361+
CustomResourceOptions.builder()
362+
.ignoreChanges("prop")
363+
.build());
357364
358365
}
359366
}
@@ -402,17 +409,17 @@ resources:
402409

403410
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.
404411

405-
{{% notes "info" %}}
412+
{{% notes type="info" %}}
406413
The `ignoreChanges` option only applies to resource inputs, not outputs.
407414
{{% /notes %}}
408415

409-
{{% notes "info" %}}
416+
{{% notes type="info" %}}
410417
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.
411418
{{% /notes %}}
412419

413420
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.
414421

415-
{{% notes "info" %}}
422+
{{% notes type="info" %}}
416423
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.
417424

418425
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

Comments
 (0)