Conversation
Add a `reminder` single-nested attribute to the opslevel_campaign resource for configuring recurring Slack, email, and Microsoft Teams reminders on a schedule. Includes schema validation (channel/frequency_unit/day enums, frequency >= 1, HH:MM time format, weekly cadence requires days_of_week), create/read/update wiring with clear-on-removal, and #-prefix normalization for the Slack channel to avoid perpetual diffs. Also exposes the reminder as a computed attribute on the opslevel_campaign and opslevel_campaigns data sources. Depends on OpsLevel/opslevel-go#623. The go.mod replace directive and submodule pointer are temporary for development and will be swapped for a released opslevel-go version before merge. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
Usage examplesWeekly Slack + email reminder resource "opslevel_campaign" "upgrade_rails" {
name = "Upgrade to Rails 7"
owner_id = data.opslevel_team.platform.id
filter_id = data.opslevel_filter.tier_1.id
start_date = "2026-07-01"
target_date = "2026-09-30"
reminder = {
channels = ["slack", "email"]
frequency = 1
frequency_unit = "week"
days_of_week = ["monday", "thursday"] # required for a weekly cadence
time_of_day = "09:30"
timezone = "America/Chicago"
message = "Friendly reminder to complete your Rails 7 upgrade checks."
# Fallback channel used when a team has no default Slack contact.
default_slack_channel = "#platform-eng"
}
}Every-2-days reminder (no reminder = {
channels = ["slack"]
frequency = 2
frequency_unit = "day" # daily/monthly cadences must omit days_of_week
time_of_day = "14:00"
timezone = "America/Chicago"
}Microsoft Teams reminder reminder = {
channels = ["microsoft_teams"]
frequency = 1
frequency_unit = "month"
time_of_day = "08:00"
timezone = "Europe/London"
default_microsoft_teams_channel = "Platform Eng"
}No reminder / clearing one Omit the Reading it backdata "opslevel_campaign" "upgrade_rails" {
identifier = opslevel_campaign.upgrade_rails.id
}
output "next_reminder" {
value = data.opslevel_campaign.upgrade_rails.reminder.next_occurrence
}
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #652 +/- ##
========================================
+ Coverage 0.22% 3.04% +2.81%
========================================
Files 85 107 +22
Lines 9651 13147 +3496
========================================
+ Hits 22 400 +378
- Misses 9626 12713 +3087
- Partials 3 34 +31 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Cover the reminder conversion, normalization, and data-source mapping helpers with internal-package unit tests, and extract the reminder validation into a testable validateReminderConfig helper. Addresses 0% patch coverage on the reminder code paths. Co-authored-by: Cursor <cursoragent@cursor.com>
…reminders Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # docs/data-sources/campaign.md # opslevel/datasource_opslevel_campaign.go # submodules/opslevel-go
The OpsLevel API has no defaultMicrosoftTeamsChannel field on campaign reminder input or output, so the attribute was silently ignored on write and always read back null. microsoft_teams remains a valid entry in channels. opslevel-go v2026.9.7 ships the reminder types, so the provider now builds against the released shapes: Channels and DaysOfWeek are pointer slices, Message and DefaultSlackChannel are Nullable, and Campaign.Reminder is a value that arrives zeroed when a campaign has none. Also covers NewCampaignResourceModel with a unit test. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
remindersingle-nested attribute to theopslevel_campaignresource for configuring recurring Slack, email, and Microsoft Teams reminders on a schedule.frequency >= 1,HH:MMtime format, andchannelsnon-empty.ValidateConfigenforces thatdays_of_weekis required for a weekly cadence and rejected otherwise.nullto clear on update when the block is removed, and normalize the#prefix ondefault_slack_channelto avoid perpetual diffs.reminderas a computed attribute on theopslevel_campaignandopslevel_campaignsdata sources.Dependency
opslevel-gov2026.9.7 ships the reminder types, so this now builds against the released shapes.The one thing still outstanding is OpsLevel/opslevel-go#623, which is down to a single change:
CampaignUpdateInput.Reminderbecomes*Nullable[CampaignReminderInput]so an explicitnullcan clear an existing reminder. Without it there is no way to express "remove the reminder" — an omitted field means "leave it alone". Thego.modreplacedirective and thesubmodules/opslevel-gopointer are temporary and should be swapped for a version bump once #623 lands.Changes since first review
default_microsoft_teams_channelhas been removed. The API has nodefaultMicrosoftTeamsChannelfield on the campaign reminder input or output type, so the attribute was silently dropped on write and always read back null.microsoft_teamsis still a valid entry inchannels— only the fallback-channel attribute is gone.Test plan
task lint— gofumpt, golangci-lint (0 issues),terraform validate,terraform fmt -checktask test— terraform mock tests + Go unit tests, 109 passed / 0 failedcampaignReminderToObjectandpreserveHashChannelandNewCampaignResourceModelat 100%,buildCampaignReminderInput96%,validateReminderConfig93%tests/remote/campaign.tftest.hcl) cover create-with-reminder, update-to-daily, and clear-reminder; these need a liveOPSLEVEL_API_TOKENand a validowner_id