Skip to content

Add opslevel_campaign resource for managing campaigns as code #644

@jamescarr

Description

@jamescarr

Problem

There is no way to manage OpsLevel campaigns as code. Campaign creation, scheduling, check association, and updates must be done manually through the OpsLevel UI, which makes it difficult to version-control campaign rollouts, reproduce them across environments, or compose them alongside the checks and scorecards they reference.

Proposed Solution

Add an opslevel_campaign Terraform resource with full CRUD lifecycle support.

Managed Attributes

Attribute Type Description
name Required Campaign name
owner_id Required Team that owns the campaign
filter_id Optional Filter applied to the campaign
project_brief Optional Markdown project brief
check_ids Optional List of rubric check IDs to associate
start_date Optional Start date (YYYY-MM-DD)
target_date Optional Target date (YYYY-MM-DD)

Computed Attributes

id, status, html_url

Key Behaviors

  • Create: Creates a draft campaign. If both start_date and target_date are set, immediately schedules it. If check_ids is set, copies rubric checks into the campaign.
  • Read: Fetches campaign by ID. Queries the campaign's actual checks from the API and cross-references them against the configured rubric check IDs to detect drift (checks removed outside Terraform).
  • Update: Updates campaign fields. Manages schedule lifecycle (add/change/remove dates). Reconciles check_ids — adds new checks via checksCopyToCampaign and removes stale checks by matching rubric check names to campaign check instances and deleting them.
  • Delete: Deletes the campaign.
  • Import: Supports terraform import by campaign ID.

Data Sources

  • opslevel_campaign — look up a single campaign
  • opslevel_campaigns — list all campaigns

Dependencies

Requires campaign CRUD methods in opslevel-go (see OpsLevel/opslevel-go#612).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions