Skip to content

ignoreChanges incorrect for new list elements #3186

@corymhall

Description

@corymhall

What happened?

When ignoreChanges includes a list index that is being added (i.e. doesn't exist in state), the bridge incorrectly sets the value to null.

Example

For example, given this program:

 new aws.lb.Listener(
    'http-listener',
    {
      ...,     
      defaultActions: [
        {
          type: 'forward',
          forward: {
            targetGroups: [
              {
                arn: targetGroup1.arn,
                weight: 100,
              },
              {
                arn: targetGroup2.arn,
                weight: 0,
              },
              // !! THIS IS NEW !!
              {
                arn: targetGroup2.arn,
                weight: 0,
              },
            ],
          },
        },
      ],
    },
    {
      ignoreChanges: [
        'defaultActions[0].forward.targetGroups[0].weight',
        'defaultActions[0].forward.targetGroups[1].weight',
        'defaultActions[0].forward.targetGroups[2].weight', // !! This is a new index !!
      ],
    },
  );

The update will look like this:

{
  "response": {
    "properties": {
      "defaultActions": [
        {
          "forward": {
            "targetGroups": [
              {
                "arn": "arn1",
                "weight": 100
              },
              {
                "arn": "arn2",
                "weight": 0
              },
              {
                "arn": "arn3",
                "weight": null // !! not correct !!
              }
            ]
          }
        }
      ]
    }
  }
}

Output of pulumi about

NA

Additional context

I have added tests that show this behavior in this PR #3175

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSome behavior is incorrect or out of spec

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions