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

Chore: refactor credentials and cost #407

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

TomerHeber
Copy link
Collaborator

Solution

Some more refactoring around credentials.
This is part of #394.

@@ -27,6 +27,18 @@ func TestCredentialsDataSource(t *testing.T) {
credentialsType: "AZURE_SERVICE_PRINCIPAL_FOR_DEPLOYMENT",
cloudType: "azure",
},
{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Adding these cases allows me to remove "data_cost_credentials_test.go".

@TomerHeber TomerHeber requested a review from yaronya June 2, 2022 14:43
@razbensimon razbensimon requested a review from a team June 2, 2022 17:54
Copy link
Contributor

@razbensimon razbensimon left a comment

Choose a reason for hiding this comment

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

Nice one!

"gcp": {string(client.GcpServiceAccountCredentialsType)},
"azure": {string(client.AzureServicePrincipalCredentialsType)},
"aws": {string(client.AwsAssumedRoleCredentialsType), string(client.AwsAccessKeysCredentialsType)},
"google_cost": {string(client.GoogleCostCredentialsType)},
Copy link
Contributor

Choose a reason for hiding this comment

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

we generally use the gcp term all over the system. Any good reason to change that here?
also, you are keeping the original gcp... so I prefer consistency.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's annoying... I agree...
The data source for some reason is called "env0_google_cost..."

I could add some "ifs" if preferred. (Not much better).

Copy link
Contributor

Choose a reason for hiding this comment

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

Not a biggy here...
@yaronya FYI maybe for an idea, future refactor.

return nil
}

func resourceCredentialsRead(cloudType string) schema.ReadContextFunc {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use some kind of string-mapping/enum?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah let me see what I can do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@razbensimon , I'll push and fix it in the next PR.

@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 Jun 2, 2022
@TomerHeber TomerHeber merged commit 89e928a into main Jun 2, 2022
@TomerHeber TomerHeber deleted the chore-refactor-credentials-#394 branch June 2, 2022 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore provider ready to merge PR approved - can be merged once the PR owner is ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants