Help us shape the future of Go! Take the 2026 Go Developer Survey

workflowtemplate

package
v1.12.6 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertRuntimeSourceToAPI added in v1.12.3

func ConvertRuntimeSourceToAPI(ctx context.Context, runtimeSourceObj types.Object) (*workflowtemplates.RuntimeSource, diag.Diagnostics)

ConvertRuntimeSourceToAPI converts a runtime_source types.Object to *workflowtemplates.RuntimeSource for a Create request. It returns nil for a null or unknown object and otherwise delegates to RuntimeSourceModel.ToAPIModel. Shared by workflow_template and workflow_template_revision's ToAPIModel, and the base of ConvertRuntimeSourceToUpdateAPI, so Create and Update convert runtime_source the same way.

func ConvertRuntimeSourceToUpdateAPI added in v1.12.3

func ConvertRuntimeSourceToUpdateAPI(ctx context.Context, runtimeSourceObj types.Object) (*workflowtemplates.RuntimeSourceUpdate, diag.Diagnostics)

ConvertRuntimeSourceToUpdateAPI converts a runtime_source types.Object to *workflowtemplates.RuntimeSourceUpdate for an Update request, by reusing ConvertRuntimeSourceToAPI's Create-path conversion (see RuntimeSourceModel.ToAPIModel for why the is_private/git_core_auto_crlf/ref guards are needed) and mapping the result through runtimeSourceConfigToUpdate, rather than re-deriving the same guards a second time in a separately-maintained function. Shared by workflow_template and workflow_template_revision's ToUpdateAPIModel.

func NewResource

func NewResource() resource.Resource

NewResource is a helper function to simplify the provider implementation.

func RuntimeSourceToTerraType

func RuntimeSourceToTerraType(runtimeSource *workflowtemplates.RuntimeSource) (types.Object, diag.Diagnostics)

func ValidateRuntimeSourceAuth added in v1.12.2

func ValidateRuntimeSourceAuth(ctx context.Context, runtimeSourceObj types.Object, attrPath path.Path) diag.Diagnostics

ValidateRuntimeSourceAuth validates the is_private/auth relationship on a git-based runtime_source, at the attrPath it was read from (e.g. path.Root("runtime_source")).

Rules:

  • is_private=true requires auth to be set.
  • Any source_config_dest_kind other than GIT_OTHER requires auth to be set, regardless of is_private — GIT_OTHER is the only kind that can be public/authless.
  • When auth is set: GIT_OTHER requires a "/secrets/" reference; every other kind requires a reference starting with "/integration" (matches "/integrations/..." and any other value beginning with that substring). For GIT_OTHER, auth may be set with is_private=false too — an access token for a public repository is valid.

func ValidateRuntimeSourceRepoUnchanged added in v1.12.3

func ValidateRuntimeSourceRepoUnchanged(ctx context.Context, plan tfsdk.Plan, state tfsdk.State) diag.Diagnostics

ValidateRuntimeSourceRepoUnchanged errors if runtime_source.config.repo differs between plan and state. Shared by workflow_template and workflow_template_revision's ModifyPlan — repo cannot be changed on an existing template or revision, published or not: the API has no endpoint to change it in place, and replacing the resource would change its identity (a new template, or a new revision number), breaking anything that references the old one. See constants.WorkflowTemplateRuntimeSourceConfigRepo. A plan repo that is unknown — or whose runtime_source or config is unknown — is skipped rather than compared as "".

func ValidateSourceConfigKindUnchanged added in v1.12.3

func ValidateSourceConfigKindUnchanged(planKind, stateKind types.String, resourceLabel, resourceTypeName string) diag.Diagnostics

ValidateSourceConfigKindUnchanged errors if source_config_kind differs between planKind and stateKind. Shared by workflow_template and workflow_template_revision's ModifyPlan — source_config_kind is immutable on an existing resource: the API has no endpoint to change it in place, and replacing the resource would change its identity (a new template, or a new revision number), breaking anything that references the old one. resourceLabel names the resource in the error message (e.g. "workflow template", "revision") and resourceTypeName gives the Terraform type to create instead (e.g. "stackguardian_workflow_template").

func WorkflowTemplateRuntimeSourceConfig

func WorkflowTemplateRuntimeSourceConfig() map[string]schema.Attribute

Types

type RuntimeSourceConfigModel

type RuntimeSourceConfigModel struct {
	IsPrivate               types.Bool   `tfsdk:"is_private"`
	Auth                    types.String `tfsdk:"auth"`
	GitCoreAutoCrlf         types.Bool   `tfsdk:"git_core_auto_crlf"`
	GitSparseCheckoutConfig types.String `tfsdk:"git_sparse_checkout_config"`
	IncludeSubModule        types.Bool   `tfsdk:"include_sub_module"`
	Ref                     types.String `tfsdk:"ref"`
	Repo                    types.String `tfsdk:"repo"`
	WorkingDir              types.String `tfsdk:"working_dir"`
}

func (RuntimeSourceConfigModel) AttributeTypes

func (RuntimeSourceConfigModel) AttributeTypes() map[string]attr.Type

type RuntimeSourceModel

type RuntimeSourceModel struct {
	SourceConfigDestKind types.String `tfsdk:"source_config_dest_kind"`
	Config               types.Object `tfsdk:"config"`
}

func (RuntimeSourceModel) AttributeTypes

func (RuntimeSourceModel) AttributeTypes() map[string]attr.Type

func (RuntimeSourceModel) ToAPIModel

type WorkflowTemplateResourceModel

type WorkflowTemplateResourceModel struct {
	Id               types.String `tfsdk:"id"`
	TemplateName     types.String `tfsdk:"template_name"`
	OwnerOrg         types.String `tfsdk:"owner_org"`
	SourceConfigKind types.String `tfsdk:"source_config_kind"`
	IsPublic         types.String `tfsdk:"is_public"`
	ShortDescription types.String `tfsdk:"description"`
	RuntimeSource    types.Object `tfsdk:"runtime_source"`
	SharedOrgsList   types.List   `tfsdk:"shared_orgs_list"`
	Tags             types.List   `tfsdk:"tags"`
	ContextTags      types.Map    `tfsdk:"context_tags"`
}

func (*WorkflowTemplateResourceModel) ToAPIModel

func (*WorkflowTemplateResourceModel) ToUpdateAPIModel

Jump to

Keyboard shortcuts

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