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

Datasource datadog user #1124

Merged
merged 9 commits into from
Aug 9, 2021
Merged

Conversation

tleveque69
Copy link
Contributor

Introducing a datasource to retrieve datadog user using their email

@tleveque69 tleveque69 requested review from a team as code owners June 24, 2021 15:06
Copy link
Contributor

@zippolyte zippolyte left a comment

Choose a reason for hiding this comment

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

You'll also need to rebase on top of master. There have been changes in the go client version, and the API for making requests changed a bit.
The terraform plugin SDK v2 is also used, and the signature of the read function is a little different, it return diagnostics, and takes a context as first argument too

datadog/data_source_datadog_user.go Outdated Show resolved Hide resolved
datadog/data_source_datadog_user.go Outdated Show resolved Hide resolved
datadog/data_source_datadog_user.go Outdated Show resolved Hide resolved
datadog/internal/utils/utils.go Outdated Show resolved Hide resolved
datadog/data_source_datadog_user.go Outdated Show resolved Hide resolved
@tleveque69 tleveque69 force-pushed the datasource-datadog-user branch from cdf8424 to f1a27f0 Compare August 5, 2021 06:55
@tleveque69
Copy link
Contributor Author

I haven't been able to record the tests because of the following error eventhough i did what was mention (multiple times).
I used a trial version of DD on which i am admin

The keys you've set potentially belong to a production environment. Tests do all sorts of create/update/delete calls to the organisation, so only run them against a sandbox environment. If you know what you are doing, set the DD_TEST_ORG environment variable to the public ID of your organization. See https://docs.datadoghq.com/api/latest/organizations/#list-your-managed-organizations to get it.

Copy link
Contributor

@zippolyte zippolyte left a comment

Choose a reason for hiding this comment

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

Left some more comments.
If you're having issues with recording, I can run it and push to your branch when you've addressed the comments

datadog/data_source_datadog_user.go Outdated Show resolved Hide resolved
datadog/data_source_datadog_user.go Outdated Show resolved Hide resolved
datadog/data_source_datadog_user.go Outdated Show resolved Hide resolved
datadog/data_source_datadog_user.go Outdated Show resolved Hide resolved
datadog/data_source_datadog_user.go Outdated Show resolved Hide resolved
datadog/data_source_datadog_user.go Outdated Show resolved Hide resolved
datadog/data_source_datadog_user.go Outdated Show resolved Hide resolved
datadog/tests/data_source_datadog_user_test.go Outdated Show resolved Hide resolved
datadog/tests/data_source_datadog_user_test.go Outdated Show resolved Hide resolved
return fmt.Sprintf(`
data "datadog_user" "test" {
filter = "%s"
}`, uniq)
Copy link
Contributor

Choose a reason for hiding this comment

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

you will need to add the config for the resource here, and add a depends_on in the datasource piece when you switch to a unique username

@tleveque69 tleveque69 force-pushed the datasource-datadog-user branch from de02f5f to f4ea67e Compare August 6, 2021 13:25
@tleveque69 tleveque69 force-pushed the datasource-datadog-user branch from 335930e to 3b3542b Compare August 6, 2021 13:34
@tleveque69
Copy link
Contributor Author

I'm sorry i left so much unused code in this PR thank you so much for you review 🙏 .

I tried to correct the test using your advices however can't really test them because of the previous error if u have a workaround or can record them i'll be glad 👍

@zippolyte
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@zippolyte zippolyte merged commit 57bb1d9 into DataDog:master Aug 9, 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.

2 participants