We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 11d2ab5 commit ab53e8fCopy full SHA for ab53e8f
internal/kibana/synthetics/create.go
@@ -34,7 +34,7 @@ func (r *Resource) Create(ctx context.Context, request resource.CreateRequest, r
34
return
35
}
36
37
- plan, diags = plan.toModelV0(ctx, result)
+ plan, diags = plan.toModelV0(ctx, result, namespace)
38
response.Diagnostics.Append(diags...)
39
if response.Diagnostics.HasError() {
40
internal/kibana/synthetics/read.go
@@ -42,7 +42,7 @@ func (r *Resource) Read(ctx context.Context, request resource.ReadRequest, respo
42
43
44
45
- state, diags = state.toModelV0(ctx, result)
+ state, diags = state.toModelV0(ctx, result, namespace)
46
47
48
internal/kibana/synthetics/schema.go
@@ -583,7 +583,7 @@ func stringToInt64(v string) (int64, error) {
583
return res, err
584
585
586
-func (v *tfModelV0) toModelV0(ctx context.Context, api *kbapi.SyntheticsMonitor) (*tfModelV0, diag.Diagnostics) {
+func (v *tfModelV0) toModelV0(ctx context.Context, api *kbapi.SyntheticsMonitor, spaceID string) (*tfModelV0, diag.Diagnostics) {
587
var schedule int64
588
var err error
589
dg := diag.Diagnostics{}
@@ -657,7 +657,7 @@ func (v *tfModelV0) toModelV0(ctx context.Context, api *kbapi.SyntheticsMonitor)
657
658
659
resourceID := clients.CompositeId{
660
- ClusterId: api.Namespace,
+ ClusterId: spaceID,
661
ResourceId: string(api.Id),
662
663
@@ -669,7 +669,7 @@ func (v *tfModelV0) toModelV0(ctx context.Context, api *kbapi.SyntheticsMonitor)
669
return &tfModelV0{
670
ID: types.StringValue(resourceID.String()),
671
Name: types.StringValue(api.Name),
672
- SpaceID: types.StringValue(api.Namespace),
+ SpaceID: types.StringValue(spaceID),
673
Namespace: types.StringValue(api.Namespace),
674
Schedule: types.Int64Value(schedule),
675
Locations: v.Locations,
internal/kibana/synthetics/schema_test.go
@@ -406,7 +406,8 @@ func TestToModelV0(t *testing.T) {
406
for _, tt := range testcases {
407
t.Run(tt.name, func(t *testing.T) {
408
ctx := context.Background()
409
- model, diag := tt.expected.toModelV0(ctx, &tt.input)
+ expectedSpaceID := tt.expected.SpaceID.ValueString()
410
+ model, diag := tt.expected.toModelV0(ctx, &tt.input, expectedSpaceID)
411
assert.False(t, diag.HasError())
412
assert.Equal(t, &tt.expected, model)
413
})
@@ -831,7 +832,8 @@ func TestToModelV0MergeAttributes(t *testing.T) {
831
832
833
834
- actual, diag := tt.state.toModelV0(ctx, &tt.input)
835
836
+ actual, diag := tt.state.toModelV0(ctx, &tt.input, expectedSpaceID)
837
838
assert.NotNil(t, actual)
839
assert.Equal(t, &tt.expected, actual)
internal/kibana/synthetics/update.go
@@ -41,7 +41,7 @@ func (r *Resource) Update(ctx context.Context, request resource.UpdateRequest, r
41
0 commit comments