resources

package
v0.1.0-alpha.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package resources — monitor `auth` block plumbing.

The Terraform-facing schema models monitor authentication as a single nested attribute with one sub-attribute per discriminator variant (bearer / basic / header / api_key). Exactly one variant must be set per `auth` block; this is enforced at plan time by `validateMonitorAuth` because Terraform's schema model has no "exactly one of" primitive that works for nested attributes (every sub-attribute must be Optional so the user can choose any single variant).

Wire-format mapping is one-to-one with the OpenAPI `MonitorAuthConfig` discriminated union — we use the codegen `From*AuthConfig` / `As*AuthConfig` methods directly so the JSON roundtrip stays in lockstep with whatever the spec evolves to.

This refactor superseded a legacy `auth = jsonencode({ ... })` stringly-typed shape. Because there are no production customers yet, no `UpgradeState` migrator is provided — existing alpha users are expected to remove the resource from state and re-import after the upgrade. See `cowork/design/040-codegen-policies.md` for the full rationale.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAlertChannelResource

func NewAlertChannelResource() resource.Resource

func NewDependencyResource

func NewDependencyResource() resource.Resource

func NewEnvironmentResource

func NewEnvironmentResource() resource.Resource

func NewMonitorResource

func NewMonitorResource() resource.Resource

func NewNotificationPolicyResource

func NewNotificationPolicyResource() resource.Resource

func NewResourceGroupMembershipResource

func NewResourceGroupMembershipResource() resource.Resource

func NewResourceGroupResource

func NewResourceGroupResource() resource.Resource

func NewSecretResource

func NewSecretResource() resource.Resource

func NewStatusPageComponentGroupResource

func NewStatusPageComponentGroupResource() resource.Resource

func NewStatusPageComponentResource

func NewStatusPageComponentResource() resource.Resource

func NewStatusPageCustomDomainResource

func NewStatusPageCustomDomainResource() resource.Resource

func NewStatusPageCustomDomainVerificationResource

func NewStatusPageCustomDomainVerificationResource() resource.Resource

func NewStatusPageResource

func NewStatusPageResource() resource.Resource

func NewTagResource

func NewTagResource() resource.Resource

func NewWebhookResource

func NewWebhookResource() resource.Resource

func UseStateForUnknownAlwaysList

func UseStateForUnknownAlwaysList() planmodifier.List

func UseStateForUnknownAlwaysString

func UseStateForUnknownAlwaysString() planmodifier.String

UseStateForUnknownAlwaysString returns the singleton instance.

Types

type AlertChannelResource

type AlertChannelResource struct {
	// contains filtered or unexported fields
}

func (*AlertChannelResource) Configure

func (*AlertChannelResource) Create

func (*AlertChannelResource) Delete

func (*AlertChannelResource) ImportState

func (*AlertChannelResource) Metadata

func (*AlertChannelResource) Read

func (*AlertChannelResource) Schema

func (*AlertChannelResource) Update

func (*AlertChannelResource) ValidateConfig

ValidateConfig implements `resource.ResourceWithValidateConfig`. It delegates the actual matrix enforcement to `validateAlertChannelModel` so the same logic is unit-testable without constructing a full `tfsdk.Config` value.

type AlertChannelResourceModel

type AlertChannelResourceModel struct {
	ID          types.String `tfsdk:"id"`
	Name        types.String `tfsdk:"name"`
	ChannelType types.String `tfsdk:"channel_type"`
	ConfigHash  types.String `tfsdk:"config_hash"`

	// Slack / Discord / Teams
	WebhookURL    types.String `tfsdk:"webhook_url"`
	MentionText   types.String `tfsdk:"mention_text"`
	MentionRoleID types.String `tfsdk:"mention_role_id"`

	// Email
	Recipients types.List `tfsdk:"recipients"`

	// PagerDuty
	RoutingKey       types.String `tfsdk:"routing_key"`
	SeverityOverride types.String `tfsdk:"severity_override"`

	// OpsGenie
	APIKey types.String `tfsdk:"api_key"`
	Region types.String `tfsdk:"region"`

	// Webhook channel
	URL           types.String `tfsdk:"url"`
	CustomHeaders types.Map    `tfsdk:"custom_headers"`
	SigningSecret types.String `tfsdk:"signing_secret"`
}

type DependencyResource

type DependencyResource struct {
	// contains filtered or unexported fields
}

func (*DependencyResource) Configure

func (*DependencyResource) Create

func (*DependencyResource) Delete

func (*DependencyResource) ImportState

func (*DependencyResource) Metadata

func (*DependencyResource) Read

func (*DependencyResource) Schema

func (*DependencyResource) Update

type DependencyResourceModel

type DependencyResourceModel struct {
	ID               types.String `tfsdk:"id"`
	Service          types.String `tfsdk:"service"`
	ServiceName      types.String `tfsdk:"service_name"`
	AlertSensitivity types.String `tfsdk:"alert_sensitivity"`
	ComponentID      types.String `tfsdk:"component_id"`
}

type EnvironmentResource

type EnvironmentResource struct {
	// contains filtered or unexported fields
}

func (*EnvironmentResource) Configure

func (*EnvironmentResource) Create

func (*EnvironmentResource) Delete

func (*EnvironmentResource) ImportState

func (*EnvironmentResource) Metadata

func (*EnvironmentResource) Read

func (*EnvironmentResource) Schema

func (*EnvironmentResource) Update

type EnvironmentResourceModel

type EnvironmentResourceModel struct {
	ID        types.String `tfsdk:"id"`
	Name      types.String `tfsdk:"name"`
	Slug      types.String `tfsdk:"slug"`
	IsDefault types.Bool   `tfsdk:"is_default"`
	Variables types.Map    `tfsdk:"variables"`
}

type MonitorResource

type MonitorResource struct {
	// contains filtered or unexported fields
}

func (*MonitorResource) Configure

func (*MonitorResource) Create

func (*MonitorResource) Delete

func (*MonitorResource) ImportState

func (*MonitorResource) Metadata

func (*MonitorResource) Read

func (*MonitorResource) Schema

func (*MonitorResource) Update

func (*MonitorResource) ValidateConfig

type MonitorResourceModel

type MonitorResourceModel struct {
	ID               types.String `tfsdk:"id"`
	Name             types.String `tfsdk:"name"`
	Type             types.String `tfsdk:"type"`
	FrequencySeconds types.Int64  `tfsdk:"frequency_seconds"`
	Enabled          types.Bool   `tfsdk:"enabled"`
	Regions          types.List   `tfsdk:"regions"`
	EnvironmentID    types.String `tfsdk:"environment_id"`
	AlertChannelIds  types.List   `tfsdk:"alert_channel_ids"`
	TagIds           types.List   `tfsdk:"tag_ids"`
	PingUrl          types.String `tfsdk:"ping_url"`

	Config         types.String `tfsdk:"config"`
	Auth           types.Object `tfsdk:"auth"`
	Assertions     types.List   `tfsdk:"assertions"`
	IncidentPolicy types.Object `tfsdk:"incident_policy"`
}

type NotificationPolicyModel

type NotificationPolicyModel struct {
	ID         types.String `tfsdk:"id"`
	Name       types.String `tfsdk:"name"`
	Enabled    types.Bool   `tfsdk:"enabled"`
	Priority   types.Int64  `tfsdk:"priority"`
	MatchRules types.List   `tfsdk:"match_rule"`
	Escalation types.List   `tfsdk:"escalation_step"`
	OnResolve  types.String `tfsdk:"on_resolve"`
	OnReopen   types.String `tfsdk:"on_reopen"`
}

type NotificationPolicyResource

type NotificationPolicyResource struct {
	// contains filtered or unexported fields
}

func (*NotificationPolicyResource) Configure

func (*NotificationPolicyResource) Create

func (*NotificationPolicyResource) Delete

func (*NotificationPolicyResource) ImportState

func (*NotificationPolicyResource) Metadata

func (*NotificationPolicyResource) Read

func (*NotificationPolicyResource) Schema

func (*NotificationPolicyResource) Update

type ResourceGroupMembershipModel

type ResourceGroupMembershipModel struct {
	ID         types.String `tfsdk:"id"`
	GroupID    types.String `tfsdk:"group_id"`
	MemberType types.String `tfsdk:"member_type"`
	MemberID   types.String `tfsdk:"member_id"`
}

type ResourceGroupMembershipResource

type ResourceGroupMembershipResource struct {
	// contains filtered or unexported fields
}

func (*ResourceGroupMembershipResource) Configure

func (*ResourceGroupMembershipResource) Create

func (*ResourceGroupMembershipResource) Delete

func (*ResourceGroupMembershipResource) ImportState

ImportState parses a compound `<group_id>/<key>` identifier where `key` is matched against the membership row UUID, the member's monitor UUID, or the service member's subscription UUID. Accepting all three forms means operators can import using whichever identifier they have on hand — commonly the monitor or service ID — without needing to first look up the synthetic membership row ID via the API.

func (*ResourceGroupMembershipResource) Metadata

func (*ResourceGroupMembershipResource) Read

func (*ResourceGroupMembershipResource) Schema

func (*ResourceGroupMembershipResource) Update

type ResourceGroupModel

type ResourceGroupModel struct {
	ID                       types.String  `tfsdk:"id"`
	Name                     types.String  `tfsdk:"name"`
	Slug                     types.String  `tfsdk:"slug"`
	Description              types.String  `tfsdk:"description"`
	AlertPolicyID            types.String  `tfsdk:"alert_policy_id"`
	DefaultFrequency         types.Int64   `tfsdk:"default_frequency"`
	DefaultRegions           types.List    `tfsdk:"default_regions"`
	DefaultAlertChannels     types.List    `tfsdk:"default_alert_channels"`
	DefaultEnvironmentID     types.String  `tfsdk:"default_environment_id"`
	DefaultRetryStrategy     types.Object  `tfsdk:"default_retry_strategy"`
	HealthThresholdType      types.String  `tfsdk:"health_threshold_type"`
	HealthThresholdValue     types.Float64 `tfsdk:"health_threshold_value"`
	SuppressMemberAlerts     types.Bool    `tfsdk:"suppress_member_alerts"`
	ConfirmationDelaySeconds types.Int64   `tfsdk:"confirmation_delay_seconds"`
	RecoveryCooldownMinutes  types.Int64   `tfsdk:"recovery_cooldown_minutes"`
}

type ResourceGroupResource

type ResourceGroupResource struct {
	// contains filtered or unexported fields
}

func (*ResourceGroupResource) Configure

func (*ResourceGroupResource) Create

func (*ResourceGroupResource) Delete

func (*ResourceGroupResource) ImportState

func (*ResourceGroupResource) Metadata

func (*ResourceGroupResource) Read

func (*ResourceGroupResource) Schema

func (*ResourceGroupResource) Update

type SecretResource

type SecretResource struct {
	// contains filtered or unexported fields
}

func (*SecretResource) Configure

func (*SecretResource) Create

func (*SecretResource) Delete

func (*SecretResource) ImportState

func (*SecretResource) Metadata

func (*SecretResource) Read

func (*SecretResource) Schema

func (*SecretResource) Update

type SecretResourceModel

type SecretResourceModel struct {
	ID        types.String `tfsdk:"id"`
	Key       types.String `tfsdk:"key"`
	Value     types.String `tfsdk:"value"`
	ValueHash types.String `tfsdk:"value_hash"`
}

type StatusPageComponentGroupResource

type StatusPageComponentGroupResource struct {
	// contains filtered or unexported fields
}

StatusPageComponentGroupResource manages a single component group on a status page as a first-class Terraform resource.

**Why this is a separate resource (not an inline block).** Component groups have their own server-side identity (UUID), independent lifecycle (create/update/delete), and may be referenced by other resources (e.g. `devhelm_status_page_component.group_id`). The canonical Terraform pattern for entities matching all three criteria is a standalone resource: the TF resource address becomes the stable identity, which lets users rename the HCL identifier via the built-in `moved {}` block while preserving the server UUID — no `name`-keyed reconciliation tricks needed.

func (*StatusPageComponentGroupResource) Configure

func (*StatusPageComponentGroupResource) Create

func (*StatusPageComponentGroupResource) Delete

func (*StatusPageComponentGroupResource) ImportState

func (*StatusPageComponentGroupResource) Metadata

func (*StatusPageComponentGroupResource) Read

func (*StatusPageComponentGroupResource) Schema

func (*StatusPageComponentGroupResource) Update

type StatusPageComponentGroupResourceModel

type StatusPageComponentGroupResourceModel struct {
	ID           types.String `tfsdk:"id"`
	StatusPageID types.String `tfsdk:"status_page_id"`
	Name         types.String `tfsdk:"name"`
	Description  types.String `tfsdk:"description"`
	DefaultOpen  types.Bool   `tfsdk:"default_open"`
	DisplayOrder types.Int64  `tfsdk:"display_order"`
}

type StatusPageComponentResource

type StatusPageComponentResource struct {
	// contains filtered or unexported fields
}

StatusPageComponentResource manages a single component on a status page as a first-class Terraform resource (rather than an inline block on the parent page). See StatusPageComponentGroupResource for the architectural rationale; the same logic applies here.

func (*StatusPageComponentResource) Configure

func (*StatusPageComponentResource) Create

func (*StatusPageComponentResource) Delete

func (*StatusPageComponentResource) ImportState

func (*StatusPageComponentResource) Metadata

func (*StatusPageComponentResource) Read

func (*StatusPageComponentResource) Schema

func (*StatusPageComponentResource) Update

func (*StatusPageComponentResource) ValidateConfig

type StatusPageComponentResourceModel

type StatusPageComponentResourceModel struct {
	ID                 types.String `tfsdk:"id"`
	StatusPageID       types.String `tfsdk:"status_page_id"`
	Name               types.String `tfsdk:"name"`
	Description        types.String `tfsdk:"description"`
	Type               types.String `tfsdk:"type"`
	GroupID            types.String `tfsdk:"group_id"`
	MonitorID          types.String `tfsdk:"monitor_id"`
	ResourceGroupID    types.String `tfsdk:"resource_group_id"`
	DisplayOrder       types.Int64  `tfsdk:"display_order"`
	ExcludeFromOverall types.Bool   `tfsdk:"exclude_from_overall"`
	ShowUptime         types.Bool   `tfsdk:"show_uptime"`
	StartDate          types.String `tfsdk:"start_date"`
}

type StatusPageCustomDomainResource

type StatusPageCustomDomainResource struct {
	// contains filtered or unexported fields
}

StatusPageCustomDomainResource reserves a custom hostname on a status page and surfaces the DNS record(s) the operator must create to (a) prove ownership and (b) route traffic.

**Verification is a separate resource.** Reserving the hostname only produces the record requirements; it does not poll DNS or wait for verification to complete. Use `devhelm_status_page_custom_domain_verification` after the DNS records are created — that resource blocks `terraform apply` until the API confirms the domain is verified.

func (*StatusPageCustomDomainResource) Configure

func (*StatusPageCustomDomainResource) Create

func (*StatusPageCustomDomainResource) Delete

func (*StatusPageCustomDomainResource) ImportState

ImportState parses a compound `<status_page_id>/<custom_domain_id>` ID and hydrates the full resource model. The compound form is required because the API exposes domains as a sub-collection under the parent status page; there is no global GET-by-id endpoint.

func (*StatusPageCustomDomainResource) Metadata

func (*StatusPageCustomDomainResource) Read

func (*StatusPageCustomDomainResource) Schema

func (*StatusPageCustomDomainResource) Update

Update handles the only mutable attribute on this resource — `primary`. hostname / status_page_id force replace at the schema level so they never reach this method. A `primary = true` plan promotes the domain via POST /primary; a `primary = false` plan is a no-op (you demote a primary by promoting another domain, not by clearing the flag).

type StatusPageCustomDomainResourceModel

type StatusPageCustomDomainResourceModel struct {
	ID                      types.String `tfsdk:"id"`
	StatusPageID            types.String `tfsdk:"status_page_id"`
	Hostname                types.String `tfsdk:"hostname"`
	Status                  types.String `tfsdk:"status"`
	VerificationMethod      types.String `tfsdk:"verification_method"`
	VerificationToken       types.String `tfsdk:"verification_token"`
	VerificationCnameTarget types.String `tfsdk:"verification_cname_target"`
	VerificationError       types.String `tfsdk:"verification_error"`
	VerifiedAt              types.String `tfsdk:"verified_at"`
	VerificationRecord      types.Object `tfsdk:"verification_record"`
	TrafficRecord           types.Object `tfsdk:"traffic_record"`
	Primary                 types.Bool   `tfsdk:"primary"`
}

type StatusPageCustomDomainVerificationResource

type StatusPageCustomDomainVerificationResource struct {
	// contains filtered or unexported fields
}

StatusPageCustomDomainVerificationResource is a synthetic "barrier" resource modelled on `aws_acm_certificate_validation`. It has no server-side counterpart: its sole job during Create is to repeatedly invoke the DevHelm verify endpoint until the API confirms that the operator's DNS record is in place and the domain has reached a verified state, or until the polling budget is exhausted.

Because both inputs are RequiresReplace, in-place updates cannot occur; the only way to retry verification is to taint or delete-and-recreate this resource. Deleting it does NOT un-verify the underlying domain.

func (*StatusPageCustomDomainVerificationResource) Configure

func (*StatusPageCustomDomainVerificationResource) Create

func (*StatusPageCustomDomainVerificationResource) Delete

func (*StatusPageCustomDomainVerificationResource) Metadata

func (*StatusPageCustomDomainVerificationResource) Read

func (*StatusPageCustomDomainVerificationResource) Schema

func (*StatusPageCustomDomainVerificationResource) Update

type StatusPageCustomDomainVerificationResourceModel

type StatusPageCustomDomainVerificationResourceModel struct {
	StatusPageID   types.String `tfsdk:"status_page_id"`
	CustomDomainID types.String `tfsdk:"custom_domain_id"`
	Status         types.String `tfsdk:"status"`
	VerifiedAt     types.String `tfsdk:"verified_at"`
}

type StatusPageResource

type StatusPageResource struct {
	// contains filtered or unexported fields
}

StatusPageResource manages a DevHelm status page.

**Children are separate resources.** Component groups and components live in their own resources (`devhelm_status_page_component_group` and `devhelm_status_page_component`). This mirrors the API's resource model — each child has its own UUID, lifecycle, and `/components/{id}` endpoint — and lets users rename child entries via Terraform's built-in `moved {}` block without losing identity, or use `for_each` to attach components in bulk. The previous inline-block design has been removed.

func (*StatusPageResource) Configure

func (*StatusPageResource) Create

func (*StatusPageResource) Delete

func (*StatusPageResource) ImportState

func (*StatusPageResource) Metadata

func (*StatusPageResource) Read

func (*StatusPageResource) Schema

func (*StatusPageResource) Update

type StatusPageResourceModel

type StatusPageResourceModel struct {
	ID           types.String `tfsdk:"id"`
	Name         types.String `tfsdk:"name"`
	Slug         types.String `tfsdk:"slug"`
	Description  types.String `tfsdk:"description"`
	Visibility   types.String `tfsdk:"visibility"`
	Enabled      types.Bool   `tfsdk:"enabled"`
	IncidentMode types.String `tfsdk:"incident_mode"`
	Branding     types.Object `tfsdk:"branding"`
	PageURL      types.String `tfsdk:"page_url"`
}

type TagResource

type TagResource struct {
	// contains filtered or unexported fields
}

func (*TagResource) Configure

func (*TagResource) Create

func (*TagResource) Delete

func (*TagResource) ImportState

func (*TagResource) Metadata

func (*TagResource) Read

func (*TagResource) Schema

func (*TagResource) Update

type TagResourceModel

type TagResourceModel struct {
	ID    types.String `tfsdk:"id"`
	Name  types.String `tfsdk:"name"`
	Color types.String `tfsdk:"color"`
}

type WebhookResource

type WebhookResource struct {
	// contains filtered or unexported fields
}

func (*WebhookResource) Configure

func (*WebhookResource) Create

func (*WebhookResource) Delete

func (*WebhookResource) ImportState

func (*WebhookResource) Metadata

func (*WebhookResource) Read

func (*WebhookResource) Schema

func (*WebhookResource) Update

type WebhookResourceModel

type WebhookResourceModel struct {
	ID               types.String `tfsdk:"id"`
	URL              types.String `tfsdk:"url"`
	Description      types.String `tfsdk:"description"`
	Enabled          types.Bool   `tfsdk:"enabled"`
	SubscribedEvents types.Set    `tfsdk:"subscribed_events"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL