in internal/provider/resource_gitlab_user_runner.go [69:168]
func (d *gitlabUserRunnerResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
// Valid values for the schema:
var validRunnerTypes = []string{"instance_type", "group_type", "project_type"}
var validAccessLevels = []string{"not_protected", "ref_protected"}
resp.Schema = schema.Schema{
MarkdownDescription: `The ` + "`gitlab_user_runner`" + ` resource allows creating a GitLab runner using the new [GitLab Runner Registration Flow](https://docs.gitlab.com/ci/runners/new_creation_workflow/).
**Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/users/#create-a-runner)`,
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The ID of the gitlab runner.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"runner_type": schema.StringAttribute{
Required: true,
MarkdownDescription: fmt.Sprintf("The scope of the runner. Valid values are: %s.", utils.RenderValueListForDocs(validRunnerTypes)),
Validators: []validator.String{
stringvalidator.OneOfCaseInsensitive(validRunnerTypes...),
},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
},
"group_id": schema.Int64Attribute{
Optional: true,
MarkdownDescription: "The ID of the group that the runner is created in. Required if runner_type is group_type.",
PlanModifiers: []planmodifier.Int64{int64planmodifier.RequiresReplace(), int64planmodifier.UseStateForUnknown()},
},
"project_id": schema.Int64Attribute{
Optional: true,
MarkdownDescription: "The ID of the project that the runner is created in. Required if runner_type is project_type.",
PlanModifiers: []planmodifier.Int64{int64planmodifier.RequiresReplace(), int64planmodifier.UseStateForUnknown()},
},
"description": schema.StringAttribute{
Optional: true,
Computed: true,
MarkdownDescription: "Description of the runner.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"paused": schema.BoolAttribute{
Optional: true,
Computed: true,
MarkdownDescription: "Specifies if the runner should ignore new jobs.",
PlanModifiers: []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
},
"locked": schema.BoolAttribute{
Optional: true,
Computed: true,
MarkdownDescription: "Specifies if the runner should be locked for the current project.",
PlanModifiers: []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
},
"untagged": schema.BoolAttribute{
Optional: true,
Computed: true,
MarkdownDescription: "Specifies if the runner should handle untagged jobs.",
PlanModifiers: []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
},
"tag_list": schema.SetAttribute{
ElementType: types.StringType,
Optional: true,
Computed: true,
MarkdownDescription: "A list of runner tags.",
PlanModifiers: []planmodifier.Set{setplanmodifier.UseStateForUnknown()},
},
"access_level": schema.StringAttribute{
Optional: true,
Computed: true,
MarkdownDescription: fmt.Sprintf("The access level of the runner. Valid values are: %s.", utils.RenderValueListForDocs(validAccessLevels)),
Validators: []validator.String{
stringvalidator.OneOfCaseInsensitive(validAccessLevels...),
},
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"maximum_timeout": schema.Int64Attribute{
Optional: true,
Computed: true,
MarkdownDescription: "Maximum timeout that limits the amount of time (in seconds) that runners can run jobs. Must be at least 600 (10 minutes).",
Validators: []validator.Int64{
int64validator.AtLeast(600), // api enforced {maximum_timeout: [needs to be at least 10 minutes]}}
},
PlanModifiers: []planmodifier.Int64{int64planmodifier.UseStateForUnknown()},
},
"token": schema.StringAttribute{
Computed: true,
Sensitive: true,
MarkdownDescription: "The authentication token to use when setting up a new runner with this configuration. This value cannot be imported.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"maintenance_note": schema.StringAttribute{
Optional: true,
Computed: true,
MarkdownDescription: "Free-form maintenance notes for the runner (1024 characters) ",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
Validators: []validator.String{
stringvalidator.UTF8LengthAtMost(1024),
},
},
},
}
}