in internal/provider/resource_gitlab_value_stream_analytics.go [68:174]
func (r *gitlabValueStreamAnalyticsResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
allowedEventLabels := []string{
"CODE_STAGE_START", "ISSUE_CLOSED", "ISSUE_CREATED", "ISSUE_DEPLOYED_TO_PRODUCTION",
"ISSUE_FIRST_ADDED_TO_BOARD", "ISSUE_FIRST_ADDED_TO_ITERATION", "ISSUE_FIRST_ASSIGNED_AT", "ISSUE_FIRST_ASSOCIATED_WITH_MILESTONE",
"ISSUE_FIRST_MENTIONED_IN_COMMIT", "ISSUE_LABEL_ADDED", "ISSUE_LABEL_REMOVED", "ISSUE_LAST_EDITED", "ISSUE_STAGE_END", "MERGE_REQUEST_CLOSED",
"MERGE_REQUEST_CREATED", "MERGE_REQUEST_FIRST_ASSIGNED_AT", "MERGE_REQUEST_FIRST_COMMIT_AT", "MERGE_REQUEST_FIRST_DEPLOYED_TO_PRODUCTION",
"MERGE_REQUEST_LABEL_ADDED", "MERGE_REQUEST_LABEL_REMOVED", "MERGE_REQUEST_LAST_BUILD_FINISHED", "MERGE_REQUEST_LAST_BUILD_STARTED",
"MERGE_REQUEST_LAST_EDITED", "MERGE_REQUEST_MERGED", "MERGE_REQUEST_REVIEWER_FIRST_ASSIGNED", "MERGE_REQUEST_PLAN_STAGE_START",
}
resp.Schema = schema.Schema{
MarkdownDescription: `The ` + "`gitlab_value_stream_analytics`" + ` resource allows to manage the lifecycle of value stream analytics.
-> This resource requires a GitLab Enterprise instance with a Premium license to create custom value stream analytics.
**Upstream API**: [GitLab GraphQL API docs](https://docs.gitlab.com/api/graphql/reference/#mutationvaluestreamcreate)`,
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "The Terraform ID of the value stream in the format of `group:<group_full_path>:<id>` or `project:<project_full_path>:<id>`.",
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"name": schema.StringAttribute{
MarkdownDescription: "The name of the value stream",
Required: true,
Validators: []validator.String{stringvalidator.LengthAtLeast(1)},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
},
"group_full_path": schema.StringAttribute{
MarkdownDescription: "Full path of the group the value stream is created in. **One of `group_full_path` OR `project_full_path` is required.**",
Optional: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
Validators: []validator.String{
stringvalidator.ConflictsWith(path.MatchRoot("project_full_path")),
},
},
"project_full_path": schema.StringAttribute{
MarkdownDescription: "Full path of the project the value stream is created in. **One of `group_full_path` OR `project_full_path` is required.**",
Optional: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
Validators: []validator.String{
stringvalidator.ConflictsWith(path.MatchRoot("group_full_path")),
},
},
"stages": schema.ListNestedAttribute{
MarkdownDescription: "Stages of the value stream",
Required: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "The ID of the value stream stage.",
Computed: true,
},
"name": schema.StringAttribute{
MarkdownDescription: "The name of the value stream stage.",
Required: true,
Validators: []validator.String{stringvalidator.LengthAtLeast(1)},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
},
"custom": schema.BoolAttribute{
MarkdownDescription: "Boolean whether the stage is customized. If false, it assigns a built-in default stage by name.",
Optional: true,
Validators: []validator.Bool{boolvalidator.All()},
PlanModifiers: []planmodifier.Bool{boolplanmodifier.RequiresReplace()},
},
"hidden": schema.BoolAttribute{
MarkdownDescription: "Boolean whether the stage is hidden, GitLab provided default stages are hidden by default.",
Optional: true,
Validators: []validator.Bool{boolvalidator.All()},
PlanModifiers: []planmodifier.Bool{boolplanmodifier.RequiresReplace()},
},
"end_event_identifier": schema.StringAttribute{
MarkdownDescription: fmt.Sprintf(`End event identifier. Valid values are: %s`, utils.RenderValueListForDocs(allowedEventLabels)),
Optional: true,
Computed: true,
Validators: []validator.String{stringvalidator.OneOf(allowedEventLabels...)},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
},
"end_event_label_id": schema.StringAttribute{
MarkdownDescription: "Label ID associated with the end event identifier. In the format of `gid://gitlab/GroupLabel/<id>` or `gid://gitlab/ProjectLabel/<id>`",
Optional: true,
Computed: true,
Validators: []validator.String{stringvalidator.LengthAtLeast(1)},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
},
"start_event_identifier": schema.StringAttribute{
MarkdownDescription: fmt.Sprintf(`Start event identifier. Valid values are: %s`, utils.RenderValueListForDocs(allowedEventLabels)),
Optional: true,
Computed: true,
Validators: []validator.String{stringvalidator.OneOf(allowedEventLabels...)},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
},
"start_event_label_id": schema.StringAttribute{
MarkdownDescription: "Label ID associated with the start event identifier. In the format of `gid://gitlab/GroupLabel/<id>` or `gid://gitlab/ProjectLabel/<id>`",
Optional: true,
Computed: true,
Validators: []validator.String{stringvalidator.LengthAtLeast(1)},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
},
},
},
},
},
}
}