Skip to content

[PF]: Adding a new field with a default value causes replace plan #2948

@corymhall

Description

@corymhall

What happened?

There is a Gitlab upgrade test that is failing due to this change upstream which added a single new field with a default value.

This issue also occurs in Terraform if you run with -refresh=false. The issue goes away if you run Pulumi with --refresh

Terraform scenario

  1. Do an initial deployment using version = 17.8.0 (before the new field)
terraform {
  required_providers {
    gitlab = {
      source  = "gitlabhq/gitlab"
      version = "17.8.0"
    }
  }
  required_version = ">= 1.2.0"
}

resource "gitlab_project" "example" {
  visibility_level = "private"
  name             = "test-example"
}

resource "gitlab_project_hook" "example" {
  project                    = gitlab_project.example.id
  name                       = "webhook-receiver"
  confidential_issues_events = true
  issues_events              = true
  job_events                 = true
  merge_requests_events      = true
  note_events                = true
  pipeline_events            = true
  push_events                = true
  tag_push_events            = true
  url              = "https://webhook.receiver.endpoint/hooks/gitlab"
  wiki_page_events = true
}
  1. Upgrade to version= 17.9.0, leave everything else the same
terraform {
  required_providers {
    gitlab = {
      source  = "gitlabhq/gitlab"
      version = "17.9.0"
    }
  }
  required_version = ">= 1.2.0"
}

resource "gitlab_project" "example" {
  visibility_level = "private"
  name             = "test-example"
}

resource "gitlab_project_hook" "example" {
  project                    = gitlab_project.example.id
  name                       = "webhook-receiver"
  confidential_issues_events = true
  issues_events              = true
  job_events                 = true
  merge_requests_events      = true
  note_events                = true
  pipeline_events            = true
  push_events                = true
  tag_push_events            = true
  url              = "https://webhook.receiver.endpoint/hooks/gitlab"
  wiki_page_events = true
}

Pulumi Scenario

  1. npm install @pulumi/[email protected]
  2. pulumi up with this program
const project = new gitlab.Project('project', {
  visibilityLevel: 'private',
});

new gitlab.ProjectHook('hook', {
  project: project.id,
  name: 'webhook-receiver',
  confidentialIssuesEvents: true,
  issuesEvents: true,
  jobEvents: true,
  mergeRequestsEvents: true,
  noteEvents: true,
  pipelineEvents: true,
  pushEvents: true,
  tagPushEvents: true,
  url: 'https://webhook.receiver.endpoint/hooks/gitlab',
  wikiPageEvents: true,
});
  1. npm install @pulumi/[email protected]
  2. Run pulumi preview to see the replace plan
  3. Run pulumi preview --refresh to see the replace plan go away.

Example

See above example

Output of pulumi about

CLI          
Version      3.153.1
Go Version   go1.23.6
Go Compiler  gc

Plugins
KIND      NAME                VERSION
resource  archive             0.3.1
resource  gitlab              8.0.0-alpha.0+dev
language  nodejs              3.153.1

Host     
OS       darwin
Version  15.3.1
Arch     arm64

This project is written in nodejs: executable='/Users/chall/.nvm/versions/node/v20.11.1/bin/node' version='v20.11.1'

Current Stack: chall-pulumi-corp/pulumi-typescript-app/dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/chall-pulumi-corp
User           chall-pulumi-corp
Organizations  chall-pulumi-corp, pulumi
Token type     personal

Dependencies:
NAME                               VERSION
@pulumi/gitlab                     8.8.0
@pulumi/pulumi                     3.154.0

@types/node                        22.13.5
typescript                         5.8.2

Pulumi locates its logs in /var/folders/3b/6mr1jkqx7r797ff75k27jfjc0000gn/T/ by default

Additional context

I've created a repro #2944. I've updated the code to run terraform with --refresh=true to show the difference.

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

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions