Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/data-sources/cdn_distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Read-Only:
- `geofencing` (Map of List of String) A map of URLs to a list of countries where content is allowed.
- `origin_request_headers` (Map of String) The configured origin request headers for the backend
- `origin_url` (String) The configured backend type for the distribution
- `type` (String) The configured backend type. Supported values are: `http`.
- `type` (String) The configured backend type. Possible values are: `http`.


<a id="nestedatt--config--optimizer"></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/network_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ data "stackit_network_interface" "example" {
- `name` (String) The name of the network interface.
- `security` (Boolean) The Network Interface Security. If set to false, then no security groups will apply to this network interface.
- `security_group_ids` (List of String) The list of security group UUIDs. If security is set to false, setting this field will lead to an error.
- `type` (String) Type of network interface. Some of the possible values are: Supported values are: `server`, `metadata`, `gateway`.
- `type` (String) Type of network interface. Some of the possible values are: Possible values are: `server`, `metadata`, `gateway`.
2 changes: 1 addition & 1 deletion docs/data-sources/security_group_rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ data "stackit_security_group_rule" "example" {
### Read-Only

- `description` (String) The description of the security group rule.
- `direction` (String) The direction of the traffic which the rule should match. Some of the possible values are: Supported values are: `ingress`, `egress`.
- `direction` (String) The direction of the traffic which the rule should match. Some of the possible values are: Possible values are: `ingress`, `egress`.
- `ether_type` (String) The ethertype which the rule should match.
- `icmp_parameters` (Attributes) ICMP Parameters. (see [below for nested schema](#nestedatt--icmp_parameters))
- `id` (String) Terraform's internal datasource ID. It is structured as "`project_id`,`security_group_id`,`security_group_rule_id`".
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ data "stackit_volume" "example" {
Read-Only:

- `id` (String) The ID of the source, e.g. image ID
- `type` (String) The type of the source. Supported values are: `volume`, `image`, `snapshot`, `backup`.
- `type` (String) The type of the source. Possible values are: `volume`, `image`, `snapshot`, `backup`.
2 changes: 1 addition & 1 deletion docs/resources/cdn_distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Optional:
Required:

- `origin_url` (String) The configured backend type for the distribution
- `type` (String) The configured backend type. Supported values are: `http`.
- `type` (String) The configured backend type. Possible values are: `http`.

Optional:

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/dns_zone.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {
- `primaries` (List of String) Primary name server for secondary zone. E.g. ["1.2.3.4"]
- `refresh_time` (Number) Refresh time. E.g. 3600
- `retry_time` (Number) Retry time. E.g. 600
- `type` (String) Zone type. Defaults to `primary`. Supported values are: `primary`, `secondary`.
- `type` (String) Zone type. Defaults to `primary`. Possible values are: `primary`, `secondary`.

### Read-Only

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/loadbalancer.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ import {
Required:

- `port` (Number) Port number where we listen for traffic.
- `protocol` (String) Protocol is the highest network protocol we understand to load balance. Supported values are: `PROTOCOL_UNSPECIFIED`, `PROTOCOL_TCP`, `PROTOCOL_UDP`, `PROTOCOL_TCP_PROXY`, `PROTOCOL_TLS_PASSTHROUGH`.
- `protocol` (String) Protocol is the highest network protocol we understand to load balance. Possible values are: `PROTOCOL_UNSPECIFIED`, `PROTOCOL_TCP`, `PROTOCOL_UDP`, `PROTOCOL_TCP_PROXY`, `PROTOCOL_TLS_PASSTHROUGH`.
- `target_pool` (String) Reference target pool by target pool name.

Optional:
Expand Down Expand Up @@ -295,7 +295,7 @@ Optional:
Required:

- `network_id` (String) Openstack network ID.
- `role` (String) The role defines how the load balancer is using the network. Supported values are: `ROLE_UNSPECIFIED`, `ROLE_LISTENERS_AND_TARGETS`, `ROLE_LISTENERS`, `ROLE_TARGETS`.
- `role` (String) The role defines how the load balancer is using the network. Possible values are: `ROLE_UNSPECIFIED`, `ROLE_LISTENERS_AND_TARGETS`, `ROLE_LISTENERS`, `ROLE_TARGETS`.


<a id="nestedatt--target_pools"></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/mongodbflex_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Read-Only:
Required:

- `point_in_time_window_hours` (Number) The number of hours back in time the point-in-time recovery feature will be able to recover.
- `type` (String) Type of the MongoDB Flex instance. Supported values are: `Replica`, `Sharded`, `Single`.
- `type` (String) Type of the MongoDB Flex instance. Possible values are: `Replica`, `Sharded`, `Single`.

Optional:

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/network_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ import {
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`network_id`,`network_interface_id`".
- `mac` (String) The MAC address of network interface.
- `network_interface_id` (String) The network interface ID.
- `type` (String) Type of network interface. Some of the possible values are: Supported values are: `server`, `metadata`, `gateway`.
- `type` (String) Type of network interface. Some of the possible values are: Possible values are: `server`, `metadata`, `gateway`.
2 changes: 1 addition & 1 deletion docs/resources/postgresflex_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {

- `instance_id` (String) ID of the PostgresFlex instance.
- `project_id` (String) STACKIT project ID to which the instance is associated.
- `roles` (Set of String) Database access levels for the user. Supported values are: `login`, `createdb`.
- `roles` (Set of String) Database access levels for the user. Possible values are: `login`, `createdb`.
- `username` (String)

### Optional
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/security_group_rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {

### Required

- `direction` (String) The direction of the traffic which the rule should match. Some of the possible values are: Supported values are: `ingress`, `egress`.
- `direction` (String) The direction of the traffic which the rule should match. Some of the possible values are: Possible values are: `ingress`, `egress`.
- `project_id` (String) STACKIT project ID to which the security group rule is associated.
- `security_group_id` (String) The security group ID.

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ import {
- `affinity_group` (String) The affinity group the server is assigned to.
- `availability_zone` (String) The availability zone of the server.
- `boot_volume` (Attributes) The boot volume for the server (see [below for nested schema](#nestedatt--boot_volume))
- `desired_status` (String) The desired status of the server resource. Supported values are: `active`, `inactive`, `deallocated`.
- `desired_status` (String) The desired status of the server resource. Possible values are: `active`, `inactive`, `deallocated`.
- `image_id` (String) The image ID to be used for an ephemeral disk on the server.
- `keypair_name` (String) The name of the keypair used during server creation.
- `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container
Expand All @@ -427,7 +427,7 @@ import {
Required:

- `source_id` (String) The ID of the source, either image ID or volume ID
- `source_type` (String) The type of the source. Supported values are: `volume`, `image`.
- `source_type` (String) The type of the source. Possible values are: `volume`, `image`.

Optional:

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ import {
Required:

- `id` (String) The ID of the source, e.g. image ID
- `type` (String) The type of the source. Supported values are: `volume`, `image`, `snapshot`, `backup`.
- `type` (String) The type of the source. Possible values are: `volume`, `image`, `snapshot`, `backup`.
2 changes: 1 addition & 1 deletion stackit/internal/services/cdn/distribution/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (r *distributionDataSource) Schema(_ context.Context, _ datasource.SchemaRe
Attributes: map[string]schema.Attribute{
"type": schema.StringAttribute{
Computed: true,
Description: schemaDescriptions["config_backend_type"] + utils.SupportedValuesDocumentation(backendOptions),
Description: schemaDescriptions["config_backend_type"] + utils.FormatPossibleValues(backendOptions...),
},
"origin_url": schema.StringAttribute{
Computed: true,
Expand Down
2 changes: 1 addition & 1 deletion stackit/internal/services/cdn/distribution/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (r *distributionResource) Schema(_ context.Context, _ resource.SchemaReques
Attributes: map[string]schema.Attribute{
"type": schema.StringAttribute{
Required: true,
Description: schemaDescriptions["config_backend_type"] + utils.SupportedValuesDocumentation(backendOptions),
Description: schemaDescriptions["config_backend_type"] + utils.FormatPossibleValues(backendOptions...),
Validators: []validator.String{stringvalidator.OneOf(backendOptions...)},
},
"origin_url": schema.StringAttribute{
Expand Down
2 changes: 1 addition & 1 deletion stackit/internal/services/dns/zone/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (r *zoneResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
},
},
"type": schema.StringAttribute{
Description: "Zone type. Defaults to `primary`. " + utils.SupportedValuesDocumentation(primaryOptions),
Description: "Zone type. Defaults to `primary`. " + utils.FormatPossibleValues(primaryOptions...),
Optional: true,
Computed: true,
Default: stringdefault.StaticString("primary"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (d *networkInterfaceDataSource) Schema(_ context.Context, _ datasource.Sche
ElementType: types.StringType,
},
"type": schema.StringAttribute{
Description: "Type of network interface. Some of the possible values are: " + utils.SupportedValuesDocumentation(typeOptions),
Description: "Type of network interface. Some of the possible values are: " + utils.FormatPossibleValues(typeOptions...),
Computed: true,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (r *networkInterfaceResource) Schema(_ context.Context, _ resource.SchemaRe
},
},
"type": schema.StringAttribute{
Description: "Type of network interface. Some of the possible values are: " + utils.SupportedValuesDocumentation(typeOptions),
Description: "Type of network interface. Some of the possible values are: " + utils.FormatPossibleValues(typeOptions...),
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (r *securityGroupRuleDataSource) Schema(_ context.Context, _ datasource.Sch
},
},
"direction": schema.StringAttribute{
Description: "The direction of the traffic which the rule should match. Some of the possible values are: " + utils.SupportedValuesDocumentation(directionOptions),
Description: "The direction of the traffic which the rule should match. Some of the possible values are: " + utils.FormatPossibleValues(directionOptions...),
Computed: true,
},
"description": schema.StringAttribute{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (r *securityGroupRuleResource) Schema(_ context.Context, _ resource.SchemaR
},
},
"direction": schema.StringAttribute{
Description: "The direction of the traffic which the rule should match. Some of the possible values are: " + utils.SupportedValuesDocumentation(directionOptions),
Description: "The direction of the traffic which the rule should match. Some of the possible values are: " + utils.FormatPossibleValues(directionOptions...),
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
Expand Down
4 changes: 2 additions & 2 deletions stackit/internal/services/iaas/server/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (r *serverResource) Schema(_ context.Context, _ resource.SchemaRequest, res
},
},
"source_type": schema.StringAttribute{
Description: "The type of the source. " + utils.SupportedValuesDocumentation(supportedSourceTypes),
Description: "The type of the source. " + utils.FormatPossibleValues(supportedSourceTypes...),
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
Expand Down Expand Up @@ -366,7 +366,7 @@ func (r *serverResource) Schema(_ context.Context, _ resource.SchemaRequest, res
Computed: true,
},
"desired_status": schema.StringAttribute{
Description: "The desired status of the server resource. " + utils.SupportedValuesDocumentation(desiredStatusOptions),
Description: "The desired status of the server resource. " + utils.FormatPossibleValues(desiredStatusOptions...),
Optional: true,
Validators: []validator.String{
stringvalidator.OneOf(desiredStatusOptions...),
Expand Down
2 changes: 1 addition & 1 deletion stackit/internal/services/iaas/volume/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (r *volumeDataSource) Schema(_ context.Context, _ datasource.SchemaRequest,
Computed: true,
Attributes: map[string]schema.Attribute{
"type": schema.StringAttribute{
Description: "The type of the source. " + utils.SupportedValuesDocumentation(SupportedSourceTypes),
Description: "The type of the source. " + utils.FormatPossibleValues(SupportedSourceTypes...),
Computed: true,
},
"id": schema.StringAttribute{
Expand Down
2 changes: 1 addition & 1 deletion stackit/internal/services/iaas/volume/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (r *volumeResource) Schema(_ context.Context, _ resource.SchemaRequest, res
},
Attributes: map[string]schema.Attribute{
"type": schema.StringAttribute{
Description: "The type of the source. " + utils.SupportedValuesDocumentation(SupportedSourceTypes),
Description: "The type of the source. " + utils.FormatPossibleValues(SupportedSourceTypes...),
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,13 @@ func (r *loadBalancerResource) Schema(_ context.Context, _ resource.SchemaReques
"disable_security_group_assignment": "If set to true, this will disable the automatic assignment of a security group to the load balancer's targets. This option is primarily used to allow targets that are not within the load balancer's own network or SNA (STACKIT network area). When this is enabled, you are fully responsible for ensuring network connectivity to the targets, including managing all routing and security group rules manually. This setting cannot be changed after the load balancer is created.",
"listeners": "List of all listeners which will accept traffic. Limited to 20.",
"port": "Port number where we listen for traffic.",
"protocol": "Protocol is the highest network protocol we understand to load balance. " + utils.SupportedValuesDocumentation(protocolOptions),
"protocol": "Protocol is the highest network protocol we understand to load balance. " + utils.FormatPossibleValues(protocolOptions...),
"target_pool": "Reference target pool by target pool name.",
"name": "Load balancer name.",
"plan_id": "The service plan ID. If not defined, the default service plan is `p10`. " + utils.FormatPossibleValues(servicePlanOptions...),
"networks": "List of networks that listeners and targets reside in.",
"network_id": "Openstack network ID.",
"role": "The role defines how the load balancer is using the network. " + utils.SupportedValuesDocumentation(roleOptions),
"role": "The role defines how the load balancer is using the network. " + utils.FormatPossibleValues(roleOptions...),
"observability": "We offer Load Balancer metrics observability via ARGUS or external solutions. Not changeable after creation.",
"observability_logs": "Observability logs configuration. Not changeable after creation.",
"observability_logs_credentials_ref": "Credentials reference for logs. Not changeable after creation.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
"acl": "The Access Control List (ACL) for the MongoDB Flex instance.",
"backup_schedule": `The backup schedule. Should follow the cron scheduling system format (e.g. "0 0 * * *").`,
"options": "Custom parameters for the MongoDB Flex instance.",
"type": fmt.Sprintf("Type of the MongoDB Flex instance. %s", utils.SupportedValuesDocumentation(typeOptions)),
"type": fmt.Sprintf("Type of the MongoDB Flex instance. %s", utils.FormatPossibleValues(typeOptions...)),
"snapshot_retention_days": "The number of days that continuous backups (controlled via the `backup_schedule`) will be retained.",
"daily_snapshot_retention_days": "The number of days that daily backups will be retained.",
"weekly_snapshot_retention_weeks": "The number of weeks that weekly backups will be retained.",
Expand Down
2 changes: 1 addition & 1 deletion stackit/internal/services/postgresflex/user/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (r *userResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
"user_id": "User ID.",
"instance_id": "ID of the PostgresFlex instance.",
"project_id": "STACKIT project ID to which the instance is associated.",
"roles": "Database access levels for the user. " + utils.SupportedValuesDocumentation(rolesOptions),
"roles": "Database access levels for the user. " + utils.FormatPossibleValues(rolesOptions...),
"region": "The resource region. If not defined, the provider region is used.",
}

Expand Down
14 changes: 0 additions & 14 deletions stackit/internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,6 @@ func ConvertPointerSliceToStringSlice(pointerSlice []*string) []string {
}
return stringSlice
}
func SupportedValuesDocumentation(values []string) string {
if len(values) == 0 {
return ""
}
return "Supported values are: " + strings.Join(QuoteValues(values), ", ") + "."
}

func QuoteValues(values []string) []string {
quotedValues := make([]string, len(values))
for i, value := range values {
quotedValues[i] = fmt.Sprintf("`%s`", value)
}
return quotedValues
}

func IsLegacyProjectRole(role string) bool {
return utils.Contains(LegacyProjectRoles, role)
Expand Down
33 changes: 0 additions & 33 deletions stackit/internal/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,39 +253,6 @@ func TestSimplifyBackupSchedule(t *testing.T) {
}
}

func TestSupportedValuesDocumentation(t *testing.T) {
tests := []struct {
description string
values []string
expected string
}{
{
"empty values",
[]string{},
"",
},
{
"single value",
[]string{"value"},
"Supported values are: `value`.",
},
{
"multiple values",
[]string{"value1", "value2", "value3"},
"Supported values are: `value1`, `value2`, `value3`.",
},
}

for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
output := SupportedValuesDocumentation(tt.values)
if output != tt.expected {
t.Fatalf("Data does not match: %s", output)
}
})
}
}

func TestIsLegacyProjectRole(t *testing.T) {
tests := []struct {
description string
Expand Down
Loading