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

add data source user #648

Merged
merged 4 commits into from
May 13, 2021
Merged

add data source user #648

merged 4 commits into from
May 13, 2021

Conversation

psg2
Copy link
Contributor

@psg2 psg2 commented May 13, 2021

Issue: #647

Copy link
Contributor

@nfx nfx left a comment

Choose a reason for hiding this comment

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

Small fixes and we're ready

func DataSourceUser() *schema.Resource {
type entity struct {
UserName string `json:"user_name"`
Home string `json:"home" tf:"computed"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Please run make fmt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Alphanumeric string `json:"alphanumeric" tf:"computed"`
}

s := common.StructToSchema(entity{}, func(
Copy link
Contributor

Choose a reason for hiding this comment

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

By the way, if you feel that schema map is shorter - you can do it as well :) just a side thought

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

s := common.StructToSchema(entity{}, func(
s map[string]*schema.Schema) map[string]*schema.Schema {
// nolint once SDKv2 has Diagnostics-returning validators, change
s["user_name"].ValidateFunc = validation.StringIsNotEmpty
Copy link
Contributor

Choose a reason for hiding this comment

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

We've migrated to other linter, so comment above might not work. You need ValidateDiagFunc and wrap this sdkv1 one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess it's done now that I've changed to schema map.

Copy link
Contributor

@nfx nfx left a comment

Choose a reason for hiding this comment

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

Thank you

@nfx nfx merged commit 45e9a92 into databricks:master May 13, 2021
@nfx nfx linked an issue May 13, 2021 that may be closed by this pull request
@nfx nfx assigned psg2 May 13, 2021
@nfx nfx added this to the v0.3.5 milestone May 13, 2021
@nfx nfx mentioned this pull request Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Support databricks_user data source
2 participants