Skip to content

Commit

Permalink
Implement delete for destination resource
Browse files Browse the repository at this point in the history
  • Loading branch information
danafallon committed Jul 29, 2024
1 parent 83766cb commit 796176c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
16 changes: 10 additions & 6 deletions examples/deployments/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ resource "artie_deployment" "example" {
skip_delete = false
}
},
{
name = "new_table"
schema = ""
advanced_settings = {}
},
{
name = "stock"
schema = ""
Expand All @@ -70,6 +65,15 @@ resource "artie_deployment" "example" {
}
}

# resource "artie_destination" "bigquery2" {
# name = "BigQuery"
# label = "BigQuery2 (to delete)"
# config = {
# gcp_location = "us"
# gcp_project_id = "artie-labs"
# }
# }

# resource "artie_deployment" "newdeployment" {
# name = "New deployment from tf"
# source = {
Expand All @@ -91,7 +95,7 @@ resource "artie_deployment" "example" {
# },
# ]
# }
# destination_uuid = "fa7d4efc-3957-41e5-b29c-66e2d49bffde"
# destination_uuid = artie_destination.bigquery2.uuid
# destination_config = {
# dataset = "customers"
# }
Expand Down
13 changes: 12 additions & 1 deletion internal/provider/destination_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,18 @@ func (r *DestinationResource) Delete(ctx context.Context, req resource.DeleteReq
if resp.Diagnostics.HasError() {
return
}
// TODO implement Delete

apiReq, err := http.NewRequest("DELETE", fmt.Sprintf("%s/destinations/%s", r.endpoint, data.UUID.ValueString()), nil)
if err != nil {
resp.Diagnostics.AddError("Unable to Delete Destination", err.Error())
return
}

_, err = r.handleAPIRequest(apiReq)
if err != nil {
resp.Diagnostics.AddError("Unable to Delete Destination", err.Error())
return
}
}

func (r *DestinationResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
Expand Down

0 comments on commit 796176c

Please sign in to comment.