resource

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectAccessLevelNone   = "none"
	ProjectAccessLevelMember = "member"
	ProjectAccessLevelAdmin  = "admin"
)

These apply to project-level access for roles and organization members.

Variables

View Source
var (
	MembershipLevelMember = MembershipLevel{Name: "member", Value: 1}
	MembershipLevelAdmin  = MembershipLevel{Name: "admin", Value: 8}
	MembershipLevelOwner  = MembershipLevel{Name: "owner", Value: 15}
)

Functions

func NewAccessControl added in v1.0.4

func NewAccessControl() resource.Resource

func NewAction added in v1.0.5

func NewAction() resource.Resource

func NewAlert

func NewAlert() resource.Resource

func NewDashboard

func NewDashboard() resource.Resource

func NewDashboardLayout added in v1.0.6

func NewDashboardLayout() resource.Resource

func NewFeatureFlag

func NewFeatureFlag() resource.Resource

func NewHogFunction

func NewHogFunction() resource.Resource

func NewInsight

func NewInsight() resource.Resource

func NewOrganizationMember added in v1.0.4

func NewOrganizationMember() resource.Resource

func NewProject added in v1.0.1

func NewProject() resource.Resource

func NewProjectDefaultAccess added in v1.0.4

func NewProjectDefaultAccess() resource.Resource

func NewProjectMember added in v1.0.4

func NewProjectMember() resource.Resource

func NewRole added in v1.0.4

func NewRole() resource.Resource

func NewRoleMembership added in v1.0.4

func NewRoleMembership() resource.Resource

Types

type AccessControlOps added in v1.0.4

type AccessControlOps struct{}

func (AccessControlOps) BuildCreateRequest added in v1.0.4

func (AccessControlOps) BuildUpdateRequest added in v1.0.4

func (AccessControlOps) Create added in v1.0.4

func (AccessControlOps) Delete added in v1.0.4

func (AccessControlOps) MapResponseToModel added in v1.0.4

func (AccessControlOps) Read added in v1.0.4

func (AccessControlOps) ResourceName added in v1.0.4

func (o AccessControlOps) ResourceName() string

func (AccessControlOps) Schema added in v1.0.4

func (o AccessControlOps) Schema() schema.Schema

type AccessControlTFModel added in v1.0.4

type AccessControlTFModel struct {
	core.BaseProjectID
	// Composite ID: project_id/resource/[resource_id/]role/role_id or similar for member
	ID                 types.String `tfsdk:"id"`
	Resource           types.String `tfsdk:"resource"`
	ResourceID         types.String `tfsdk:"resource_id"`
	AccessLevel        types.String `tfsdk:"access_level"`
	Role               types.String `tfsdk:"role"`
	OrganizationMember types.String `tfsdk:"organization_member"`
	CreatedAt          types.String `tfsdk:"created_at"`
	UpdatedAt          types.String `tfsdk:"updated_at"`
}

func (AccessControlTFModel) GetID added in v1.0.4

func (m AccessControlTFModel) GetID() string

func (AccessControlTFModel) HasValidID added in v1.0.4

func (m AccessControlTFModel) HasValidID() bool

HasValidID returns true if we have enough information to identify the access control. For access controls, this means having resource. Role and organization_member are optional (when neither is set, it's a project-level default).

func (*AccessControlTFModel) SetAccessControlFields added in v1.0.4

func (m *AccessControlTFModel) SetAccessControlFields(resourceType, resourceID, targetType, targetID string)

type ActionOps added in v1.0.5

type ActionOps struct{}

func (ActionOps) BuildCreateRequest added in v1.0.5

func (o ActionOps) BuildCreateRequest(ctx context.Context, model ActionTFModel) (httpclient.ActionRequest, diag.Diagnostics)

func (ActionOps) BuildUpdateRequest added in v1.0.5

func (o ActionOps) BuildUpdateRequest(ctx context.Context, plan, state ActionTFModel) (httpclient.ActionRequest, diag.Diagnostics)

func (ActionOps) Create added in v1.0.5

func (ActionOps) Delete added in v1.0.5

func (ActionOps) MapResponseToModel added in v1.0.5

func (o ActionOps) MapResponseToModel(ctx context.Context, resp httpclient.Action, model *ActionTFModel) diag.Diagnostics

func (ActionOps) Read added in v1.0.5

func (ActionOps) ResourceName added in v1.0.5

func (o ActionOps) ResourceName() string

func (ActionOps) Schema added in v1.0.5

func (o ActionOps) Schema() schema.Schema

func (ActionOps) Update added in v1.0.5

type ActionTFModel added in v1.0.5

type ActionTFModel struct {
	core.BaseInt64Identifiable
	core.BaseProjectID
	Name               types.String `tfsdk:"name"`
	Description        types.String `tfsdk:"description"`
	Tags               types.Set    `tfsdk:"tags"`
	PostToSlack        types.Bool   `tfsdk:"post_to_slack"`
	SlackMessageFormat types.String `tfsdk:"slack_message_format"`
	StepsJSON          types.String `tfsdk:"steps_json"`
	CreatedAt          types.String `tfsdk:"created_at"`
	Deleted            types.Bool   `tfsdk:"deleted"`
}

type AlertOps

type AlertOps struct{}

func (AlertOps) BuildCreateRequest

func (AlertOps) BuildUpdateRequest

func (o AlertOps) BuildUpdateRequest(ctx context.Context, plan, state AlertResourceTFModel) (httpclient.AlertRequest, diag.Diagnostics)

func (AlertOps) MapResponseToModel

func (o AlertOps) MapResponseToModel(ctx context.Context, resp httpclient.Alert, model *AlertResourceTFModel) diag.Diagnostics

func (AlertOps) ResourceName

func (o AlertOps) ResourceName() string

func (AlertOps) Schema

func (o AlertOps) Schema() schema.Schema

type AlertResourceTFModel

type AlertResourceTFModel struct {
	core.BaseStringIdentifiable
	core.BaseProjectID
	Name                 types.String  `tfsdk:"name"`
	Insight              types.Int64   `tfsdk:"insight"`
	Enabled              types.Bool    `tfsdk:"enabled"`
	SubscribedUsers      types.Set     `tfsdk:"subscribed_users"`
	ThresholdType        types.String  `tfsdk:"threshold_type"`
	ThresholdLower       types.Float64 `tfsdk:"threshold_lower"`
	ThresholdUpper       types.Float64 `tfsdk:"threshold_upper"`
	ConditionType        types.String  `tfsdk:"condition_type"`
	SeriesIndex          types.Int64   `tfsdk:"series_index"`
	CheckOngoingInterval types.Bool    `tfsdk:"check_ongoing_interval"`
	CalculationInterval  types.String  `tfsdk:"calculation_interval"`
	SkipWeekend          types.Bool    `tfsdk:"skip_weekend"`
}

type DashboardLayoutOps added in v1.0.6

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

func (*DashboardLayoutOps) BuildCreateRequest added in v1.0.6

func (*DashboardLayoutOps) BuildUpdateRequest added in v1.0.6

func (*DashboardLayoutOps) Delete added in v1.0.6

func (*DashboardLayoutOps) MapResponseToModel added in v1.0.6

func (*DashboardLayoutOps) ModifyResourcePlan added in v1.0.6

ModifyResourcePlan copies tile_id from state into the plan for existing tiles. tile_id is Computed-only (server-assigned), so without this it would be Unknown in every plan. Resolving it early means buildLayoutPatch can match text tiles by tile_id instead of falling back to body matching, which enables in-place updates when a text tile's body changes and avoids ambiguity with duplicate bodies.

func (*DashboardLayoutOps) ResourceName added in v1.0.6

func (o *DashboardLayoutOps) ResourceName() string

func (*DashboardLayoutOps) Schema added in v1.0.6

func (o *DashboardLayoutOps) Schema() schema.Schema

type DashboardLayoutTFModel added in v1.0.6

type DashboardLayoutTFModel struct {
	core.BaseInt64Identifiable
	core.BaseProjectID
	DashboardID types.Int64 `tfsdk:"dashboard_id"`
	Tiles       types.List  `tfsdk:"tiles"` // element type: TileTFModel
}

type DashboardOps

type DashboardOps struct{}

func (DashboardOps) BuildCreateRequest

func (DashboardOps) BuildUpdateRequest

func (DashboardOps) MapResponseToModel

func (o DashboardOps) MapResponseToModel(ctx context.Context, resp httpclient.Dashboard, model *DashboardResourceTFModel) diag.Diagnostics

func (DashboardOps) ResourceName

func (o DashboardOps) ResourceName() string

func (DashboardOps) Schema

func (o DashboardOps) Schema() schema.Schema

type DashboardResourceTFModel

type DashboardResourceTFModel struct {
	core.BaseInt64Identifiable
	core.BaseProjectID
	Name        types.String `tfsdk:"name"`
	Description types.String `tfsdk:"description"`
	Pinned      types.Bool   `tfsdk:"pinned"`
	Tags        types.Set    `tfsdk:"tags"`
	Deleted     types.Bool   `tfsdk:"deleted"`
}

type FeatureFlagOps

type FeatureFlagOps struct{}

func (FeatureFlagOps) BuildCreateRequest

func (FeatureFlagOps) BuildUpdateRequest

func (FeatureFlagOps) Delete

func (FeatureFlagOps) MapResponseToModel

func (o FeatureFlagOps) MapResponseToModel(ctx context.Context, resp httpclient.FeatureFlag, model *FeatureFlagTFModel) diag.Diagnostics

func (FeatureFlagOps) ResourceName

func (o FeatureFlagOps) ResourceName() string

func (FeatureFlagOps) Schema

func (o FeatureFlagOps) Schema() schema.Schema

type FeatureFlagTFModel

type FeatureFlagTFModel struct {
	core.BaseInt64Identifiable
	core.BaseProjectID
	Key               types.String `tfsdk:"key"`
	Name              types.String `tfsdk:"name"`
	Active            types.Bool   `tfsdk:"active"`
	Filters           types.String `tfsdk:"filters"`
	RolloutPercentage types.Int64  `tfsdk:"rollout_percentage"`
	Tags              types.Set    `tfsdk:"tags"`
	Deleted           types.Bool   `tfsdk:"deleted"`
}

type HogFunctionOps

type HogFunctionOps struct{}

func (HogFunctionOps) BuildUpdateRequest

func (HogFunctionOps) MapResponseToModel

func (HogFunctionOps) ResourceName

func (o HogFunctionOps) ResourceName() string

func (HogFunctionOps) Schema

func (o HogFunctionOps) Schema() schema.Schema

type HogFunctionResourceTFModel

type HogFunctionResourceTFModel struct {
	core.BaseStringIdentifiable
	core.BaseProjectID
	Type                types.String `tfsdk:"type"`
	Name                types.String `tfsdk:"name"`
	Description         types.String `tfsdk:"description"`
	Enabled             types.Bool   `tfsdk:"enabled"`
	Hog                 types.String `tfsdk:"hog"`
	InputsJSON          types.String `tfsdk:"inputs_json"`
	SensitiveInputsJSON types.String `tfsdk:"sensitive_inputs_json"`
	InputsSchemaJSON    types.String `tfsdk:"inputs_schema_json"`
	FiltersJSON         types.String `tfsdk:"filters_json"`
	MaskingJSON         types.String `tfsdk:"masking_json"`
	MappingsJSON        types.String `tfsdk:"mappings_json"`
	IconURL             types.String `tfsdk:"icon_url"`
	TemplateID          types.String `tfsdk:"template_id"`
	ExecutionOrder      types.Int64  `tfsdk:"execution_order"`
}

type InsightOps

type InsightOps struct{}

func (InsightOps) BuildCreateRequest

func (InsightOps) BuildUpdateRequest

func (o InsightOps) BuildUpdateRequest(ctx context.Context, plan, state InsightResourceTFModel) (httpclient.InsightRequest, diag.Diagnostics)

func (InsightOps) MapResponseToModel

func (o InsightOps) MapResponseToModel(ctx context.Context, resp httpclient.Insight, model *InsightResourceTFModel) diag.Diagnostics

func (InsightOps) ResourceName

func (o InsightOps) ResourceName() string

func (InsightOps) Schema

func (o InsightOps) Schema() schema.Schema

type InsightResourceTFModel

type InsightResourceTFModel struct {
	core.BaseInt64Identifiable
	core.BaseProjectID
	Name           types.String `tfsdk:"name"`
	DerivedName    types.String `tfsdk:"derived_name"`
	Description    types.String `tfsdk:"description"`
	QueryJSON      types.String `tfsdk:"query_json"`
	Tags           types.Set    `tfsdk:"tags"`
	CreateInFolder types.String `tfsdk:"create_in_folder"`
	DashboardIDs   types.Set    `tfsdk:"dashboard_ids"`
	Deleted        types.Bool   `tfsdk:"deleted"`
}

type MembershipLevel added in v1.0.4

type MembershipLevel struct {
	Name  string
	Value int
}

MembershipLevel represents an organization membership level. See: https://app.posthog.com/api/schema/ (OrganizationMembershipLevel enum)

type OrganizationMemberOps added in v1.0.4

type OrganizationMemberOps struct{}

func (OrganizationMemberOps) BuildCreateRequest added in v1.0.4

func (OrganizationMemberOps) BuildUpdateRequest added in v1.0.4

func (OrganizationMemberOps) Create added in v1.0.4

Create "adopts" an existing organization member and optionally updates their level. Users must already be members of the organization (e.g., via invite) before this resource can manage them.

func (OrganizationMemberOps) Delete added in v1.0.4

func (OrganizationMemberOps) MapResponseToModel added in v1.0.4

func (OrganizationMemberOps) ResourceName added in v1.0.4

func (o OrganizationMemberOps) ResourceName() string

func (OrganizationMemberOps) Schema added in v1.0.4

func (o OrganizationMemberOps) Schema() schema.Schema

type OrganizationMemberTFModel added in v1.0.4

type OrganizationMemberTFModel struct {
	core.BaseStringIdentifiable
	core.BaseOrganizationID
	UserUUID        types.String `tfsdk:"user_uuid"`
	Level           types.String `tfsdk:"level"`
	RetainOnDestroy types.Bool   `tfsdk:"retain_on_destroy"`
	Email           types.String `tfsdk:"email"`
	FirstName       types.String `tfsdk:"first_name"`
	LastName        types.String `tfsdk:"last_name"`
	JoinedAt        types.String `tfsdk:"joined_at"`
	Is2FAEnabled    types.Bool   `tfsdk:"is_2fa_enabled"`
}

func (*OrganizationMemberTFModel) SetUserUUID added in v1.0.4

func (m *OrganizationMemberTFModel) SetUserUUID(userUUID string)

type ProjectDefaultAccessModel added in v1.0.4

type ProjectDefaultAccessModel struct {
	core.BaseProjectID
	// ID is the project_id since there's only one default per project
	ID          types.String `tfsdk:"id"`
	AccessLevel types.String `tfsdk:"access_level"`
}

ProjectDefaultAccessModel manages the default access level for a project. This is a singleton per project - there's only one default access level.

func (ProjectDefaultAccessModel) GetID added in v1.0.4

func (ProjectDefaultAccessModel) HasValidID added in v1.0.4

func (m ProjectDefaultAccessModel) HasValidID() bool

type ProjectDefaultAccessOps added in v1.0.4

type ProjectDefaultAccessOps struct{}

func (ProjectDefaultAccessOps) BuildCreateRequest added in v1.0.4

func (ProjectDefaultAccessOps) BuildUpdateRequest added in v1.0.4

func (ProjectDefaultAccessOps) Delete added in v1.0.4

func (ProjectDefaultAccessOps) MapResponseToModel added in v1.0.4

func (ProjectDefaultAccessOps) ResourceName added in v1.0.4

func (o ProjectDefaultAccessOps) ResourceName() string

func (ProjectDefaultAccessOps) Schema added in v1.0.4

type ProjectMemberModel added in v1.0.4

type ProjectMemberModel struct {
	core.BaseProjectID
	// Composite ID: project_id/role/<role_id> or project_id/member/<member_id>
	ID                 types.String `tfsdk:"id"`
	Role               types.String `tfsdk:"role"`
	OrganizationMember types.String `tfsdk:"organization_member"`
	AccessLevel        types.String `tfsdk:"access_level"`
	CreatedAt          types.String `tfsdk:"created_at"`
	UpdatedAt          types.String `tfsdk:"updated_at"`
}

ProjectMemberModel manages a role or organization member's access to a project.

func (ProjectMemberModel) GetID added in v1.0.4

func (m ProjectMemberModel) GetID() string

func (ProjectMemberModel) HasValidID added in v1.0.4

func (m ProjectMemberModel) HasValidID() bool

func (*ProjectMemberModel) SetID added in v1.0.4

func (m *ProjectMemberModel) SetID(id string) error

func (*ProjectMemberModel) SetProjectMemberFields added in v1.0.4

func (m *ProjectMemberModel) SetProjectMemberFields(targetType, targetID string)

SetProjectMemberFields sets the role or organization_member field based on import parsing.

type ProjectMemberOps added in v1.0.4

type ProjectMemberOps struct{}

func (ProjectMemberOps) BuildCreateRequest added in v1.0.4

func (ProjectMemberOps) BuildUpdateRequest added in v1.0.4

func (ProjectMemberOps) Delete added in v1.0.4

func (ProjectMemberOps) MapResponseToModel added in v1.0.4

func (ProjectMemberOps) Read added in v1.0.4

func (ProjectMemberOps) ResourceName added in v1.0.4

func (o ProjectMemberOps) ResourceName() string

func (ProjectMemberOps) Schema added in v1.0.4

func (o ProjectMemberOps) Schema() schema.Schema

type ProjectOps added in v1.0.2

type ProjectOps struct{}

func (ProjectOps) BuildCreateRequest added in v1.0.2

func (o ProjectOps) BuildCreateRequest(ctx context.Context, model ProjectTFModel) (httpclient.ProjectRequest, diag.Diagnostics)

func (ProjectOps) BuildUpdateRequest added in v1.0.2

func (o ProjectOps) BuildUpdateRequest(ctx context.Context, plan, state ProjectTFModel) (httpclient.ProjectRequest, diag.Diagnostics)

func (ProjectOps) Create added in v1.0.2

func (ProjectOps) Delete added in v1.0.2

func (ProjectOps) MapResponseToModel added in v1.0.2

func (o ProjectOps) MapResponseToModel(ctx context.Context, resp httpclient.Project, model *ProjectTFModel) diag.Diagnostics

func (ProjectOps) Read added in v1.0.2

func (ProjectOps) ResourceName added in v1.0.2

func (o ProjectOps) ResourceName() string

func (ProjectOps) Schema added in v1.0.2

func (o ProjectOps) Schema() schema.Schema

func (ProjectOps) Update added in v1.0.2

type ProjectTFModel added in v1.0.1

type ProjectTFModel struct {
	core.BaseInt64Identifiable
	core.BaseOrganizationID
	Name     types.String `tfsdk:"name"`
	APIToken types.String `tfsdk:"api_token"`
	Timezone types.String `tfsdk:"timezone"`
}

type RoleMembershipOps added in v1.0.4

type RoleMembershipOps struct{}

func (RoleMembershipOps) BuildCreateRequest added in v1.0.4

func (RoleMembershipOps) BuildUpdateRequest added in v1.0.4

func (RoleMembershipOps) Create added in v1.0.4

func (RoleMembershipOps) Delete added in v1.0.4

func (RoleMembershipOps) MapResponseToModel added in v1.0.4

func (RoleMembershipOps) Read added in v1.0.4

func (RoleMembershipOps) ResourceName added in v1.0.4

func (o RoleMembershipOps) ResourceName() string

func (RoleMembershipOps) Schema added in v1.0.4

func (o RoleMembershipOps) Schema() schema.Schema

type RoleMembershipTFModel added in v1.0.4

type RoleMembershipTFModel struct {
	core.BaseStringIdentifiable
	core.BaseOrganizationID
	core.BaseRoleID
	UserUUID  types.String `tfsdk:"user_uuid"`
	UserEmail types.String `tfsdk:"user_email"`
	JoinedAt  types.String `tfsdk:"joined_at"`
}

type RoleOps added in v1.0.4

type RoleOps struct{}

func (RoleOps) BuildCreateRequest added in v1.0.4

func (o RoleOps) BuildCreateRequest(_ context.Context, model RoleTFModel) (httpclient.RoleRequest, diag.Diagnostics)

func (RoleOps) BuildUpdateRequest added in v1.0.4

func (o RoleOps) BuildUpdateRequest(ctx context.Context, plan, _ RoleTFModel) (httpclient.RoleRequest, diag.Diagnostics)

func (RoleOps) Create added in v1.0.4

func (RoleOps) Delete added in v1.0.4

func (RoleOps) MapResponseToModel added in v1.0.4

func (o RoleOps) MapResponseToModel(_ context.Context, resp httpclient.Role, model *RoleTFModel) diag.Diagnostics

func (RoleOps) Read added in v1.0.4

func (RoleOps) ResourceName added in v1.0.4

func (o RoleOps) ResourceName() string

func (RoleOps) Schema added in v1.0.4

func (o RoleOps) Schema() schema.Schema

func (RoleOps) Update added in v1.0.4

type RoleTFModel added in v1.0.4

type RoleTFModel struct {
	core.BaseStringIdentifiable
	core.BaseOrganizationID
	Name      types.String `tfsdk:"name"`
	CreatedAt types.String `tfsdk:"created_at"`
	CreatedBy types.String `tfsdk:"created_by"`
}

type TileTFModel added in v1.0.6

type TileTFModel struct {
	TileID      types.Int64          `tfsdk:"tile_id"`
	InsightID   types.Int64          `tfsdk:"insight_id"`
	TextBody    types.String         `tfsdk:"text_body"`
	Color       types.String         `tfsdk:"color"`
	LayoutsJSON jsontypes.Normalized `tfsdk:"layouts_json"`
}

func (TileTFModel) IsInsightTile added in v1.0.6

func (t TileTFModel) IsInsightTile() bool

func (TileTFModel) IsTextTile added in v1.0.6

func (t TileTFModel) IsTextTile() bool

Directories

Path Synopsis
Package core provides helper functions for Terraform resources.
Package core provides helper functions for Terraform resources.

Jump to

Keyboard shortcuts

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