Skip to content

Commit

Permalink
Define schema for storage flag in Terraform provider
Browse files Browse the repository at this point in the history
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 May 29, 2024
1 parent 28bb8d2 commit aa0ccbd
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 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 aa0ccbd

Please sign in to comment.