-
Notifications
You must be signed in to change notification settings - Fork 15
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
Feat: add env0_projects (plural) data resource #787
Conversation
Computed: true, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"name": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decided to add name and id.
If anything else is required (or removed) let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to provide also those
isArchived?: boolean;
hierarchy: string;
parentProjectId?: string;
The last two are for creating custom logic around sub-projects.
For the first one (isArchived
) we may want to filter by it by default. Can we?
and if possible add a parameter to include_archived_projects
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that we don't have the ability to filter via the API.
So the filter of include_archived_projects
should be locally in the provider.
WDYS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the API:
https://docs.env0.com/reference/projects-find-by-organization-id
Will it return archived projects?
What should be the default of include_archived_projects true or false?
I can return the 3 additional values if needed. Just want to be sure there's a use-case for that. If you believe there is. happy to do so. Please confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it return archived projects?
Yes
What should be the default of include_archived_projects true or false?
false
. Meaning we should filter them locally by default.
Add them to the state only if include_archived_projects
is true
This makes more sense because I don't see users use the archived
ones so much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW
hierarchy
looks like uuid|uuid|....
.
and parentProjectId
is just uuid.
parentProjectId
returned only on sub-projects.
hierarchy
by default equals its own id
(if not part of a tree).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@razbensimon - I have added the additional code you requested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Edit:
please see
project1 := client.Project{ | ||
Id: "id0", | ||
Name: "my-project-1", | ||
ParentProjectId: "p1", | ||
Hierarchy: "adsas|fdsfsd", | ||
} | ||
|
||
project2 := client.Project{ | ||
Id: "id1", | ||
Name: "my-project-2", | ||
} | ||
|
||
project3 := client.Project{ | ||
Id: "id1", | ||
Name: "my-project-2", | ||
IsArchived: true, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just to make it more synced with real data
project1 := client.Project{ | |
Id: "id0", | |
Name: "my-project-1", | |
ParentProjectId: "p1", | |
Hierarchy: "adsas|fdsfsd", | |
} | |
project2 := client.Project{ | |
Id: "id1", | |
Name: "my-project-2", | |
} | |
project3 := client.Project{ | |
Id: "id1", | |
Name: "my-project-2", | |
IsArchived: true, | |
} | |
project1 := client.Project{ | |
Id: "id1", | |
Name: "my-project-1", | |
Hierarchy: "id1", | |
IsArchived: false, | |
} | |
project2 := client.Project{ | |
Id: "id2", | |
Name: "my-project-2", | |
Hierarchy: "id1|id2", | |
IsArchived: false, | |
ParentProjectId: "id1", | |
} | |
project3 := client.Project{ | |
Id: "id3", | |
Name: "my-project-3", | |
Hierarchy: "id3", | |
IsArchived: true, | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @TomerHeber
Issue & Steps to Reproduce / Feature Request
resolves #786
Solution