Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing git_repository in a project resource forces recreation #105

Closed
arbourd opened this issue Feb 3, 2023 · 3 comments · Fixed by #171
Closed

Changing git_repository in a project resource forces recreation #105

arbourd opened this issue Feb 3, 2023 · 3 comments · Fixed by #171

Comments

@arbourd
Copy link

arbourd commented Feb 3, 2023

If you create a project:

resource "vercel_project" "example" {
  name      = "example"
  framework = "nextjs"
}

And change it to (assuming you actually have the GitHub app setup in the account)

resource "vercel_project" "example" {
  name      = "example"
  framework = "nextjs"

  git_repository = {
    type              = "github"
    repo              = "vercel/example"
    production_branch = "main"
  }
}

The provider wants to do a delete/create action, rather than an update.

Is this intended? Manually adding the GitHub app to the project and then running the terraform plan again showed that the API was able to update the project without recreation.

@dglsparsons
Copy link
Collaborator

dglsparsons commented Feb 6, 2023

Hey, thanks for raising this. It is the intended behaviour at the moment - I haven't added support for linking/unlinking a git_repository without recreating the project.

We have the right APIs for linking/unlinking though, so it should be possible to make the terraform provider not delete + recreate the project.

@blurrah
Copy link

blurrah commented Feb 28, 2023

I'm wondering what those API's are. Looking at the Vercel REST API there is no option to patch the gitRepository in the documentation.
Would love to see this change happen soon and can help out with it if there's more information around it. This makes migrating git repositories quite painful as we need to do manual terraform imports to update the git repository in the state file. Failure to do so removes the complete project including all of the accumulated stats (like analytics, build history etc)

@dglsparsons dglsparsons changed the title Admin GitHub app to existing project forces recreate Changing git_repository in a project resource forces recreation May 23, 2023
dglsparsons added a commit that referenced this issue Oct 13, 2023
At the moment, this should force recreation of the project, as we don't
support updating or removing the linked repository.

See issue #105 for info on this.

However, there is a bug insofar as we don't explicitly flag this as
requiring the project to be replaced. This creates an inconsistent plan.
dglsparsons added a commit that referenced this issue Oct 13, 2023
At the moment, this should force recreation of the project, as we don't
support updating or removing the linked repository.

See issue #105 for info on this.

However, there is a bug insofar as we don't explicitly flag this as
requiring the project to be replaced. This creates an inconsistent plan.
dglsparsons added a commit that referenced this issue Oct 16, 2023
At the moment, this should force recreation of the project, as we don't
support updating or removing the linked repository.

See issue #105 for info on this.

However, there is a bug insofar as we don't explicitly flag this as
requiring the project to be replaced. This creates an inconsistent plan.
dglsparsons added a commit that referenced this issue Oct 16, 2023
At the moment, this should force recreation of the project, as we don't
support updating or removing the linked repository.

See issue #105 for info on this.

However, there is a bug insofar as we don't explicitly flag this as
requiring the project to be replaced. This creates an inconsistent plan.
dglsparsons added a commit that referenced this issue Apr 22, 2024
Linking and Unlinking is now supported.

Closes #105
dglsparsons added a commit that referenced this issue Apr 22, 2024
Linking and Unlinking is now supported.

Closes #105
@dglsparsons
Copy link
Collaborator

Hi @arbourd, @blurrah. This has been fixed in v1.8.0 of the Terraform Provider.

Please give it a go and let me know if you encounter any issues 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants