Adds DeliveryResponses parsing in NotificationConfiguration #1129
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR updates DeliveryResponses field parsing of
NotificationConfiguration
. NotificationConfiguration now parsesDeliveryResponses
.The change aims to be part of automating notifi 8000 cation configuration management for workspaces. This aligns with API's NotificationConfiguration return for List, Create, Read, Update, and Verify operations.
curl
--header "Authorization: Bearer $TOKEN"
--request POST
--data @payload.json
https://app.terraform.io/api/v2/workspaces/ws-***/notification-configurations/
{"data":{"id":"nc-","type":"notification-configurations","attributes":{"enabled":true,"name":"Notify organization users about run","destination-type":"generic","triggers":["run:applying","run:completed","run:created","run:errored","run:needs_attention","run:planning"],"delivery-responses":[{"code":"200","body":"{"code":200,"description":"OK"}","headers":{"content-length":["31"],"content-type":["application/json"],"date":["Mon, 16 Jun 2025 01:42:05 GMT"]},"sent-at":"2025-06-16T01:42:06+00:00","successful":"true","url":""}],"created-at":"2025-06-16T01:42:06.447Z","updated-at":"2025-06-16T01:42:06.447Z","url":"","token":null},"relationships":{"subscribable":{"data":{"id":"ws-","type":"workspaces"}}},"links":{"self":"/api/v2/notification-configurations/nc-***"}}}
A new function is added to parse DeliveryResponse
func parseDeliveryResponses(nc *NotificationConfiguration)
.The following functions have been updated to use parseDeliveryResponses:
Testing plan
TFE_ADDRESS
,TFE_TOKEN
, andTFC_RUN_TASK_URL
TFE_ADDRESS="https://example" TFE_TOKEN="example" TFC_RUN_TASK_URL="working-URL" go test ./... -v -run TestNotificationConfigurationReadDeliveryResponses
. The new tests should pass.DeliveryResponses
is read for NotificationConfigurations.External links
Output from tests
Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.