1. Docs
  2. Concepts
  3. Resource options
  4. ignoreChanges

Resource option: ignoreChanges

    The ignoreChanges resource option specifies a list of properties that Pulumi will ignore when it updates existing resources. Pulumi ignores a property by using the old value from the state instead of the value provided by the Pulumi program when determining whether an update or replace is needed. Ignored properties will still be used from the program when there is no previous value in the state, most importantly when creating the resource.

    For instance, in this example, the resource’s prop property “new-value” will be set when Pulumi initially creates the resource, but from then on, any updates will ignore it:

    let res = new MyResource("res",
        { prop: "new-value" }, { ignoreChanges: ["prop"] });
    
    let res = new MyResource("res",
        { prop: "new-value" }, { ignoreChanges: ["prop"] });
    
    res = MyResource("res",
        prop="new-value",
        opts=ResourceOptions(ignore_changes=["prop"]))
    
    res, _ := NewMyResource(ctx, "res",
        &MyResourceArgs{Prop: "new-value"},
        pulumi.IgnoreChanges([]string{"prop"}))
    
    var res = new MyResource("res",
        new MyResourceArgs { Prop = "new-value" },
        new CustomResourceOptions { IgnoreChanges = { "prop" } });
    
    var res = new MyResource("res",
        MyResourceArgs.builder()
            .prop("new-value")
            .build(),
        CustomResourceOptions.builder()
            .ignoreChanges("prop")
            .build());
    
    resources:
      res:
        type: MyResource
        properties:
          prop: new-value
        options:
          ignoreChanges:
            - prop
    

    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.

    The ignoreChanges option only applies to resource inputs, not outputs.
    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.

    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. Here are examples of legal paths that can be passed to specify nested properties of objects and arrays, as well as to escape object keys that contain special characters:

    The property names passed to ignoreChanges should always be the “camelCase” version of the property name, as used in the core Pulumi resource model. For example, a property named nested_resource would turn into nestedResource.
    The property names passed to ignoreChanges should always be the “camelCase” version of the property name, as used in the core Pulumi resource model. For example, a property named NestedResource would turn into nestedResource.
    The property names passed to ignoreChanges should always be the “camelCase” version of the property name, as used in the core Pulumi resource model. For example, a property named NestedResource would turn into nestedResource.
    • root
    • root.nested
    • root["nested"]
    • root.double.nest
    • root["double"].nest
    • root["double"]["nest"]
    • root.array[0]
    • root.array[100]
    • root.array[0].nested
    • root.array[0][1].nested
    • root.nested.array[0].double[1]
    • root["key with \"escaped\" quotes"]
    • root["key with a ."]
    • ["root key with \"escaped\" quotes"].nested
    • ["root key with a ."][100]
    • root.array[*].field
    • root.array["*"].field
      Introducing Pulumi Copilot - Intelligent Cloud Management