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

Add default project to organization default settings #1634

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ctrombley
Copy link
Contributor

@ctrombley ctrombley commented Mar 5, 2025

Description

In atlas, we can now update the default project hence we need to add default project id to the organization default settings.

Note:

  • I have added default project to the importer as well, is this a needed change?
  • Cleaning up resources for a default project is a little tricky because default project cannot be deleted so, while testing I needed to set the default project to be the original default project to be able to delete the resource.

Remember to:

External links

Include any links here that might be helpful for people reviewing your PR. If there are none, feel free to delete this section.

Output from Documentation Preview

Screenshot 2025-02-11 at 12 21 20 PM Screenshot 2025-02-24 at 1 09 25 PM

Output from acceptance tests

Please run applicable acceptance tests locally and include the output here. See testing.md to learn how to run acceptance tests.

Screenshot 2025-03-04 at 5 06 01 PM

@ctrombley ctrombley requested a review from netramali March 5, 2025 01:03
@ctrombley ctrombley self-assigned this Mar 5, 2025
@ctrombley ctrombley requested a review from a team as a code owner March 5, 2025 01:03
@ctrombley ctrombley force-pushed the ctrombley/TF-14884 branch from f21b615 to 46ed87a Compare March 5, 2025 01:05
@ctrombley ctrombley force-pushed the ctrombley/TF-14884 branch from 90d823e to 8f4df19 Compare March 5, 2025 01:09
options.DefaultProject = jsonapi.NewNullableRelationshipWithValue(project)
} else if !stateData.DefaultProjectID.IsNull() {
// If the project ID is being removed, we need to set it to null
options.DefaultProject = jsonapi.NewNullNullableRelationship[*tfe.Project]()
Copy link
Contributor

Choose a reason for hiding this comment

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

@ctrombley After thinking about it again, if !stateData.DefaultProjectID.IsNull() and planData.DefaultProjectID.IsNull() --> basically if the user didn't provide default project id but it already exists, we shouldn't remove it.

An approach we can take is to make the default project id required field. What do you think about that?

The other option is that we only ever do this options.DefaultProject = jsonapi.NewNullNullableRelationship[*tfe.Project]() when the plan has an explicit null set for the default project id

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.

2 participants