diff --git a/client/platform.go b/client/platform.go index 57d5de7..5afdd3d 100644 --- a/client/platform.go +++ b/client/platform.go @@ -36,6 +36,17 @@ type MeshPlatformSpec struct { ContributingWorkspaces []string `json:"contributingWorkspaces" tfsdk:"contributing_workspaces"` Availability PlatformAvailability `json:"availability" tfsdk:"availability"` Config PlatformConfig `json:"config" tfsdk:"config"` + QuotaDefinitions []QuotaDefinition `json:"quotaDefinitions" tfsdk:"quota_definitions"` +} + +type QuotaDefinition struct { + QuotaKey string `json:"quotaKey" tfsdk:"quota_key"` + MinValue int `json:"minValue" tfsdk:"min_value"` + MaxValue int `json:"maxValue" tfsdk:"max_value"` + Unit string `json:"unit" tfsdk:"unit"` + AutoApprovalThreshold int `json:"autoApprovalThreshold" tfsdk:"auto_approval_threshold"` + Description string `json:"description" tfsdk:"description"` + Label string `json:"label" tfsdk:"label"` } type LocationRef struct { diff --git a/docs/data-sources/platform.md b/docs/data-sources/platform.md index 432df81..bad0476 100644 --- a/docs/data-sources/platform.md +++ b/docs/data-sources/platform.md @@ -51,6 +51,10 @@ Read-Only: ### Nested Schema for `spec` +Required: + +- `quota_definitions` (List of Object) List of quota definitions for the platform. (see [below for nested schema](#nestedatt--spec--quota_definitions)) + Read-Only: - `availability` (Attributes) Availability configuration for the meshPlatform. (see [below for nested schema](#nestedatt--spec--availability)) @@ -63,6 +67,20 @@ Read-Only: - `location_ref` (Attributes) Reference to the location where this platform is situated. (see [below for nested schema](#nestedatt--spec--location_ref)) - `support_url` (String) URL for platform support documentation. + +### Nested Schema for `spec.quota_definitions` + +Read-Only: + +- `auto_approval_threshold` (Number) +- `description` (String) +- `label` (String) +- `max_value` (Number) +- `min_value` (Number) +- `quota_key` (String) +- `unit` (String) + + ### Nested Schema for `spec.availability` diff --git a/docs/resources/platform.md b/docs/resources/platform.md index 2ae9440..2ce53bd 100644 --- a/docs/resources/platform.md +++ b/docs/resources/platform.md @@ -41,6 +41,8 @@ resource "meshstack_platform" "example" { restricted_to_workspaces = [] } + quota_definitions = [] + config = { azure = { entra_tenant = "dev-mycompany.onmicrosoft.com" @@ -189,6 +191,7 @@ Required: - `display_name` (String) The human-readable display name of the meshPlatform. - `endpoint` (String) The web console URL endpoint of the platform. - `location_ref` (Attributes) Reference to the location where this platform is situated. (see [below for nested schema](#nestedatt--spec--location_ref)) +- `quota_definitions` (List of Object) List of quota definitions for the platform. (see [below for nested schema](#nestedatt--spec--quota_definitions)) Optional: @@ -849,6 +852,20 @@ Read-Only: - `kind` (String) meshObject type, always `meshLocation`. + + +### Nested Schema for `spec.quota_definitions` + +Required: + +- `auto_approval_threshold` (Number) +- `description` (String) +- `label` (String) +- `max_value` (Number) +- `min_value` (Number) +- `quota_key` (String) +- `unit` (String) + ## Import Import is supported using the following syntax: diff --git a/examples/resources/meshstack_platform/resource.tf b/examples/resources/meshstack_platform/resource.tf index 6bea16f..88ac15c 100644 --- a/examples/resources/meshstack_platform/resource.tf +++ b/examples/resources/meshstack_platform/resource.tf @@ -20,6 +20,8 @@ resource "meshstack_platform" "example" { restricted_to_workspaces = [] } + quota_definitions = [] + config = { azure = { entra_tenant = "dev-mycompany.onmicrosoft.com" diff --git a/internal/provider/platform_data_source.go b/internal/provider/platform_data_source.go index f4e8bb7..12df4cd 100644 --- a/internal/provider/platform_data_source.go +++ b/internal/provider/platform_data_source.go @@ -7,6 +7,7 @@ import ( "github.com/meshcloud/terraform-provider-meshstack/client" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/path" @@ -164,6 +165,22 @@ func (d *platformDataSource) Schema(_ context.Context, _ datasource.SchemaReques }, }, }, + "quota_definitions": schema.ListAttribute{ + MarkdownDescription: "List of quota definitions for the platform.", + Required: true, + Sensitive: false, + ElementType: types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "quota_key": types.StringType, + "label": types.StringType, + "description": types.StringType, + "unit": types.StringType, + "min_value": types.Int64Type, + "max_value": types.Int64Type, + "auto_approval_threshold": types.Int64Type, + }, + }, + }, "config": schema.SingleNestedAttribute{ MarkdownDescription: "Platform-specific configuration options.", Computed: true, diff --git a/internal/provider/platform_resource.go b/internal/provider/platform_resource.go index 430bf79..089e905 100644 --- a/internal/provider/platform_resource.go +++ b/internal/provider/platform_resource.go @@ -212,6 +212,22 @@ func (r *platformResource) Schema(_ context.Context, _ resource.SchemaRequest, r }, }, }, + "quota_definitions": schema.ListAttribute{ + MarkdownDescription: "List of quota definitions for the platform.", + Required: true, + Sensitive: false, + ElementType: types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "quota_key": types.StringType, + "label": types.StringType, + "description": types.StringType, + "unit": types.StringType, + "min_value": types.Int64Type, + "max_value": types.Int64Type, + "auto_approval_threshold": types.Int64Type, + }, + }, + }, "config": schema.SingleNestedAttribute{ MarkdownDescription: "Platform-specific configuration settings.", Required: true,