-
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 support for variable set assignment resource #870
Conversation
there are usages of both |
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.
looks great, left some comments
Schema: map[string]*schema.Schema{ | ||
"scope": { | ||
Type: schema.TypeString, | ||
Description: "the resource(scope) type to assign to. Valid values: 'template', 'environment', 'workflow', 'organization', 'project'", |
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.
the allowed values are: organization, project, template, module, environment, deployment
https://docs.env0.com/reference/configuration-find-set-assignments-by-scope see what the assignmentScope is allowed to be.
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.
thank you. will fix.
|
||
newSchemaSetIds := []string{} | ||
|
||
// To avoid drifts keep the schema order as much as possible. |
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.
if that functionality prevents drift, can we add a test that drifts won't occur?
something like:
- set some assignments in the state
- mock that all return from api in addition to new ones
- see the order is kept as expected
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.
yes. This PR is still work in progress. I will definitely add such a test.
yeah for the printing of messages. Sure thing. |
@sagilaufer1992 - thanks! |
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
requested to update the integration test to make sure the expected outcome is achieved, not just alter the resource
resource "env0_variable_set_assignment" "assignment" { | ||
scope = "project" | ||
scope_id = env0_project.project.id | ||
set_ids = var.second_run ? [env0_variable_set.org_scope.id] : [env0_variable_set.project_scope.id] |
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.
the test seems a bit missing... can we check the outcome of that? using output or some other method, to see that the assignment doesn't exist on the org after the second run, and exists where it should after on each run?
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 tested in the acceptance tests.
The integration tests are limited in their functionality and are more of a sanity just to make sure things really work...
I don't think there's an easy way to test what you're asking with the current integration tests... /:
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.
Alright. As long as there is a test for it
Issue & Steps to Reproduce / Feature Request
Part of #829
Solution