Skip to content

Commit

Permalink
feat(application): define schema for storage flag in application reso…
Browse files Browse the repository at this point in the history
…urce

This commit extends the application schema to support the storage flag in the Terraform provider for Juju.
The schema now includes varios attributes for configuring the storage constraints of a Juju application.
  • Loading branch information
anvial committed Jun 7, 2024
1 parent 28bb8d2 commit 12f3b91
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions internal/provider/resource_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package provider
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier"
"strings"

"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
Expand Down Expand Up @@ -164,6 +165,34 @@ func (r *applicationResource) Schema(_ context.Context, _ resource.SchemaRequest
stringplanmodifier.UseStateForUnknown(),
},
},
"storage": schema.SetNestedAttribute{
Description: "Configure storage constraints for the juju application.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"label": schema.StringAttribute{
Description: "The specific storage option defined in the charm.",
Required: true,
},
"size": schema.StringAttribute{
Description: "The size of each volume. E.g. 100G.",
Required: true,
},
"pool": schema.StringAttribute{
Description: "Name of the storage pool to use. E.g. ebs on aws.",
Optional: true,
},
"count": schema.Int64Attribute{
Description: "The number of volumes.",
Optional: true,
},
},
PlanModifiers: []planmodifier.Object{
objectplanmodifier.RequiresReplaceIfConfigured(),
objectplanmodifier.UseStateForUnknown(),
},
},
},
"trust": schema.BoolAttribute{
Description: "Set the trust for the application.",
Optional: true,
Expand Down

0 comments on commit 12f3b91

Please sign in to comment.