pulumi-datadog icon indicating copy to clipboard operation
pulumi-datadog copied to clipboard

SyntheticsTest resource will always show diff of assertions with --refresh

Open williamsbdev opened this issue 3 years ago • 2 comments

I'm going to preface this with the fact that I'm not sure if this is an issue in Pulumi or in Terraform and I'd appreciate some help in determining where I should seek help.

Every time we run a pulumi preview --refresh --stack name --diff, we will see that the assertions are being added. It feels like the --refresh option is not properly querying the API and representing the assertions when populating the state and doing the diff.

Steps to reproduce

new datadog.SyntheticsTest(
  'some-name',
  {
    assertions: [
      {
        operator: 'lessThan',
        type: 'responseTime',
        target: responseTime,
      },
      {
        operator: 'is',
        type: 'statusCode',
        target: 200,
      }
    ],
    locations: ['aws:us-west-1'],
    message: pagerdutyMessage,
    'some-name',
    optionsList: {
      tickEvery: 300,
      minFailureDuration: 300,
      minLocationFailed: 1,
      followRedirects: true,
    },
    request: {
      method: 'GET',
      url: 'http://example.com',
      timeout: 30,
    },
    tags: defaultTags,
    type: 'api',
    subtype: 'http',
    status: 'live',
  }
)
  1. Given the resource above
  2. It has been deployed and no local changes have been made
  3. Run the command pulumi preview --refresh --stack name --diff
  4. You should see an update like the following:
~ assertions: [
    + [0]: {
        + operator  : "lessThan"
        + target    : 2000
        + type      : "responseTime"
    }
    + [1]: {
        + operator  : "is"
        + target    : 200
        + type      : "statusCode"
    }
]

Expected: There should be no updates made to the SyntheticsTest resource. Actual: The assertions array always shows an update from an empty array to the array with our assertions.

williamsbdev avatar Jul 14 '21 02:07 williamsbdev