Skip to content

Commit 78cf4fe

Browse files
committed
feat: quotas in landing zone data source
1 parent 872e4f8 commit 78cf4fe

File tree

2 files changed

+33
-9
lines changed

2 files changed

+33
-9
lines changed

client/landingzone.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,27 @@ type MeshLandingZoneMetadata struct {
2525
}
2626

2727
type MeshLandingZoneSpec struct {
28-
DisplayName string `json:"displayName" tfsdk:"display_name"`
29-
Description string `json:"description" tfsdk:"description"`
30-
AutomateDeletionApproval bool `json:"automateDeletionApproval" tfsdk:"automate_deletion_approval"`
31-
AutomateDeletionReplication bool `json:"automateDeletionReplication" tfsdk:"automate_deletion_replication"`
32-
InfoLink *string `json:"infoLink,omitempty" tfsdk:"info_link"`
33-
PlatformRef PlatformRef `json:"platformRef" tfsdk:"platform_ref"`
34-
PlatformProperties *PlatformProperties `json:"platformProperties,omitempty" tfsdk:"platform_properties"`
28+
DisplayName string `json:"displayName" tfsdk:"display_name"`
29+
Description string `json:"description" tfsdk:"description"`
30+
AutomateDeletionApproval bool `json:"automateDeletionApproval" tfsdk:"automate_deletion_approval"`
31+
AutomateDeletionReplication bool `json:"automateDeletionReplication" tfsdk:"automate_deletion_replication"`
32+
InfoLink *string `json:"infoLink,omitempty" tfsdk:"info_link"`
33+
PlatformRef MeshLandingZonePlatformRef `json:"platformRef" tfsdk:"platform_ref"`
34+
PlatformProperties *MeshLandingZonePlatformProperties `json:"platformProperties,omitempty" tfsdk:"platform_properties"`
35+
Quotas []MeshLandingZoneQuota `json:"quotas" tfsdk:"quotas"`
3536
}
3637

3738
type MeshLandingZoneStatus struct {
3839
Disabled bool `json:"disabled" tfsdk:"disabled"`
3940
Restricted bool `json:"restricted" tfsdk:"restricted"`
4041
}
4142

42-
type PlatformRef struct {
43+
type MeshLandingZonePlatformRef struct {
4344
Uuid string `json:"uuid" tfsdk:"uuid"`
4445
Kind string `json:"kind" tfsdk:"kind"`
4546
}
4647

47-
type PlatformProperties struct {
48+
type MeshLandingZonePlatformProperties struct {
4849
Type string `json:"type" tfsdk:"type"`
4950
Aws *AwsPlatformProperties `json:"aws" tfsdk:"aws"`
5051
Aks *AksPlatformProperties `json:"aks" tfsdk:"aks"`
@@ -55,6 +56,11 @@ type PlatformProperties struct {
5556
OpenShift *OpenShiftPlatformProperties `json:"openshift" tfsdk:"openshift"`
5657
}
5758

59+
type MeshLandingZoneQuota struct {
60+
Key string `json:"key" tfsdk:"key"`
61+
Value int64 `json:"value" tfsdk:"value"`
62+
}
63+
5864
type MeshLandingZoneCreate struct {
5965
ApiVersion string `json:"apiVersion" tfsdk:"api_version"`
6066
Metadata MeshLandingZoneMetadata `json:"metadata" tfsdk:"metadata"`

internal/provider/landingzone_data_source.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import (
77
"github.com/meshcloud/terraform-provider-meshstack/client"
88

99
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
10+
"github.com/hashicorp/terraform-plugin-framework/attr"
1011
"github.com/hashicorp/terraform-plugin-framework/datasource"
1112
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
1213
"github.com/hashicorp/terraform-plugin-framework/path"
14+
"github.com/hashicorp/terraform-plugin-framework/resource/schema/listdefault"
1315
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
1416
"github.com/hashicorp/terraform-plugin-framework/types"
1517
)
@@ -122,6 +124,22 @@ func (d *landingZoneDataSource) Schema(_ context.Context, _ datasource.SchemaReq
122124
},
123125
},
124126
},
127+
"quotas": schema.ListNestedAttribute{
128+
MarkdownDescription: "Quota definitions for this landing zone.",
129+
Computed: true,
130+
NestedObject: schema.NestedAttributeObject{
131+
Attributes: map[string]schema.Attribute{
132+
"key": schema.StringAttribute{
133+
MarkdownDescription: "Quota key identifier.",
134+
Computed: true,
135+
},
136+
"value": schema.Int64Attribute{
137+
MarkdownDescription: "Quota value.",
138+
Computed: true,
139+
},
140+
},
141+
},
142+
},
125143
},
126144
},
127145

0 commit comments

Comments
 (0)