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

Updating Project Resource to have "is_default" configurable #860

Merged
merged 1 commit into from
Aug 15, 2022

Conversation

danaelhe
Copy link
Member

@danaelhe danaelhe commented Aug 9, 2022

(murked my previous PR #849 bc got into a hairy merge issue)

Per #848.

@yordis had a great suggestion for allowing to provision digitalocean_project resource as "Default Project". Making "is_default" configurable. This means:

  • You can initialize a new project to be the default.
  • You can’t edit a project to no longer be default (400 (request "acb5906e-bf48-49e3") you must always have a default project) even if you have other projects, it won’t automatically assign another project to be default
  • You can’t delete a project that is the default (^^)
  • You must first assign another project to be default first before you can delete the old default project

@danaelhe danaelhe temporarily deployed to Acceptance Tests August 9, 2022 15:37 Inactive
@danaelhe
Copy link
Member Author

danaelhe commented Aug 9, 2022

seems like the acceptance test for this pr passed (TestAccDigitalOceanProject_CreateWithIsDefault) but a few others did not?

@scotchneat
Copy link
Contributor

@danaelhe We're having issues with the acceptance tests and need to redesign the approach. So those are non-blocking right now.

Copy link
Contributor

@scotchneat scotchneat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 👍🏽

@andrewsomething
Copy link
Member

andrewsomething commented Aug 15, 2022

For future reference, this is how to edit is_default on a project without hitting an error. Starting from a config like:

resource "digitalocean_project" "default" {
  name = "test-default"
  is_default = true
}

resource "digitalocean_project" "not-default" {
  name = "test-not-default"
}

You can switch the default by adding an explicit dependency to ensure the second project is set to default before updating the first. E.g.

resource "digitalocean_project" "default" {
  name = "test-default"
  depends_on = [
    digitalocean_project.not-default
  ]
}

resource "digitalocean_project" "not-default" {
  name = "test-not-default"
  is_default = true
}

Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM!

@danaelhe danaelhe merged commit f0af95c into main Aug 15, 2022
@danaelhe danaelhe deleted the project_isdefault branch August 15, 2022 16:46
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 this pull request may close these issues.

None yet

3 participants