Skip to content

Commit

Permalink
API Key: refresh Disabled state
Browse files Browse the repository at this point in the history
  • Loading branch information
briankassouf committed Dec 3, 2024
1 parent b2519c9 commit fdc73e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/provider/apikey_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"time"

"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"
Expand Down Expand Up @@ -126,6 +127,8 @@ func (r *apiKeyResource) Schema(ctx context.Context, _ resource.SchemaRequest, r
"disabled": schema.BoolAttribute{
Description: "Whether the API key is disabled.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
},
Blocks: map[string]schema.Block{
Expand Down Expand Up @@ -373,6 +376,7 @@ func updateApiKeyModelFromSpec(state *apiKeyResourceModel, apikey *identityv1.Ap
state.Description = types.StringValue(apikey.GetSpec().GetDescription())
}
state.ExpiryTime = types.StringValue(apikey.GetSpec().GetExpiryTime().AsTime().Format(time.RFC3339))
state.Disabled = types.BoolValue(apikey.GetSpec().GetDisabled())

return nil
}

0 comments on commit fdc73e1

Please sign in to comment.