-
Notifications
You must be signed in to change notification settings - Fork 216
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 integration datasource #363
Conversation
@stmcallister please can I get a review on this? I am not sure exactly what the process is but more than happy add any clarification if required! |
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 great! Thanks for adding the documentation too 🎉
Test results:
TF_ACC=1 go test -run "TestAccDataSourcePagerDutyIntegration_Basic" ./pagerduty -v -timeout 120m
=== RUN TestAccDataSourcePagerDutyIntegration_Basic
--- PASS: TestAccDataSourcePagerDutyIntegration_Basic (8.28s)
PASS
ok github.com/terraform-providers/terraform-provider-pagerduty/pagerduty 9.008s
|
||
return nil | ||
} | ||
|
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.
When I first saw the setupResources
function I thought, "wow! what a super clean way to do this!" But after running the tests a few times I discovered why we don't do it this way through out the rest of the provider. When you create the objects directly through the client then the Terraform test suite doesn't manage them. So, when the tests are done all these created objects still exist on the PagerDuty account. When you define these objects in the HCL below then Terraform Testing will manage them correctly (ie, create the objects and then delete them when the test is complete.
Please move the creation of these dependent objects to the HCL below. (Good example is in the data_source_pagerduty_service_test). Otherwise, the PR looks great. Thanks!
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.
Thanks for the feedback! I have tried to implement your suggestion.
I ended up doing a test within a test so that resources created in the first plan can be reference by the second plan.
I am new to terraform testing so please feel free to suggest alternatives!
Thanks
Pete
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.
It is a different approach than the other tests, but from what I can tell it seems to do the job. Thanks for adding this feature to the provider!! 👍 🎉
This PR adds support for
data.pagerduty_service_integration
so that integration keys can be fetched from PagerDuty when configuring alerts from third party systems in TerraformExample usage: