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 ServiceNow extension resource #348

Merged
merged 1 commit into from
Jul 27, 2021

Conversation

drastawi
Copy link
Contributor

Adding a dedicated resource for ServiceNow.

This resource will allow the end-user to avoid perma-diff and mark the password as a sensitive value while providing a simpler dedicated interface (e.g. endpoint URL can be very easily mistaken for the ServiceNow target).

@drastawi drastawi force-pushed the service-now-extension branch from 749f882 to deab1b6 Compare June 23, 2021 07:46
Copy link
Contributor

@stmcallister stmcallister left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this! I like the direction of this PR. I think it's probably cleaner for extensions like ServiceNow to have their own resource. However, there are several errors in the tests. I've pointed out a few that I see. If you could fix those I'd be happy to merge.

resource.TestCheckResourceAttr(
"pagerduty_extension_servicenow.foo", "endpoint_url", url),
resource.TestCheckResourceAttr(
"pagerduty_extension_servicenow.foo", "config", "{\"notify_types\":{\"acknowledge\":false,\"assignments\":false,\"resolve\":false},\"restrict\":\"any\"}"),
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no longer a config attribute in this resource. Please break out these checks to match the current schema of the resource.

resource.TestCheckResourceAttr(
"pagerduty_extension_servicenow.foo", "endpoint_url", url_updated),
resource.TestCheckResourceAttr(
"pagerduty_extension_servicenow.foo", "config", "{\"notify_types\":{\"acknowledge\":true,\"assignments\":true,\"resolve\":true},\"restrict\":\"pd-users\"}"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. Please break out these checks to match the current schema

resource "pagerduty_extension_servicenow" "foo"{
name = "%s"
endpoint_url = "%s"
extension_schema = data.pagerduty_extension_servicenow_schema.foo.id
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was supposed to be referencing data.pagerduty_extension_schema.foo.id

snow_user = "meeps"
snow_password = "zorz"
sync_options = "manual_sync"
target = foo.servicenow.com/webhook_foo
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the target value is supposed to be a string.

resource "pagerduty_user" "example" {
name = "Howard James"
email = "howard.james@example.domain"
teams = [pagerduty_team.example.id]
Copy link
Contributor

Choose a reason for hiding this comment

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

The teams field is actually deprecated in the pagerduty_user resource. For these docs you can just remove the field.

name = "My Web App"
auto_resolve_timeout = 14400
acknowledgement_timeout = 600
escalation_policy = pagerduty_escalation_policy.example.id
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're making other edits to this doc. This should probably match the definition above for pagerduty_escalation_policy.foo.id.

@drastawi drastawi force-pushed the service-now-extension branch from deab1b6 to 151b186 Compare July 19, 2021 02:56
@drastawi
Copy link
Contributor Author

Hey @stmcallister, I ran all the tests now against a live environment. Should all work. Also fixed the corresponding typos on the non-servicenow extension side. Let me know if it looks better now.

@drastawi drastawi requested a review from stmcallister July 27, 2021 17:03
Copy link
Contributor

@stmcallister stmcallister 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! Also, I think Servicenow should be ServiceNow throughout the code. But, i can make that change before merging. Appreciate the contribution!! 🎉

@stmcallister stmcallister merged commit 19138fe into PagerDuty:master Jul 27, 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