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

Feat: support Environment Output configuration type - new resource #886

Merged
merged 17 commits into from
Jul 31, 2024

Conversation

TomerHeber
Copy link
Collaborator

@TomerHeber TomerHeber commented Jun 30, 2024

Issue & Steps to Reproduce / Feature Request

Part of #845
(In future PR need to handle the "environment" scheme/inline use case + subenvironment).

Solution

  1. Added a new resource.
  2. Implemented crud and import operations.
  3. Added acceptance tests.
  4. Added examples.

Reused existing API and some of the existing configuration variable functionality.

@@ -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) {
Copy link
Collaborator Author

@TomerHeber TomerHeber Jul 5, 2024

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...

@TomerHeber TomerHeber requested a review from yaronya July 8, 2024 00:21
return nil, errors.New("'is_read_only' can only be set to 'true' for the 'PROJECT' scope")
}

environment, err := apiClient.Environment(params.OutputEnvironmentId)
Copy link
Collaborator Author

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".

@away168
Copy link

away168 commented Jul 9, 2024

@TomerHeber can you add env0_project_policy for Environment Output Option too, or should I create a separate Issue?

CleanShot 2024-07-09 at 07 30 01

@TomerHeber
Copy link
Collaborator Author

@TomerHeber can you add env0_project_policy for Environment Output Option too, or should I create a separate Issue?

CleanShot 2024-07-09 at 07 30 01

@away168 - let's have a seperate ticket. Don't want to mix these two.
A small ticket with the field name should suffice... (you can just share the image - should be enough for me).

@yaronya yaronya requested a review from tomer-landesman July 14, 2024 15:27

type EnvironmentOutputConfigurationVariableValue struct {
OutputName string `json:"outputName"`
ProjectId string `json:"projectId"`
Copy link
Contributor

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

Copy link
Collaborator Author

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,
Copy link
Contributor

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 == "" {
Copy link
Contributor

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": {
Copy link
Contributor

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

Copy link
Collaborator Author

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).

Copy link
Contributor

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

@yaronya yaronya requested a review from tomer-landesman July 29, 2024 13:39
@yaronya
Copy link
Contributor

yaronya commented Jul 29, 2024

@TomerHeber is it ready for final review?

@TomerHeber
Copy link
Collaborator Author

@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

@TomerHeber
Copy link
Collaborator Author

@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.
Yes this can be reviewed. I just need to add a couple of harness tests. But code can be reviewed and approved without it.

@yaronya
Copy link
Contributor

yaronya commented Jul 29, 2024

@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.

Yes this can be reviewed. I just need to add a couple of harness tests. But code can be reviewed and approved without it.

@tomer-landesman will review tomorrow


updatedValue := EnvironmentOutputConfigurationVariableValue{
OutputName: "output_name2",
ProjectId: "output_project_id2",
Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Got it!

Copy link
Collaborator Author

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.

Copy link
Contributor

@tomer-landesman tomer-landesman left a 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 👏🏼

@github-actions github-actions bot added ready to merge PR approved - can be merged once the PR owner is ready and removed pending final review labels Jul 31, 2024
@TomerHeber TomerHeber merged commit de8a7dd into main Jul 31, 2024
4 checks passed
@TomerHeber TomerHeber deleted the feat-environment-output-#845_1 branch July 31, 2024 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants