Skip to content

Commit be412fb

Browse files
authored
Merge pull request #15 from netdata/fix/import-space-claim-id
fix: empty claim token when importing space
2 parents d9d363f + df28377 commit be412fb

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.1.1
2+
3+
BUGFIXES:
4+
5+
- empty claim token when importing space
6+
17
## 0.1.0
28

39
Initial version.

internal/provider/space_resource.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ func (s *spaceResource) Read(ctx context.Context, req resource.ReadRequest, resp
164164
return
165165
}
166166

167+
if state.ClaimToken.IsNull() {
168+
tflog.Info(ctx, "Creating Claim Token for Space ID: "+spaceInfo.ID)
169+
claimToken, err := s.client.GetSpaceClaimToken(spaceInfo.ID)
170+
if err != nil {
171+
resp.Diagnostics.AddError(
172+
"Error Creating Claim Token",
173+
"Could Not Create Claim Token for Space ID: "+spaceInfo.ID+": err: "+err.Error(),
174+
)
175+
return
176+
}
177+
state.ClaimToken = types.StringValue(*claimToken)
178+
}
179+
167180
state.Name = types.StringValue(spaceInfo.Name)
168181
state.Description = types.StringValue(spaceInfo.Description)
169182
diags = resp.State.Set(ctx, &state)

0 commit comments

Comments
 (0)