Skip to content

Commit 4193004

Browse files
committed
fix: replace schema resources on value change
We actually just create a new resource within hive everytime, using terraform for this still feels like a hack.
1 parent ff869c7 commit 4193004

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Fixed
2+
body: Replace schema resources on value change
3+
time: 2025-02-23T13:00:10.24429+01:00

internal/provider/resource_schema_check.go

+12
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,30 @@ func (r *HiveSchemaCheckResource) Schema(ctx context.Context, req resource.Schem
5252
"service": schema.StringAttribute{
5353
MarkdownDescription: "The service name",
5454
Required: true,
55+
PlanModifiers: []planmodifier.String{
56+
stringplanmodifier.RequiresReplace(),
57+
},
5558
},
5659
"commit": schema.StringAttribute{
5760
MarkdownDescription: "The commit or version identifier",
5861
Optional: true,
62+
PlanModifiers: []planmodifier.String{
63+
stringplanmodifier.RequiresReplace(),
64+
},
5965
},
6066
"schema": schema.StringAttribute{
6167
MarkdownDescription: "The GraphQL schema content",
6268
Required: true,
69+
PlanModifiers: []planmodifier.String{
70+
stringplanmodifier.RequiresReplace(),
71+
},
6372
},
6473
"author": schema.StringAttribute{
6574
MarkdownDescription: "The author of the version",
6675
Optional: true,
76+
PlanModifiers: []planmodifier.String{
77+
stringplanmodifier.RequiresReplace(),
78+
},
6779
},
6880
"id": schema.StringAttribute{
6981
Computed: true,

internal/provider/resource_schema_publish.go

+15
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,37 @@ func (r *HiveSchemaPublishResource) Schema(ctx context.Context, req resource.Sch
5353
"service": schema.StringAttribute{
5454
MarkdownDescription: "The service name",
5555
Required: true,
56+
PlanModifiers: []planmodifier.String{
57+
stringplanmodifier.RequiresReplace(),
58+
},
5659
},
5760
"commit": schema.StringAttribute{
5861
MarkdownDescription: "The commit or version identifier",
5962
Optional: true,
63+
PlanModifiers: []planmodifier.String{
64+
stringplanmodifier.RequiresReplace(),
65+
},
6066
},
6167
"author": schema.StringAttribute{
6268
MarkdownDescription: "The author of the version",
6369
Optional: true,
70+
PlanModifiers: []planmodifier.String{
71+
stringplanmodifier.RequiresReplace(),
72+
},
6473
},
6574
"schema": schema.StringAttribute{
6675
MarkdownDescription: "The GraphQL schema content",
6776
Required: true,
77+
PlanModifiers: []planmodifier.String{
78+
stringplanmodifier.RequiresReplace(),
79+
},
6880
},
6981
"url": schema.StringAttribute{
7082
MarkdownDescription: "The GraphQL schema content",
7183
Required: true,
84+
PlanModifiers: []planmodifier.String{
85+
stringplanmodifier.RequiresReplace(),
86+
},
7287
},
7388
"id": schema.StringAttribute{
7489
Computed: true,

0 commit comments

Comments
 (0)