Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kql_database): deprecate token and add token_wo #281

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/unreleased/changed-20250304-204546.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: changed
body: Introduction of the write-only attribute for Invitation Token in the KQL Database resource.
time: 2025-03-04T20:45:46.9774432-08:00
custom:
Issue: "281"
4 changes: 3 additions & 1 deletion docs/resources/kql_database.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ Required:

Optional:

- `invitation_token` (String, Sensitive) Invitation token to follow the source database. Only allowed when `database_type` is `Shortcut`.
- `invitation_token` (String, Sensitive, Deprecated) Invitation token to follow the source database. Only allowed when `database_type` is `Shortcut`.
- `invitation_token_wo` (String, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Invitation token (WO) to follow the source database. Only allowed when `database_type` is `Shortcut`.
- `invitation_token_wo_version` (Number) The version of the `invitation_token_wo`
- `source_cluster_uri` (String) The URI of the source Eventhouse or Azure Data Explorer cluster. Only allowed when `database_type` is `Shortcut`.
- `source_database_name` (String) The name of the database to follow in the source Eventhouse or Azure Data Explorer cluster. Only allowed when `database_type` is `Shortcut`.

Expand Down
12 changes: 0 additions & 12 deletions internal/pkg/fabricitem/resource_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ func (r *ResourceFabricItem) Create(ctx context.Context, req resource.CreateRequ
tflog.Debug(ctx, "CREATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "CREATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
})

var plan resourceFabricItemModel

Expand Down Expand Up @@ -172,11 +168,6 @@ func (r *ResourceFabricItem) Update(ctx context.Context, req resource.UpdateRequ
tflog.Debug(ctx, "UPDATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "UPDATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

var plan resourceFabricItemModel

Expand Down Expand Up @@ -219,9 +210,6 @@ func (r *ResourceFabricItem) Delete(ctx context.Context, req resource.DeleteRequ
tflog.Debug(ctx, "DELETE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "DELETE", map[string]any{
"state": req.State,
})

var state resourceFabricItemModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ func (r *ResourceFabricItemConfigDefinitionProperties[Ttfprop, Titemprop, Ttfcon
tflog.Debug(ctx, "MODIFY PLAN", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "MODIFY PLAN", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

if !req.State.Raw.IsNull() && !req.Plan.Raw.IsNull() {
var plan, state ResourceFabricItemConfigDefinitionPropertiesModel[Ttfprop, Titemprop, Ttfconfig, Titemconfig]
Expand Down Expand Up @@ -142,12 +137,12 @@ func (r *ResourceFabricItemConfigDefinitionProperties[Ttfprop, Titemprop, Ttfcon
tflog.Debug(ctx, "CREATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "CREATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
})

var plan ResourceFabricItemConfigDefinitionPropertiesModel[Ttfprop, Titemprop, Ttfconfig, Titemconfig]
var plan, config ResourceFabricItemConfigDefinitionPropertiesModel[Ttfprop, Titemprop, Ttfconfig, Titemconfig]

if resp.Diagnostics.Append(req.Config.Get(ctx, &config)...); resp.Diagnostics.HasError() {
return
}

if resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...); resp.Diagnostics.HasError() {
return
Expand All @@ -171,7 +166,7 @@ func (r *ResourceFabricItemConfigDefinitionProperties[Ttfprop, Titemprop, Ttfcon
return
}

creationPayload, diags := getCreationPayload(ctx, plan.Configuration, r.CreationPayloadSetter)
creationPayload, diags := getCreationPayload(ctx, config.Configuration, r.CreationPayloadSetter)
if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() {
return
}
Expand Down Expand Up @@ -251,11 +246,6 @@ func (r *ResourceFabricItemConfigDefinitionProperties[Ttfprop, Titemprop, Ttfcon
tflog.Debug(ctx, "UPDATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "UPDATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

var plan, state ResourceFabricItemConfigDefinitionPropertiesModel[Ttfprop, Titemprop, Ttfconfig, Titemconfig]

Expand Down Expand Up @@ -322,9 +312,6 @@ func (r *ResourceFabricItemConfigDefinitionProperties[Ttfprop, Titemprop, Ttfcon
tflog.Debug(ctx, "DELETE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "DELETE", map[string]any{
"state": req.State,
})

var state ResourceFabricItemConfigDefinitionPropertiesModel[Ttfprop, Titemprop, Ttfconfig, Titemconfig]

Expand Down
20 changes: 6 additions & 14 deletions internal/pkg/fabricitem/resource_item_config_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ func (r *ResourceFabricItemConfigProperties[Ttfprop, Titemprop, Ttfconfig, Titem
tflog.Debug(ctx, "CREATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "CREATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
})

var plan ResourceFabricItemConfigPropertiesModel[Ttfprop, Titemprop, Ttfconfig, Titemconfig]
var plan, config ResourceFabricItemConfigPropertiesModel[Ttfprop, Titemprop, Ttfconfig, Titemconfig]

if resp.Diagnostics.Append(req.Config.Get(ctx, &config)...); resp.Diagnostics.HasError() {
return
}

if resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...); resp.Diagnostics.HasError() {
return
Expand All @@ -104,7 +104,7 @@ func (r *ResourceFabricItemConfigProperties[Ttfprop, Titemprop, Ttfconfig, Titem
reqCreate.setDescription(plan.Description)
reqCreate.setType(r.Type)

creationPayload, diags := getCreationPayload(ctx, plan.Configuration, r.CreationPayloadSetter)
creationPayload, diags := getCreationPayload(ctx, config.Configuration, r.CreationPayloadSetter)
Copy link

@OrBaubergMicrosoft OrBaubergMicrosoft Mar 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getCreationPayload takes Tconfiguration as an argument, how did it work without it?
because the property setter uses the type specific configuration properties , and they exist also in the plan?

if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() {
return
}
Expand Down Expand Up @@ -184,11 +184,6 @@ func (r *ResourceFabricItemConfigProperties[Ttfprop, Titemprop, Ttfconfig, Titem
tflog.Debug(ctx, "UPDATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "UPDATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

var plan, state ResourceFabricItemConfigPropertiesModel[Ttfprop, Titemprop, Ttfconfig, Titemconfig]

Expand Down Expand Up @@ -236,9 +231,6 @@ func (r *ResourceFabricItemConfigProperties[Ttfprop, Titemprop, Ttfconfig, Titem
tflog.Debug(ctx, "DELETE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "DELETE", map[string]any{
"state": req.State,
})

var state ResourceFabricItemConfigPropertiesModel[Ttfprop, Titemprop, Ttfconfig, Titemconfig]

Expand Down
17 changes: 0 additions & 17 deletions internal/pkg/fabricitem/resource_item_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ func (r *ResourceFabricItemDefinition) ModifyPlan(ctx context.Context, req resou
tflog.Debug(ctx, "MODIFY PLAN", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "MODIFY PLAN", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

if !req.State.Raw.IsNull() && !req.Plan.Raw.IsNull() {
var plan, state resourceFabricItemDefinitionModel
Expand Down Expand Up @@ -128,10 +123,6 @@ func (r *ResourceFabricItemDefinition) Create(ctx context.Context, req resource.
tflog.Debug(ctx, "CREATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "CREATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
})

var plan resourceFabricItemDefinitionModel

Expand Down Expand Up @@ -225,11 +216,6 @@ func (r *ResourceFabricItemDefinition) Update(ctx context.Context, req resource.
tflog.Debug(ctx, "UPDATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "UPDATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

var plan, state resourceFabricItemDefinitionModel

Expand Down Expand Up @@ -294,9 +280,6 @@ func (r *ResourceFabricItemDefinition) Delete(ctx context.Context, req resource.
tflog.Debug(ctx, "DELETE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "DELETE", map[string]any{
"state": req.State,
})

var state resourceFabricItemDefinitionModel

Expand Down
17 changes: 0 additions & 17 deletions internal/pkg/fabricitem/resource_item_definition_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ func (r *ResourceFabricItemDefinitionProperties[Ttfprop, Titemprop]) ModifyPlan(
tflog.Debug(ctx, "MODIFY PLAN", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "MODIFY PLAN", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

if !req.State.Raw.IsNull() && !req.Plan.Raw.IsNull() {
var plan, state ResourceFabricItemDefinitionPropertiesModel[Ttfprop, Titemprop]
Expand Down Expand Up @@ -118,10 +113,6 @@ func (r *ResourceFabricItemDefinitionProperties[Ttfprop, Titemprop]) Create(ctx
tflog.Debug(ctx, "CREATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "CREATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
})

var plan ResourceFabricItemDefinitionPropertiesModel[Ttfprop, Titemprop]

Expand Down Expand Up @@ -220,11 +211,6 @@ func (r *ResourceFabricItemDefinitionProperties[Ttfprop, Titemprop]) Update(ctx
tflog.Debug(ctx, "UPDATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "UPDATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

var plan, state ResourceFabricItemDefinitionPropertiesModel[Ttfprop, Titemprop]

Expand Down Expand Up @@ -291,9 +277,6 @@ func (r *ResourceFabricItemDefinitionProperties[Ttfprop, Titemprop]) Delete(ctx
tflog.Debug(ctx, "DELETE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "DELETE", map[string]any{
"state": req.State,
})

var state ResourceFabricItemDefinitionPropertiesModel[Ttfprop, Titemprop]

Expand Down
12 changes: 0 additions & 12 deletions internal/pkg/fabricitem/resource_item_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ func (r *ResourceFabricItemProperties[Ttfprop, Titemprop]) Create(ctx context.Co
tflog.Debug(ctx, "CREATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "CREATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
})

var plan ResourceFabricItemPropertiesModel[Ttfprop, Titemprop]

Expand Down Expand Up @@ -173,11 +169,6 @@ func (r *ResourceFabricItemProperties[Ttfprop, Titemprop]) Update(ctx context.Co
tflog.Debug(ctx, "UPDATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "UPDATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

var plan, state ResourceFabricItemPropertiesModel[Ttfprop, Titemprop]

Expand Down Expand Up @@ -225,9 +216,6 @@ func (r *ResourceFabricItemProperties[Ttfprop, Titemprop]) Delete(ctx context.Co
tflog.Debug(ctx, "DELETE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "DELETE", map[string]any{
"state": req.State,
})

var state ResourceFabricItemPropertiesModel[Ttfprop, Titemprop]

Expand Down
12 changes: 0 additions & 12 deletions internal/services/domain/resource_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ func (r *resourceDomain) Create(ctx context.Context, req resource.CreateRequest,
tflog.Debug(ctx, "CREATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "CREATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
})

var plan, state resourceDomainModel

Expand Down Expand Up @@ -245,11 +241,6 @@ func (r *resourceDomain) Update(ctx context.Context, req resource.UpdateRequest,
tflog.Debug(ctx, "UPDATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "UPDATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

var plan resourceDomainModel

Expand Down Expand Up @@ -291,9 +282,6 @@ func (r *resourceDomain) Delete(ctx context.Context, req resource.DeleteRequest,
tflog.Debug(ctx, "DELETE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "DELETE", map[string]any{
"state": req.State,
})

var state resourceDomainModel

Expand Down
12 changes: 0 additions & 12 deletions internal/services/domain/resource_domain_role_assignments.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ func (r *resourceDomainRoleAssignments) Create(ctx context.Context, req resource
tflog.Debug(ctx, "CREATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "CREATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
})

var plan resourceDomainRoleAssignmentsModel

Expand Down Expand Up @@ -229,11 +225,6 @@ func (r *resourceDomainRoleAssignments) Update(ctx context.Context, req resource
tflog.Debug(ctx, "UPDATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "UPDATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

var plan, state resourceDomainRoleAssignmentsModel

Expand Down Expand Up @@ -307,9 +298,6 @@ func (r *resourceDomainRoleAssignments) Delete(ctx context.Context, req resource
tflog.Debug(ctx, "DELETE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "DELETE", map[string]any{
"state": req.State,
})

var state resourceDomainRoleAssignmentsModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ func (r *resourceDomainWorkspaceAssignments) Create(ctx context.Context, req res
tflog.Debug(ctx, "CREATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "CREATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
})

var plan resourceDomainWorkspaceAssignmentsModel

Expand Down Expand Up @@ -199,11 +195,6 @@ func (r *resourceDomainWorkspaceAssignments) Update(ctx context.Context, req res
tflog.Debug(ctx, "UPDATE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "UPDATE", map[string]any{
"config": req.Config,
"plan": req.Plan,
"state": req.State,
})

var plan, state resourceDomainWorkspaceAssignmentsModel

Expand Down Expand Up @@ -283,9 +274,6 @@ func (r *resourceDomainWorkspaceAssignments) Delete(ctx context.Context, req res
tflog.Debug(ctx, "DELETE", map[string]any{
"action": "start",
})
tflog.Trace(ctx, "DELETE", map[string]any{
"state": req.State,
})

var state resourceDomainWorkspaceAssignmentsModel

Expand Down
12 changes: 7 additions & 5 deletions internal/services/kqldatabase/models_resource_kql_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import (
)

type kqlDatabaseConfigurationModel struct {
DatabaseType types.String `tfsdk:"database_type"`
EventhouseID customtypes.UUID `tfsdk:"eventhouse_id"`
InvitationToken types.String `tfsdk:"invitation_token"`
SourceClusterURI customtypes.URL `tfsdk:"source_cluster_uri"`
SourceDatabaseName types.String `tfsdk:"source_database_name"`
DatabaseType types.String `tfsdk:"database_type"`
EventhouseID customtypes.UUID `tfsdk:"eventhouse_id"`
InvitationToken types.String `tfsdk:"invitation_token"`
InvitationTokenWO types.String `tfsdk:"invitation_token_wo"`
InvitationTokenWOVersion types.Int32 `tfsdk:"invitation_token_wo_version"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the invitation token is a part of the creation payload, meaning that currently it cannot be update. why is the versioning needed?
I think it's only relevant for read only & updateable properties.

SourceClusterURI customtypes.URL `tfsdk:"source_cluster_uri"`
SourceDatabaseName types.String `tfsdk:"source_database_name"`
}
Loading
Loading