-
Notifications
You must be signed in to change notification settings - Fork 14
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: support Environment Output configuration type - new resource #886
Conversation
@@ -244,7 +244,7 @@ func resourceConfigurationVariableUpdate(ctx context.Context, d *schema.Resource | |||
|
|||
func resourceConfigurationVariableDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | |||
// don't delete if soft delete is set | |||
if softDelete := d.Get("soft_delete"); softDelete.(bool) { | |||
if softDelete := d.Get("soft_delete"); softDelete != nil && softDelete.(bool) { |
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.
in case soft_delete isn't in the schema...
return nil, errors.New("'is_read_only' can only be set to 'true' for the 'PROJECT' scope") | ||
} | ||
|
||
environment, err := apiClient.Environment(params.OutputEnvironmentId) |
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.
getting the environment details in order to get the environment project id (this is passed in the "Value".
@TomerHeber can you add |
@away168 - let's have a seperate ticket. Don't want to mix these two. |
|
||
type EnvironmentOutputConfigurationVariableValue struct { | ||
OutputName string `json:"outputName"` | ||
ProjectId string `json:"projectId"` |
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.
projectId can be removed from here :) we refactored that part and removed it from this schema
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.
great!!!
value := EnvironmentOutputConfigurationVariableValue{ | ||
OutputName: params.OutputName, | ||
EnvironmentId: params.OutputEnvironmentId, | ||
ProjectId: params.outputEnvironmentProjectId, |
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.
projectId can be removed
return nil, fmt.Errorf("after unmarshal 'outputName' is empty") | ||
} | ||
|
||
if value.ProjectId == "" { |
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.
can be removed
Description: "the name of the variable", | ||
Required: true, | ||
}, | ||
"output_environment_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.
cc @yaronya , I'm not sure about that property, and about this resource in general
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.
@tomer-landesman - should I pause work on this for now?
(was planning to make necessary changes today).
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.
We discussed, the property should remain
@TomerHeber is it ready for final review? |
@yaronya it's blocked. I was asked to wait with this. It's almost ready. But I stopped working on it |
@yaronya - sorry just read your other comment. |
@tomer-landesman will review tomorrow |
|
||
updatedValue := EnvironmentOutputConfigurationVariableValue{ | ||
OutputName: "output_name2", | ||
ProjectId: "output_project_id2", |
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.
please remove the project ids from all places including 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.
Got it!
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.
@tomer-landesman - this is now done.
Harness tests were updated as well.
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 good to me 👏🏼
Issue & Steps to Reproduce / Feature Request
Part of #845
(In future PR need to handle the "environment" scheme/inline use case + subenvironment).
Solution
Reused existing API and some of the existing configuration variable functionality.