terraform-provider-pagerduty: Unexpected diffs on pagerduty_extension after 1.2.0 release
Terraform Version
Terraform v0.11.7
+ provider.aws v1.32.0
+ provider.dns v2.0.0
+ provider.null v1.0.0
+ provider.pagerduty v1.2.0
+ provider.statuscake v0.2.0
Same issue occurs after upgrading to Terraform v0.11.8.
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
resource "pagerduty_extension" "slack" {
name = "Slack"
endpoint_url = ""
extension_schema = "${data.pagerduty_extension_schema.slack.id}"
extension_objects = ["${pagerduty_service.main.id}"]
}
data "pagerduty_extension_schema" "slack" {
name = "Slack"
}
resource "pagerduty_service" "main" {
name = "Test"
...
}
Expected Behavior
No diff should have occurred with our various Slack extensions, as nothing has changed in our configuration or in our setup within PagerDuty.
There has been a pagerduty provider update which made changes to pagerduty_extension, but it is a minor release and so is expected to be backwards-compatible.
Actual Behavior
After upgrading to v1.2.0, we started receiving these diffs, which are attempting to remove our existing Slack extension configurations:
~ module.pagerduty.module.high_priority.pagerduty_extension.slack
config: "{\"bot\":{\"bot_user_id\":\"UXXXXXXXX\"},\"incoming_webhook\":{\"channel\":\"#ops-alerts\",\"channel_id\":\"CXXXXXXXX\",\"configuration_url\":\"https://astute.slack.com/services/BXXXXXXXX\",\"url\":\"https://hooks.slack.com/services/TXXXXXXXX/BXXXXXXXX/xxxxxxxxxxxxxxxx\"},\"notify_types\":{\"acknowledge\":true,\"assignments\":true,\"resolve\":true},\"ok\":true,\"restrict\":\"pd-users\",\"scope\":\"identify,bot,incoming-webhook,channels:read,groups:read,im:read,users:read,users:read.email,chat:write:bot,groups:write\",\"team_id\":\"TXXXXXXXX\",\"team_name\":\"Test\",\"user_id\":\"UXXXXXXXX\"}" => ""
~ module.pagerduty.module.low_priority.pagerduty_extension.slack
config: "{\"bot\":{\"bot_user_id\":\"UXXXXXXXX\"},\"incoming_webhook\":{\"channel\":\"#ops-alerts\",\"channel_id\":\"CXXXXXXXX\",\"configuration_url\":\"https://astute.slack.com/services/BXXXXXXXX\",\"url\":\"https://hooks.slack.com/services/TXXXXXXXX/BXXXXXXXX/xxxxxxxxxxxxxxxx\"},\"notify_types\":{\"acknowledge\":true,\"assignments\":true,\"resolve\":true},\"ok\":true,\"restrict\":\"pd-users\",\"scope\":\"identify,bot,incoming-webhook,channels:read,groups:read,im:read,users:read,users:read.email,chat:write:bot,groups:write\",\"team_id\":\"TXXXXXXXX\",\"team_name\":\"Test\",\"user_id\":\"UXXXXXXXX\"}" => ""
I’m in a hurry so haven’t got time to properly look into it, but I thought I will just log this for now and downgrade our version until I can come back at look at it properly.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 32 (19 by maintainers)
The community post linking here is now closed. In lieu of that, I have a question for the people who want to configure this on their own pagerduty instance.
Are you actually interested in maintaining your extension configuration with the pagerduty_extension resource, or just set the extension_objects parameter every time you add a new service?
The latter is my personal use case, I could give a hoot if I had to do a one time configuration of the extension via the pagerduty UI, as long as I can add all of my services to it via the API, because I am programmatically declaring all my Services in the same way and want the same extensions and configuration to apply to all of them.
My suspicion is that most people probably are in the same boat, so if Pagerduty offered an endpoint for just updating the
extension_objectsfield without having to repost the config, that’d solve most people’s problems.Please emoji here and if there’s enough support for this approach, I guess I’ll open a new support ticket or community topic or something to get that thru.
@pdecat @tdmalone I posted this internally at PagerDuty and will post back what I find out.
Hi @tdmalone, thank you so much for reporting this issue and sorry about this.
I’ve opened a PR (#95) that should address this by allowing the config to be computed if not present in the configuration.
Hi @tdmalone,
The
configfield can be used to reuse an existing Slack OAuth token to setup additional service extensions.Here’s how we do it:
To retrieve a token from an existing service extension:
@pdecat thx! this works!
You should see them in the terraform diff after having set up one Slack extension in the web UI. From there, you can reuse the values for other extensions.
Edit: you can also query the Pagerduty API manually.
Slack interactivity still works for us, and posts are still posted by the Pagerduty bot. Not sure why though.
Sadly, retrieving the access token from the REST API no longer works since yesterday, it is now returned as
access_token": "redacted".I’ve opened a discussion at https://community.pagerduty.com/forum/t/access-token-used-for-service-extension-no-longer-accessible-from-rest-api/1674
@tdmalone I just tested and it looks like extensions newly created via the UI no longer have their
access_tokenfield exposed, no matter the extension schemas used.It does not bother me so far because I’m always reusing the same token for all extensions, in the same slack workspace.
I would be in trouble if I needed to integrate with other slack workspaces.
Maybe someone should reach to Pagerduty support to get to the bottom of it.
Maybe there could be an API endpoint to reference OAuth access tokens by some criteria without exposing the underlying secrets.
Yep, looks like #95 hasn’t been merged yet.
@pdecat Ooh that is nice indeed. Thank you for the use case! I like the idea of using jsonencode too. I’ve been using HEREDOC syntax elsewhere to make JSON more readable 😃
@acrewdson I think that is likely related to the same issue.
To be honest, I’m not quite sure of the purpose of defining this config in Terraform. There’s probably cases I’m not aware of, but for us, when using with Slack, we generally have to set up the authorization through the PagerDuty UI anyway, as the config ends up containing the ‘link’ to the Slack team. There’s not a lot of point that I can see in us managing this through Terraform.
We’ve still got our pagerduty provider pinned to 1.1.0 due to this issue, but when #95 is merged I suspect we’ll be able to update and just not supply ‘config’, thereby maintaining the old behaviour.